You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There is a compiler crasher preventing the default synthesis of callAsFunction in the Layer protocol.
Steps To Reproduce
I don't have the bandwidth to narrow down this compiler crasher, but here's the gist. In tensorflow/swift-apis#1184, the annotation functionality of S4TF was deactivated due to a compiler bug that was never narrowed down. Every layer having a forward function had it renamed to callAsFunction, preventing model annotations from happening.
I tried enabling model annotations, and got multiple disparate compiler crashers. One had the exact same error output as SR-13455 and affected the same section of S4TF code, but I don't know whether it has the same cause. Another was flaky, sometimes requiring that I clean the build folder before it appears again. This flaky crash is what I'm reporting here.
Relevant source code (Sources/TensorFlow/Layer.swift, circa line 166):
publicprotocolLayer:Modulewhere Input:Differentiable{
/// Returns the output obtained from applying the layer to the given input.
///
/// - Parameter input: The input to the layer.
/// - Returns: The output.
@differentiable(reverse)func callAsFunction(_ input:Input)->Output@differentiable(reverse)func forward(_ input:Input)->Output}extensionLayer{
// Workaround for SR-13455: autodiff undefined symbol linker error.
@differentiable(reverse, wrt:self)@differentiable(reverse)publicfunc forward(_ input:Input)->Output{returncallAsFunction(input)}}
// Workaround for compiler crasher.
//extension Layer where Input: DifferentiableTensorProtocol, Output: DifferentiableTensorProtocol {
// @differentiable(reverse)
// public func callAsFunction(_ input: Input) -> Output {
// let activation = forward(input)
// return annotated(activation)
// }
//}
Relevant source code (Sources/TensorFlow/Layers/Dense.swift, circa line 72):
The code above is modified so that the crash does not happen. The modifications are highlighted by the comment "Workaround for compiler crasher". Below is the crash that has been suppressed.
Environment (please fill out the following information)
OS: macOS 12.4
Xcode Version/Tag/Branch: 2022-06-26 v5.7 Development Snapshot, Xcode 14 beta 2 Swift 5.7 Release Toolchain
Additional context
Neither of my toolchains have recent cross-file derivative registration fixes in yet because of #59467. The crasher could have disappeared since the patch.
The text was updated successfully, but these errors were encountered:
philipturner
added
the
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
label
Jul 7, 2022
Describe the bug
There is a compiler crasher preventing the default synthesis of
callAsFunction
in theLayer
protocol.Steps To Reproduce
I don't have the bandwidth to narrow down this compiler crasher, but here's the gist. In tensorflow/swift-apis#1184, the annotation functionality of S4TF was deactivated due to a compiler bug that was never narrowed down. Every layer having a
forward
function had it renamed tocallAsFunction
, preventing model annotations from happening.I tried enabling model annotations, and got multiple disparate compiler crashers. One had the exact same error output as SR-13455 and affected the same section of S4TF code, but I don't know whether it has the same cause. Another was flaky, sometimes requiring that I clean the build folder before it appears again. This flaky crash is what I'm reporting here.
Relevant source code (Sources/TensorFlow/Layer.swift, circa line 166):
Relevant source code (Sources/TensorFlow/Layers/Dense.swift, circa line 72):
Screenshots
The code above is modified so that the crash does not happen. The modifications are highlighted by the comment "Workaround for compiler crasher". Below is the crash that has been suppressed.
Crash
Environment (please fill out the following information)
Additional context
Neither of my toolchains have recent cross-file derivative registration fixes in yet because of #59467. The crasher could have disappeared since the patch.
The text was updated successfully, but these errors were encountered: