-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[AST][AutoDiff] Provide Lit test case for AutoDiff GenericTypeParamDecl AST verification failure. #38745
[AST][AutoDiff] Provide Lit test case for AutoDiff GenericTypeParamDecl AST verification failure. #38745
Conversation
Disabling verification might be considered hacky. An alternative fix could be to change differentiation to generate nested struct/enum declarations, so that the Looping in @slavapestov: any advice on how to fix this? Happy to provide more context on struct/enum declaration generation by autodiff, I'm not sure there's precedent for generating implicit struct/enum declarations that potentially have |
I don't think we spent time to find a minimal reproducer for this issue. From #32343 (comment):
The differentiation transform generates struct/enum declarations representing auxiliary data structures – pullback structs storing captured pullback values, and branching trace enums storing control flow path information – for each function that needs to be automatically differentiated. To demonstrate the flavor, here's a case where differerentiation would generate struct/enum declarations with non-depth 0 import _Differentiation
struct A<T>: Differentiable {
struct B<U>: Differentiable {
@differentiable(reverse, wrt: (self, x))
func foo(_ x: Float) -> Float {
x
}
}
} $ swiftc autodiff.swift -emit-sil -Xllvm -debug-only=differentiation
...
[AD] Generated linear map structs and branching trace enums for @$s8autodiff1AV1BV3fooyS2fF:
@frozen struct _AD__$s8autodiff1AV1BV3fooyS2fF_bb0__PB__src_0_wrt_0_1_r__l<τ_1_0> {
}
@frozen enum _AD__$s8autodiff1AV1BV3fooyS2fF_bb0__Pred__src_0_wrt_0_1_r__l<τ_1_0> {
} |
I managed to produce a minimal reproducer for the assert supposed to be evaded by this hack: https://github.com/astrotuna201/ASTVerifierReproducer.git |
Nice, thanks for sharing! Do you happen to be familiar with how the Swift compiler test suite works? If you could convert your SwiftPM package reproducer into a multi-module lit test case in Here's a multi-module (multi-file) lit test case we can use as a template. |
@swift-ci Please test |
+1 to what Dan suggested. Perhaps we should look at the reproducer and emit the right level of nesting. I can take a look today and follow up. |
I haven't done this before, but here is a try, and indeed I manage to trigger with a single line compile command. Is hope it is helpful.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -emit-module -module-name pr32302 -emit-module-path %t/pr32302.swiftmodule -swift-version 5 -c %S/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift -Xfrontend -requirement-machine=off
// pr32302 / pr32343 / pr38745 : reproduce assert with _Differentiation where
// ASTVerifier.cpp asserts "GenericTypeParamDecl has incorrect depth"
import _Differentiation
public protocol Layer: Differentiable {
associatedtype Input: Differentiable
associatedtype Output: Differentiable
var differentiableVectorView: TangentVector { get }
@differentiable(reverse)
func callAsFunction(_ input: Input) -> Output
}
extension Differentiable {
@differentiable(reverse)
public func sequenced<L1: Layer, L2: Layer>(through l1: L1, _ l2: L2) -> L2.Output
where L1.Input == Self, L1.Output == L2.Input {
let o1 = l1(self)
return l2(o1)
}
}
// GenericTypeParamDecl has incorrect depth
// Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
// Stack dump:
// 0. Program arguments: /work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/bin/swift-frontend -frontend -merge-modules -emit-module /tmp/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth-acc95c.swiftmodule -parse-as-library -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-unknown-linux-gnu -warn-on-potentially-unavailable-enum-case -disable-objc-interop -module-cache-path /work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache -swift-version 5 -define-availability "SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0" -requirement-machine=off -emit-module-doc-path /work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/test-linux-x86_64/AutoDiff/compiler_crashers/Output/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift.tmp/pr32302.swiftdoc -emit-module-source-info-path /work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/test-linux-x86_64/AutoDiff/compiler_crashers/Output/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift.tmp/pr32302.swiftsourceinfo -module-name pr32302 -o /work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/test-linux-x86_64/AutoDiff/compiler_crashers/Output/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift.tmp/pr32302.swiftmodule
// 1. Swift version 5.6-dev (LLVM ba0b85f590c1ba2, Swift 319b3e64aaeb252)
// 2. Compiling with the current language version
// 3. While verifying GenericTypeParamDecl 'τ_1_0' (in module 'pr32302')
// #0 0x000000000632fb13 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /work/software/swift-stocktoolchain/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:13
// #1 0x000000000632dda0 llvm::sys::RunSignalHandlers() /work/software/swift-stocktoolchain/llvm-project/llvm/lib/Support/Signals.cpp:72:18
// #2 0x000000000632fe95 SignalHandler(int) /work/software/swift-stocktoolchain/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
// #3 0x00007ffbfc0ab3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
// #4 0x00007ffbfbb3618b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b)
// #5 0x00007ffbfbb15859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
// #6 0x0000000002417d95 llvm::MutableArrayRef<swift::GenericTypeParamDecl*>::operator[](unsigned long) const /work/software/swift-stocktoolchain/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:425:7
// #7 0x0000000002417d95 (anonymous namespace)::Verifier::verifyCheckedAlways(swift::GenericTypeParamDecl*) /work/software/swift-stocktoolchain/swift/lib/AST/ASTVerifier.cpp:2866:11
// #8 0x0000000002417d95 swift::GenericTypeParamDecl* (anonymous namespace)::Verifier::dispatchVisitPost<swift::GenericTypeParamDecl*>(swift::GenericTypeParamDecl*) /work/software/swift-stocktoolchain/swift/lib/AST/ASTVerifier.cpp:426:9
// #9 0x0000000002417d95 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) /work/software/swift-stocktoolchain/swift/include/swift/AST/DeclNodes.def:159:7
// #10 0x00000000024214c7 (anonymous namespace)::Traversal::doIt(swift::Decl*) /work/software/swift-stocktoolchain/swift/lib/AST/ASTWalker.cpp:1275:12
// #11 0x0000000002421433 swift::Decl::walk(swift::ASTWalker&) /work/software/swift-stocktoolchain/swift/lib/AST/ASTWalker.cpp:1909:3
// #12 0x000000000240c6dd swift::verify(swift::Decl*) /work/software/swift-stocktoolchain/swift/lib/AST/ASTVerifier.cpp:3761:1
// #13 0x0000000001285157 swift::ModuleFile::verify() const /work/software/swift-stocktoolchain/swift/lib/Serialization/ModuleFile.cpp:1244:3
// #14 0x00000000011ead9a swift::SerializedModuleLoaderBase::verifyAllModules() /work/software/swift-stocktoolchain/swift/lib/Serialization/SerializedModuleLoader.cpp:1268:39
// #15 0x000000000236546a swift::ASTContext::verifyAllLoadedModules() const /work/software/swift-stocktoolchain/swift/lib/AST/ASTContext.cpp:1794:21
// #16 0x000000000058259d performEndOfPipelineActions(swift::CompilerInstance&) /work/software/swift-stocktoolchain/swift/lib/FrontendTool/FrontendTool.cpp:933:37
// #17 0x000000000057faa7 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) /work/software/swift-stocktoolchain/swift/lib/FrontendTool/FrontendTool.cpp:1252:10
// #18 0x000000000057ef21 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) /work/software/swift-stocktoolchain/swift/lib/FrontendTool/FrontendTool.cpp:2154:8
// #19 0x00000000004b36e7 run_driver(llvm::StringRef, llvm::ArrayRef<char const*>) /work/software/swift-stocktoolchain/swift/lib/DriverTool/driver.cpp:196:7
// #20 0x00000000004b3312 swift::mainEntry(int, char const**) /work/software/swift-stocktoolchain/swift/lib/DriverTool/driver.cpp:402:5
// #21 0x00000000004b2c72 main /work/software/swift-stocktoolchain/swift/tools/driver/driver.cpp:20:3
// #22 0x00007ffbfbb170b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
// #23 0x00000000004b2b7e _start (/work/software/swift-stocktoolchain/build/ds/swift-linux-x86_64/bin/swift-frontend+0x4b2b7e) |
When the compiler builds AST nodes, it should have perfect knowledge of the correct way to do so. We should not be ducking AST construction errors like this. It looks like AutoDiff clones the generic parameters directly from the primary declaration when it's creating the linear map and branch tracing ASTs. This is not correct - you must recontextualize these generic parameters. |
…t/AutoDiff/compiler_crashers/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have now reverted hacky patch
and provided compiler crash reproducer instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Could you please update the PR title and description to reflect the latest changes?
Ok, done, many thanks! |
@swift-ci Please test |
@rxwei @dan-zheng sorry, could some someone please trigger a CI test? Thanks! |
@swift-ci Please test |
Build failed |
Build failed |
@dan-zheng sorry, I think I misunderstood how lit should be configured for expected failing tests: I wrote RUN: not --crash but it still marked as failed, perhaps because it crashed. Now I inserted XFAIL: * ... could you please trigger another CI test? Thanks! |
@swift-ci Please test |
Encountered this issue when compiling |
Interestingly, the reproducer by @astrotuna201 does not reproduce this issue anymore. The bug however can be reproduced by building |
Hi Fan Jiang,
I still see the same issue in the current ToT:
swift-LOCAL-2021-10-14-a.xctoolchain/usr/bin/swiftc -emit-module -module-name pr32302 -emit-module-path pr32302.swiftmodule -swift-version 5 -c pr32302-autodiff-generictypeparamdecl-has-incorrect-depth.swift -Xfrontend -requirement-machine=off
GenericTypeParamDecl has incorrect depth
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Users/xxx/swift-source2/build/buildbot_osx/intermediate-install/macosx-x86_64/Library/Developer/Toolchains/swift-LOCAL-2021-10-14-a.xctoolchain/usr/bin/swift-frontend -frontend -merge-modules -emit-module /var/folders/rp/c0_pxspj11g3dzxkc_qfxvdr0000gn/T/pr32302-autodiff-generictypeparamdecl-has-incorrect-depth-9b0224.swiftmodule -parse-as-library -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-darwin20.6.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -color-diagnostics -swift-version 5 -requirement-machine=off -target-sdk-version 11.3 -emit-module-doc-path pr32302.swiftdoc -emit-module-source-info-path pr32302.swiftsourceinfo -module-name pr32302 -o pr32302.swiftmodule
1. Apple Swift version 5.6-dev (LLVM da8bf1d, Swift 256f576c5af5e6a)
2. Compiling with the current language version
3. While verifying GenericTypeParamDecl 'τ_1_0' (in module 'pr32302')
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 0x000000010e0062f7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1 swift-frontend 0x000000010e005515 llvm::sys::RunSignalHandlers() + 85
2 swift-frontend 0x000000010e006930 SignalHandler(int) + 288
3 libsystem_platform.dylib 0x00007fff20451d7d _sigtramp + 29
4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339974763168
5 libsystem_c.dylib 0x00007fff20361406 abort + 125
6 swift-frontend 0x000000010e4ede19 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) (.cold.6) + 25
7 swift-frontend 0x000000010a36c0b3 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 5875
8 swift-frontend 0x000000010a3736f9 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 121
9 swift-frontend 0x000000010a37366b swift::Decl::walk(swift::ASTWalker&) + 27
10 swift-frontend 0x000000010a35ecea swift::verify(swift::Decl*) + 218
11 swift-frontend 0x0000000109846fd6 swift::ModuleFile::verify() const + 118
12 swift-frontend 0x00000001098bb588 swift::SerializedModuleLoaderBase::verifyAllModules() + 40
13 swift-frontend 0x000000010a2ce21a swift::ASTContext::verifyAllLoadedModules() const + 90
14 swift-frontend 0x0000000109293cb8 performEndOfPipelineActions(swift::CompilerInstance&) + 680
15 swift-frontend 0x0000000109290172 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 10514
16 swift-frontend 0x0000000109256c39 swift::mainEntry(int, char const**) + 553
17 libdyld.dylib 0x00007fff20427f3d start + 1
18 libdyld.dylib 0x000000000000001c start + 18446603339974934752
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: merge-module command failed due to signal 6 (use -v to see invocation)
Maybe I did not write the lit test case properly? The bug report initially also did come from trying to build swift-apis.
… On 19 Oct 2021, at 06:36, Fan Jiang ***@***.***> wrote:
Interestingly, the reproducer by @astrotuna201 <https://github.com/astrotuna201> does not reproduce this issue anymore.
The bug however can be reproduced by building https://github.com/ProfFan/swift-apis/tree/fan/resurrection with current Swift main.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#38745 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AASIHUUU6XZE7NAMJR43CVDUHTYUNANCNFSM5BQXJEQQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@ProfFan messaged me privately asking for a follow-up to this crasher. Above, I explained the issue and mentioned fix strategies.
Following up with @rxwei from above, wonder if you still have time and interest in looking into a fix? The |
@dan-zheng Thank you for the help! :) @astrotuna201 I tried it on current main (Swift version 5.6-dev (LLVM 4c76989, Swift 8f443ff)
@rxwei Wonder if I can help in debugging this? The error message is not really helpful here because the crash happens at emit. Is there a way to print something like a big SIL dump at emit? I can also try fixing this issue if I can be bootstrapped on Swift dev. |
@ProfFan Oh, yes: Your are right! I recompiled and the original reproducer was by this commit 5 days ago:
90ec31a <90ec31a>
Thanks, Richard!
Will have to try the original case in swift-apis also.
… On 19 Oct 2021, at 15:32, Fan Jiang ***@***.***> wrote:
@dan-zheng <https://github.com/dan-zheng> Thank you for the help! :)
@astrotuna201 <https://github.com/astrotuna201> I tried it on current main (Swift version 5.6-dev (LLVM 4c76989, Swift 8f443ff <8f443ff>)
Target: x86_64-unknown-linux-gnu) and it didn't crash.
+1 to what Dan suggested. Perhaps we should look at the reproducer and emit the right level of nesting. I can take a look today and follow up.
@rxwei <https://github.com/rxwei> Wonder if I can help in debugging this? The error message is not really helpful here because the crash happens at emit. Is there a way to print something like a big SIL dump at emit?
I can also try fixing this issue if I can be bootstrapped on Swift dev.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#38745 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AASIHUSYLOB2G4SVAI5CRJTUHVXQVANCNFSM5BQXJEQQ>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
After a number of patches I can get
SIL dump: https://gist.github.com/ProfFan/9a7788d3a99a27b2fc863d8e0d89e848 |
Maybe related to https://bugs.swift.org/browse/SR-13263. |
The strange thing with |
@astrotuna201 Unfortunately after working around SR-13263 I also encountered the crash you are experiencing. $ swift test -c release -Xswiftc -DTENSORFLOW_USE_STANDARD_TOOLCHAIN -Xcc -I/home/fan/Projects/PL/Swift/s4tf_2021/Library/tensorflow-linux-x86_64/tensorflow-2.4.3/usr/include \
-Xlinker -L/home/fan/Projects/PL/Swift/s4tf_2021/Library/tensorflow-linux-x86_64/tensorflow-2.4.3/usr/lib
/home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:108:10: warning: variable 'offset' was never mutated; consider changing to 'let' constant
var (offset, scale) = {x in (x.offset, x.scale) }(self)
^
/home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:108:18: warning: variable 'scale' was never mutated; consider changing to 'let' constant
var (offset, scale) = {x in (x.offset, x.scale) }(self)
^
GenericTypeParamDecl has incorrect depth
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /usr/lib/swift-git/bin/swift-frontend -frontend -c /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/CollectionTesting.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/ContextTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/EpochsTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/FreezableTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/Helpers.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/InitializerTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/KeyPathIterableTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LayerTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorEvaluationTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorExplicitTraceTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorHandleTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorOperationTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorShapeInferenceTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorTFFunctionBuilderTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorTestHelper.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorTraceCacheTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LazyTensorTraceTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/LossTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/BasicTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/ComparisonTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/ImageTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/LinearAlgebraTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/MathTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/MatrixTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OperatorTests/NNTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/OptimizerTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/RuntimeTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/SamplingTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/SequencedTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/SequentialTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/SlicesTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/TensorAutoDiffTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/TensorGroupTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/TensorTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/TrivialModelTests.swift /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Tests/TensorFlowTests/XCTestManifests.swift -supplementary-output-file-map /tmp/TemporaryDirectory.f6Demt/supplementaryOutputs-1 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release -color-diagnostics -enable-testing -g -module-cache-path /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -D TENSORFLOW_USE_STANDARD_TOOLCHAIN -new-driver-path /usr/lib/swift-git/bin/swift-driver -resource-dir /usr/lib/swift-git/lib/swift -Xcc -fmodule-map-file=/home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/checkouts/swift-numerics/Sources/_NumericsShims/include/module.modulemap -Xcc -I -Xcc /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/checkouts/swift-numerics/Sources/_NumericsShims/include -Xcc -fmodule-map-file=/home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/CX10Modules/include/module.modulemap -Xcc -I -Xcc /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/CX10Modules/include -Xcc -fmodule-map-file=/home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/CTensorFlow/include/module.modulemap -Xcc -I -Xcc /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/Sources/CTensorFlow/include -Xcc -I/home/fan/Projects/PL/Swift/s4tf_2021/Library/tensorflow-linux-x86_64/tensorflow-2.4.3/usr/include -module-name TensorFlowTests -parse-as-library -num-threads 12 -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/CollectionTesting.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/ContextTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/EpochsTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/FreezableTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/Helpers.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/InitializerTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/KeyPathIterableTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LayerTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorEvaluationTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorExplicitTraceTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorHandleTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorOperationTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorShapeInferenceTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorTFFunctionBuilderTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorTestHelper.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorTraceCacheTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LazyTensorTraceTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/LossTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/BasicTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/ComparisonTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/ImageTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/LinearAlgebraTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/MathTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/MatrixTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OperatorTests/NNTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/OptimizerTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/RuntimeTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/SamplingTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/SequencedTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/SequentialTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/SlicesTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/TensorAutoDiffTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/TensorGroupTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/TensorTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/TrivialModelTests.swift.o -o /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/TensorFlowTests.build/XCTestManifests.swift.o -index-store-path /home/fan/Projects/PL/Swift/s4tf_2021/swift-apis/.build/x86_64-unknown-linux-gnu/release/index/store -index-system-modules
1. Swift version 5.6-dev (LLVM 30010bf3b070441, Swift 7349283a41ab6d8)
2. Compiling with the current language version
3. While verifying GenericTypeParamDecl 'τ_1_0' (in module 'TensorFlow')
#0 0x00005555e981bc13 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/swift-git/bin/swift-frontend+0x652ec13)
#1 0x00005555e981993e llvm::sys::RunSignalHandlers() (/usr/lib/swift-git/bin/swift-frontend+0x652c93e)
#2 0x00005555e981bf9a SignalHandler(int) (/usr/lib/swift-git/bin/swift-frontend+0x652ef9a)
#3 0x00007fbd9f237870 __restore_rt (/usr/lib/libpthread.so.0+0x13870)
#4 0x00007fbd9ec83d22 raise (/usr/lib/libc.so.6+0x3cd22)
#5 0x00007fbd9ec6d862 abort (/usr/lib/libc.so.6+0x26862)
#6 0x00005555e5394935 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) (/usr/lib/swift-git/bin/swift-frontend+0x20a7935)
#7 0x00005555e539d617 (anonymous namespace)::Traversal::doIt(swift::Decl*) (/usr/lib/swift-git/bin/swift-frontend+0x20b0617)
#8 0x00005555e539d583 swift::Decl::walk(swift::ASTWalker&) (/usr/lib/swift-git/bin/swift-frontend+0x20b0583)
#9 0x00005555e5389f94 swift::verify(swift::Decl*) (/usr/lib/swift-git/bin/swift-frontend+0x209cf94)
#10 0x00005555e4785fd6 swift::ModuleFile::verify() const (/usr/lib/swift-git/bin/swift-frontend+0x1498fd6)
#11 0x00005555e4728e08 swift::SerializedModuleLoaderBase::verifyAllModules() (/usr/lib/swift-git/bin/swift-frontend+0x143be08)
#12 0x00005555e52fd48a swift::ASTContext::verifyAllLoadedModules() const (/usr/lib/swift-git/bin/swift-frontend+0x201048a)
#13 0x00005555e4032e05 performEndOfPipelineActions(swift::CompilerInstance&) (/usr/lib/swift-git/bin/swift-frontend+0xd45e05)
#14 0x00005555e402e94e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/usr/lib/swift-git/bin/swift-frontend+0xd4194e)
#15 0x00005555e3ff996b swift::mainEntry(int, char const**) (/usr/lib/swift-git/bin/swift-frontend+0xd0c96b)
#16 0x00007fbd9ec6eb25 __libc_start_main (/usr/lib/libc.so.6+0x27b25)
#17 0x00005555e3ff955e _start (/usr/lib/swift-git/bin/swift-frontend+0xd0c55e)
error: fatalError So I think this issue has not been fixed. Actually this and SR-13263 may have the same underlying source. |
With the patches to debug info generation in recent months, I thought this would have been fixed. But the crash still happens on top-of-tree S4TF, so it has not been fixed. The behavior of SR-13263 has changed enough to warrant removing workarounds for it, but the SR reproducer still crashes. Crash
The crash in this pull request only occurs on development toolchains, with The crash happens on development toolchains when you import philipturner/differentiation in place of the Stdlib module. Perhaps the reason it doesn't crash on release toolchains is a bit more involved. |
Provides reproducer lit test case for AutoDiff implicit auxiliary struct and enum
declarations that clone implicit GenericTypeParamDecls from a generic
signature into a flat GenericParamList, and lead to a compiler assert about GenericTypeParamDecl depth during merge module operation.
Related to #32343.