Skip to content

[AutoDiff] Fix pullback subset thunk generation crash. #33969

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

Merged
merged 1 commit into from
Sep 16, 2020

Conversation

dan-zheng
Copy link
Contributor

Cherry-pick of #33968 to tensorflow branch.


Fix pullback subset thunk generation crash due to unmapped parameter index
for inout differentiability parameters.

Resolves TF-1315:

$ swiftc tf1315-pullback-subset-parameter-thunk-generation.swift 
Assertion failed: (I <= this->end() && "Inserting past the end of the vector."), function insert, file llvm-project/llvm/include/llvm/ADT/SmallVector.h, line 550.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift-frontend -target x86_64-apple-macosx10.9 -module-cache-path build/Ninja-ReleaseAssert/swift-macosx-x86_64/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.16.sdk -swift-version 4 -ignore-module-source-info -typo-correction-limit 10 -emit-sil test/AutoDiff/compiler_crashers_fixed/tf1315-pullback-subset-parameter-thunk-generation.swift
1.	Swift version 5.3-dev (LLVM 32ba33c87eb2475, Swift d90d0b390c96816)
2.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for main.main)
3.	While running pass #33 SILModuleTransform "Differentiation".
4.	While canonicalizing `differentiable_function` SIL node   %17 = differentiable_function [parameters 2] [results 0] %13 : $@convention(thin) (Int, Float, @inout Float) -> () // users: %19, %18
5.	While ...in SIL function "@AD__$s4main7TF_1315yS2fF__vjp_src_0_wrt_0".
 for 'TF_1315(_:)' (at test/AutoDiff/compiler_crashers_fixed/tf1315-pullback-subset-parameter-thunk-generation.swift:19:1)
0  swift-frontend           0x0000000107be25a5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x0000000107be14e8 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x0000000107be2b86 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff6e0115fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338670598688
5  libsystem_c.dylib        0x00007fff6dee7808 abort + 120
6  libsystem_c.dylib        0x00007fff6dee6ac6 err + 0
7  swift-frontend           0x0000000107de03a3 llvm::SmallVectorImpl<swift::SILValue>::insert(swift::SILValue*, swift::SILValue const&) (.cold.3) + 35
8  swift-frontend           0x00000001038e3594 llvm::SmallVectorImpl<swift::SILValue>::insert(swift::SILValue*, swift::SILValue const&) + 276
9  swift-frontend           0x00000001038e2e96 swift::autodiff::getOrCreateSubsetParametersThunkForLinearMap(swift::SILOptFunctionBuilder&, swift::SILFunction*, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::AutoDiffDerivativeFunctionKind, swift::SILAutoDiffI  1 [AutoDiff] Fix pullback subset thunk generation crash.
ndices, swift::SILAutoDiffIndices) + 8262
10 swift-frontend           0x00000001038e4eab swift::autodiff::getOrCreateSubsetParametersThunkForDerivativeFunction(swift::SILOptFunctionBuilder&, swift::SILValue, swift::SILValue, swift::AutoDiffDerivativeFunctionKind, swift::SILAutoDiffIndices, swift::SILAutoDiffIndices) + 6395
11 swift-frontend           0x0000000103a2ca32 (anonymous namespace)::DifferentiationTransformer::promoteToDifferentiableFunction(swift::DifferentiableFunctionInst*, swift::SILBuilder&, swift::SILLocation, swift::autodiff::DifferentiationInvoker) + 7842

Fix pullback subset thunk generation crash due to unmapped parameter index
for `inout` differentiability parameters.

Resolves TF-1315.
@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Sep 16, 2020
@dan-zheng dan-zheng requested a review from marcrasi September 16, 2020 18:42
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng dan-zheng merged commit c08d080 into swiftlang:tensorflow Sep 16, 2020
@dan-zheng dan-zheng deleted the tensorflow-TF-1315 branch September 16, 2020 19:06
ainu-bot pushed a commit to google/swift that referenced this pull request Sep 16, 2020
…tage

* 'tensorflow' of github.com:apple/swift:
  [AutoDiff] Fix pullback subset thunk generation crash. (swiftlang#33969)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tensorflow This is for "tensorflow" branch PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant