-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add mangling support for @differentiable
function types.
#26595
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
Conversation
Add mangling support for `@differentiable` and `@differentiable(linear)` function types. This fixes debug info builds. Previously, IRGenDebugInfo crashed because `@differentiable` function types did not have full mangling support. `IRGenDebugInfoImpl::getOrCreateType` computes `llvm::DIType` type debug info by demangling type names, leading to a type size inconsistency for `@differentiable` function types. Change `tensorflow_osx_base` build preset to use `--release-debuginfo`. macOS toolchains (with TensorFlow) now have debug info again. Resolves TF-597.
Thank you @compnerd for spending hours to debug this together - it was a blast 🙂 |
Thank you @compnerd and @dan-zheng ! |
@swift-ci Please test tensorflow |
That's great! Thanks @dan-zheng and @compnerd ! Is it possible that this allows us to now build the |
@@ -184,3 +184,11 @@ func varargsVsArray(arr: [Int], n: String) { } | |||
|
|||
// CHECK-LABEL: sil hidden [ossa] @$s8mangling14varargsVsArray3arr1nySaySiGd_SStF : $@convention(thin) (@guaranteed Array<Array<Int>>, @guaranteed String) -> () | |||
func varargsVsArray(arr: [Int]..., n: String) { } | |||
|
|||
// SWIFT_ENABLE_TENSORFLOW | |||
// CHECK-LABEL: sil hidden [ossa] @$s8mangling15funcVsDiffFunc12fnyS2fXE_tF : $@convention(thin) (@noescape @callee_guaranteed (Float) -> Float) -> () |
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.
Note: these newly added tests actually test @differentiable
function mangling logic added in #25804.
That logic is different from the mangling logic added in this patch (mangling modifiers for ImplFunctionType
). I'm not sure what's the meaning of ImplFunctionType
and why it exists separately from SILFunctionType
mangling: why is there ImplEscaping
(for ImplFunctionType
) in addition to EscapingObjCBlock
/EscapingAutoClosureType
(for regular SILFunctionType
)?
cc @slavapestov, wonder if you can clarify
I'm not sure - could you please share the errors from building |
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.
Nice work @dan-zheng !!
@dan-zheng I'll test after this PR is merged because lots of changes have happened since last time I attempted enabling optimizations. |
- Add todo comments tracking TF-750. - Optimize `SWIFT_ENABLE_TENSORFLOW` comments. - Clarify comment in test/AutoDiff/differentiable_func_debuginfo.swift. Addresses feedback from swiftlang#26595.
Add mangling support for
@differentiable
and@differentiable(linear)
function types.
This fixes debug info builds. Previously, IRGenDebugInfo crashed because
@differentiable
function types did not have full mangling support.IRGenDebugInfoImpl::getOrCreateType
computesllvm::DIType
type debuginfo by demangling type names, leading to a type size inconsistency for
@differentiable
function types.Change
tensorflow_osx_base
build preset to use--release-debuginfo
.macOS toolchains (with TensorFlow) now have debug info again.
Resolves TF-597.