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
@derivative
md5: 93134401dc62b1c6e50125144cd17b8c
Parent-Task:
blocks:
@differentiable(jvp:vjp:)
Issue Description:
@derivative attribute SILGen crashes for foreign original declarations (e.g. from Clang).
import Darwin @derivative(of: tan) @inlinable func vjpTan(_ x: Double) -> (value: Double, pullback: (Double) -> Double) { fatalError() }
$ swift -Xllvm -enable-experimental-cross-file-derivative-registration tan.swift SIL verification failed: external declaration of internal SILFunction not allowed: F->isAvailableExternally() In function: // @nonobjc tan(_:) sil shared [serializable] [readnone] @$sSo3tanyS2dFTO : $@convention(thin) (Double) -> Double Stack dump: 0. Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2019-12-22-a.xctoolchain/usr/bin/swift -frontend -interpret tan.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -Xllvm -enable-experimental-cross-file-derivative-registration -module-name tan 1. Swift version 5.2-dev (Swift a34e25915a) 2. While verifying SIL function "@$sSo3tanyS2dFTO". for 'tan(_:)' (in module 'Darwin') 0 swift 0x00000001047f6a05 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37 1 swift 0x00000001047f5c15 llvm::sys::RunSignalHandlers() + 85 2 swift 0x00000001047f6ff6 SignalHandler(int) + 278 3 libsystem_platform.dylib 0x00007fff728e4b5d _sigtramp + 29 4 libsystem_platform.dylib 0x000000010dec3b76 _sigtramp + 2606624822 5 libsystem_c.dylib 0x00007fff7279e6a6 abort + 127 6 swift 0x00000001013b5968 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 616 7 swift 0x00000001013af4d8 swift::SILFunction::verify(bool) const + 440
The crash occurs because tan should be a foreign declaration from Clang:
tan
import Darwin func foo(_ x: Double) -> Double { tan(x) }
// foo(_:) sil hidden [ossa] @$s3tan3fooyS2dF : $@convention(thin) (Double) -> Double { // %0 // users: %3, %1 bb0(%0 : $Double): debug_value %0 : $Double, let, name "x", argno 1 // id: %1 // function_ref tan %2 = function_ref @tan : $@convention(c) (Double) -> Double // user: %3 %3 = apply %2(%0) : $@convention(c) (Double) -> Double // user: %4 return %3 : $Double // id: %4 } // end sil function '$s3tan3fooyS2dF' // tan sil [serializable] [readnone] [clang tan] @tan : $@convention(c) (Double) -> Double
But @derivative attribute SILGen emits the wrong SIL function declaration for tan.
This blocks replacing @differentiable(jvp:vjp🙂 with @derivative attribute for tgmath.swift.gyb functions in the stdlib: TF-1085.
@differentiable(jvp:vjp🙂
The text was updated successfully, but these errors were encountered:
Fixed in #29016
Sorry, something went wrong.
dan-zheng
No branches or pull requests
Additional Detail from JIRA
md5: 93134401dc62b1c6e50125144cd17b8c
Parent-Task:
blocks:
@derivative
in stdlib instead of@differentiable(jvp:vjp:)
Issue Description:
@derivative
attribute SILGen crashes for foreign original declarations (e.g. from Clang).The crash occurs because
tan
should be a foreign declaration from Clang:But
@derivative
attribute SILGen emits the wrong SIL function declaration fortan
.This blocks replacing
@differentiable(jvp:vjp🙂
with@derivative
attribute for tgmath.swift.gyb functions in the stdlib: TF-1085.The text was updated successfully, but these errors were encountered: