-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-15566] Differentiable functions with control flow yield an assertion failure: "location is a VarDecl, but SILDebugVariable is empty" #57869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Accidental fix #40503 |
Unfortunately it seems this bug cropped up again in recent release (5.6, 2022-03-08) for the same tests as above: % xcrun /Library/Developer/Toolchains/swift-5.6-RELEASE.xctoolchain/usr/bin/swift --version
Apple Swift version 5.6 (swift-5.6-RELEASE)
Target: arm64-apple-macosx12.0
% xcrun /Library/Developer/Toolchains/swift-5.6-RELEASE.xctoolchain/usr/bin/swiftc crasher.swift -o crasher
error: compile command failed due to signal 6 (use -v to see invocation)
Assertion failed: ((!dyn_cast_or_null<VarDecl>(Loc.getAsASTNode<Decl>()) || Var) && "location is a VarDecl, but SILDebugVariable is empty"), function createAllocStack, file SILBuilder.h, line 389.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-5.6-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file crasher.swift -target arm64-apple-macosx12.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -color-diagnostics -new-driver-path /Library/Developer/Toolchains/swift-5.6-RELEASE.xctoolchain/usr/bin/swift-driver -resource-dir /Library/Developer/Toolchains/swift-5.6-RELEASE.xctoolchain/usr/lib/swift -module-name crasher -target-sdk-version 12.3 -o /var/folders/hq/bm2zh17n5gq1xbhtvm30rj7r0000gn/T/TemporaryDirectory.XXxuRK/crasher-1.o
1. Apple Swift version 5.6 (swift-5.6-RELEASE)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines \{ Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for crasher)
4. While running pass #​142 SILModuleTransform "Differentiation".
5. While processing // differentiability witness for Test.init(v1:)
sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s7crasher4TestV2v1ACSaySaySfGG_tcfC : $@convention(method) (@owned Array<Array<Float>>, @thin Test.Type) -> @owned Test {
}
on SIL function "@$s7crasher4TestV2v1ACSaySaySfGG_tcfC".
for 'init(v1:)' (at crasher.swift:7:12)
6. While generating VJP for SIL function "@$s7crasher4TestV2v1ACSaySaySfGG_tcfC".
for 'init(v1:)' (at crasher.swift:7:12)
7. While generating pullback for SIL function "@$s7crasher4TestV2v1ACSaySaySfGG_tcfC".
for 'init(v1:)' (at crasher.swift:7:12)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000106b3c9a4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000106b3bc04 llvm::sys::RunSignalHandlers() + 128
2 swift-frontend 0x0000000106b3d008 SignalHandler(int) + 304
3 libsystem_platform.dylib 0x000000019d5bd4c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x000000019d5a5ee0 pthread_kill + 288
5 libsystem_c.dylib 0x000000019d4e0340 abort + 168
6 libsystem_c.dylib 0x000000019d4df754 err + 0
7 swift-frontend 0x0000000106b880e8 swift::SILCloner<(anonymous namespace)::TrivialCloner>::getOpType(swift::SILType) (.cold.1) + 0
8 swift-frontend 0x00000001029d8640 swift::SILBuilder::createAllocStack(swift::SILLocation, swift::SILType, llvm::Optional<swift::SILDebugVariable>, bool, bool) + 668
9 swift-frontend 0x0000000102f50ce8 swift::autodiff::TangentBuilder::emitAdd(swift::SILLocation, swift::SILValue, swift::SILValue) + 464
10 swift-frontend 0x0000000102f46cc4 swift::autodiff::PullbackCloner::Implementation::accumulateAdjointsDirect(swift::autodiff::AdjointValue, swift::autodiff::AdjointValue, swift::SILLocation) + 424
11 swift-frontend 0x0000000102f40b98 swift::autodiff::PullbackCloner::Implementation::addAdjointValue(swift::SILBasicBlock*, swift::SILValue, swift::autodiff::AdjointValue, swift::SILLocation) + 1172
12 swift-frontend 0x0000000102f4452c swift::autodiff::PullbackCloner::Implementation::visit(swift::SILInstruction*) + 200
13 swift-frontend 0x0000000102f40fbc swift::autodiff::PullbackCloner::Implementation::visitSILBasicBlock(swift::SILBasicBlock*) + 688
14 swift-frontend 0x0000000102f3e710 swift::autodiff::PullbackCloner::Implementation::run() + 5064
15 swift-frontend 0x0000000102f3d31c swift::autodiff::PullbackCloner::run() + 24
16 swift-frontend 0x0000000102f58ea8 swift::autodiff::VJPCloner::Implementation::run() + 1368
17 swift-frontend 0x0000000102f594c4 swift::autodiff::VJPCloner::run() + 24
18 swift-frontend 0x000000010304eeec (anonymous namespace)::DifferentiationTransformer::canonicalizeDifferentiabilityWitness(swift::SILDifferentiabilityWitness*, swift::autodiff::DifferentiationInvoker, swift::IsSerialized_t) + 5272
19 swift-frontend 0x000000010304d048 (anonymous namespace)::Differentiation::run() + 924
20 swift-frontend 0x00000001030a4eb4 swift::SILPassManager::runModulePass(unsigned int) + 632
21 swift-frontend 0x00000001030aa268 swift::SILPassManager::execute() + 628
22 swift-frontend 0x00000001030a1fe4 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 68
23 swift-frontend 0x00000001030a1f6c swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 68
24 swift-frontend 0x00000001030bfc40 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 28
25 swift-frontend 0x00000001030ac544 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 252
26 swift-frontend 0x00000001030a21e0 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 84
27 swift-frontend 0x00000001030aebb4 swift::runSILDiagnosticPasses(swift::SILModule&) + 92
28 swift-frontend 0x0000000102967d34 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 68
29 swift-frontend 0x000000010282c608 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 620
30 swift-frontend 0x000000010282be3c bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_19>(long, swift::CompilerInstance&) + 572
31 swift-frontend 0x0000000102822a8c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2960
32 swift-frontend 0x00000001027e1104 swift::mainEntry(int, char const**) + 524
33 dyld 0x000000010f121088 start + 516 |
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Additional Detail from JIRA
md5: cc857cf6edb138b26261ab8a61df5c82
Issue Description:
Starting with the 2021-12-04 nightly snapshot, certain differentiable functions that involve struct or local `var`s cause an assertion failure of "location is a VarDecl, but SILDebugVariable is empty". A simple reproducer is as follows:
Place the above by itself in a file and build with swiftc file.swift to trigger this failure. The full assertion text is as follows:
The text was updated successfully, but these errors were encountered: