-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathdifferentiable_sil_attr.sil
28 lines (22 loc) · 1.26 KB
/
differentiable_sil_attr.sil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %target-sil-opt %s | %FileCheck %s
sil_stage raw
import Builtin
import Swift
// CHECK-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @bar_vjp] @bar
sil [differentiable source 0 wrt 0, 1 vjp @bar_vjp] @bar : $@convention(thin) (Float, Float) -> Float {
entry(%0: $Float, %1: $Float):
return undef: $Float
}
sil @bar_vjp : $@convention(thin) (Float, Float) -> (Float, (Float) -> (Float, Float)) {
entry(%0: $Float, %1: $Float):
return undef: $(Float, (Float) -> (Float, Float))
}
// CHECK-LABEL: sil [differentiable source 0 wrt 0, 1 vjp @foo_vjp where T : Differentiable, U : Differentiable, V : Differentiable] @foo
sil [differentiable source 0 wrt 0, 1 vjp @foo_vjp where T : Differentiable, U : Differentiable, V : Differentiable] @foo : $@convention(thin) <T, U, V> (@in_guaranteed T, @in_guaranteed U, @in_guaranteed V) -> @out V {
entry(%0 : $*V, %1 : $*T, %2 : $*U, %3 : $*V):
return undef: $()
}
sil @foo_vjp : $@convention(thin) <T, U, V where T : Differentiable, U : Differentiable, V : Differentiable> (@in_guaranteed T, @in_guaranteed U, @in_guaranteed V) -> (@out V, @owned @callee_guaranteed (@in_guaranteed V) -> (@out T, @out U)) {
bb0(%0 : $*V, %1 : $*T, %2 : $*U, %3 : $*V):
return undef: $@callee_guaranteed (@in_guaranteed V) -> (@out T, @out U)
}