We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
apply
md5: 0e331d3f94835a4bb9b249e638ef5611
Issue Description:
import _Differentiation func foo<T: Differentiable>(_ x: T) -> (T, T) { (x, x) } func bar<T: Differentiable>(_ x: T) -> T { let (y1, y2) = foo(x) return y1 } print(derivative(at: 3, in: bar))
$ swift -Xfrontend -enable-experimental-forward-mode-differentiation -Xllvm -debug-only=differentiation error.swift ... [AD] JVPCloner visited: [ORIG] %6 = apply %5<T>(%3, %4, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : Differentiable> (@in_guara nteed τ_0_0) -> (@out τ_0_0, @out τ_0_0) [AD] JVP-transforming: %6 = apply %5<T>(%3, %4, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : Differentiable> (@in_guaranteed τ_0_0) -> (@out τ_0_0, @out τ_0_0) [AD] Active indices: params={0}, results={0} [AD] Applied jvp function %13 = apply %10(%3, %4, %1) : $@callee_guaranteed (@in_guaranteed τ_0_0) -> (@out τ_0_0, @out τ_0_0, @o wned @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> @out τ_0_1 for <τ_0_0.Tange ntVector, τ_0_0.TangentVector>) Assertion failed: (it != bufferMap.end() && "Tangent buffer should already exist"), function getTangentBu ffer, file /Users/danielzheng/swift-build/swift/lib/SILOptimizer/Differentiation/JVPCloner.cpp, line 316. Stack dump: 0. Program arguments: /Users/danielzheng/swift-build/build/Ninja-ReleaseAssert/swift-macosx-x86_64/b in/swift-frontend -frontend -interpret error.swift -enable-objc-interop -sdk /Applications/Xcode-beta.app /Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -enable-experimental-forward-mode -differentiation -Xllvm -debug-only=differentiation -target-sdk-version 10.16 -module-name error 1. Swift version 5.3-dev (LLVM 19447e27024a8d4, Swift cea678431f903e4) 2. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for error.error) 3. While running pass #​45 SILModuleTransform "Differentiation". 4. While canonicalizing `differentiable_function` SIL node %24 = differentiable_function [paramete rs 0] [results 0] %18 : $@callee_guaranteed (@in_guaranteed Double) -> @out Double // user: %25 5. While ...in SIL function "@main". 6. While processing // differentiability witness for bar<A>(_:) sil_differentiability_witness private [parameters 0] [results 0] <τ_0_0 where τ_0_0 : Differentiable> @$s 5error3baryxx16_Differentiation14DifferentiableRzlF : $@convention(thin) <T where T : Differentiable> (@i n_guaranteed T) -> @out T { } on SIL function "@$s5error3baryxx16_Differentiation14DifferentiableRzlF". for 'bar(_:)' (at error.swift:5:1) 7. While generating JVP and differential for SIL function "@$s5error3baryxx16_Differentiation14DifferentiableRzlF". for 'bar(_:)' (at error.swift:5:1) 0 swift-frontend 0x000000010df8c8b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37 1 swift-frontend 0x000000010df8b888 llvm::sys::RunSignalHandlers() + 248 2 swift-frontend 0x000000010df8ce96 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 0x000000010e174113 swift::autodiff::JVPCloner::Implementation::getTangentBuffer(swift::SILBasicBlock*, swift::SILValue) (.cold.1) + 35 8 swift-frontend 0x0000000109fa7c21 swift::autodiff::JVPCloner::Implementation::getTangentBuffer(swift::SILBasicBlock*, swift::SILValue) + 145 9 swift-frontend 0x0000000109fa9081 swift::autodiff::JVPCloner::Implementation::emitTangentForApplyInst(swift::ApplyInst*, swift::SILAutoDiffIndices, swift::CanTypeWrapper<swift::SILFunctionType>) + 257 10 swift-frontend 0x0000000109f9b93b swift::autodiff::JVPCloner::Implementation::visitApplyInst(swift::ApplyInst*) + 6139
The crash occurs here:
for (auto indRes : ai->getIndirectSILResults()) diffArgs.push_back(getTangentBuffer(bb, indRes));
This logic should iterate over only the active apply indirect results, not all of the indirect results.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Additional Detail from JIRA
md5: 0e331d3f94835a4bb9b249e638ef5611
Issue Description:
The crash occurs here:
This logic should iterate over only the active
apply
indirect results, not all of the indirect results.The text was updated successfully, but these errors were encountered: