mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add README files explaining the differentiable programming test suite. Add lit.local.cfg files so individual tests do not need to add `REQUIRES: asserts` in these directories: - test/AutoDiff/compiler_crashers - test/AutoDiff/compiler_crashers_fixed Motivation: it is important for compiler crasher tests to require assertions enabled, because many of these tests crash on compiler assertions.
27 lines
734 B
Swift
27 lines
734 B
Swift
// RUN: %target-swift-frontend -emit-sil %s
|
|
|
|
// TF-1315: Pullback subset thunk generation crash due to unmapped parameter
|
|
// index for `inout` differentiability parameters.
|
|
|
|
import _Differentiation
|
|
|
|
func foo(_ x: Int, _ y: Float, _ z: inout Float) {}
|
|
|
|
@derivative(of: foo, wrt: (y, z))
|
|
func vjpFoo(_ x: Int, _ y: Float, _ z: inout Float) -> (
|
|
value: Void, pullback: (inout Float) -> Float
|
|
) {
|
|
fatalError()
|
|
}
|
|
|
|
@differentiable
|
|
func TF_1315(_ x: Float) -> Float {
|
|
var x = x
|
|
// The call to `foo` below triggers pullback subset parameter thunk generation.
|
|
// `foo` original function type: `(Int, Float, inout Float) -> ()`
|
|
// Actual parameter indices: 1, 2
|
|
// Desired parameter indices: 2
|
|
foo(1, 2, &x)
|
|
return x
|
|
}
|