Skip to content

Commit 993f7c3

Browse files
committed
[Autodiff] Fixes breaking VJP and pullback inlining tests on Linux
The inlining benefit for VJPs and pullbacks seems to be a bit different on macos and linux. This difference seems to be arising due to certain function calls such as, `sin`, `cos` etc. always being inlined on macos but not on linux. Until I figure out a better way, I'm modifying these tests to avoid matching the exact value of the inlining benefit, which causes them to fail on Linux.
1 parent c288d95 commit 993f7c3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/AutoDiff/SILOptimizer/pullback_inlining.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func with_control_flow(_ x: Float) -> Float {
3131
func caller_of_with_control_flow(x: Float) -> Float {
3232
gradient(at: x, of: with_control_flow)
3333
}
34-
// CHECK-LABEL: decision {{{.*}}, b=70, {{.*}}} $s17pullback_inlining17with_control_flowyS2fFTJpSpSr
34+
// CHECK-LABEL: decision {{.*}} $s17pullback_inlining17with_control_flowyS2fFTJpSpSr
3535
// CHECK-NEXT: "pullback of pullback_inlining.with_control_flow(_:)" inlined into "caller_of_with_control_flow"
3636

3737
// ====================================================================== //
@@ -84,5 +84,5 @@ func caller_of_more_complex_pb_with_control_flow() -> Float {
8484
gradient(at: Float(1), of: more_complex_pb_with_control_flow)
8585
}
8686

87-
// CHECK: decision {{{.*}}, b=70, {{.*}}} $s17pullback_inlining33more_complex_pb_with_control_flow1xS2f_tFTJpSpSr
87+
// CHECK: decision {{.*}} $s17pullback_inlining33more_complex_pb_with_control_flow1xS2f_tFTJpSpSr
8888
// CHECK-NEXT: "pullback of pullback_inlining.more_complex_pb_with_control_flow(x:)" inlined into "caller_of_more_complex_pb_with_control_flow"

test/AutoDiff/SILOptimizer/vjp_inlining.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func with_control_flow(_ x: Float) -> Float {
3030
func caller_of_with_control_flow(x: Float) -> Float {
3131
gradient(at: x, of: with_control_flow)
3232
}
33-
// CHECK-LABEL: decision {{{.*}}, b=30, {{.*}}} $s12vjp_inlining17with_control_flowyS2fFTJrSpSr
33+
// CHECK-LABEL: decision {{.*}} $s12vjp_inlining17with_control_flowyS2fFTJrSpSr
3434
// CHECK-NEXT: "reverse-mode derivative of vjp_inlining.with_control_flow(_:)" inlined into "caller_of_with_control_flow"
3535

3636
// =============================================================== //
@@ -41,7 +41,7 @@ func caller_of_with_control_flow(x: Float) -> Float {
4141
func wrapperOnWithControlFlow(x: Float) -> Float {
4242
return with_control_flow(x)
4343
}
44-
// CHECK-LABEL: decision {{{.*}}, b=40, {{.*}}} $s12vjp_inlining17with_control_flowyS2fFTJrSpSr
44+
// CHECK-LABEL: decision {{.*}} $s12vjp_inlining17with_control_flowyS2fFTJrSpSr
4545
// CHECK-NEXT: "reverse-mode derivative of vjp_inlining.with_control_flow(_:)" inlined into "reverse-mode derivative of vjp_inlining.wrapperOnWithControlFlow(x:)"
4646

4747
// =============================================================== //
@@ -85,5 +85,5 @@ func wrapperWithControlFlowOnSimple(x: Float) -> Float {
8585
func wrapperOnSimple(x: Float) -> Float {
8686
return simple(x: x)
8787
}
88-
// CHECK-LABEL: decision {{{.*}}, b=40, {{.*}}} $s12vjp_inlining6simple1xS2f_tFTJrSpSr
88+
// CHECK-LABEL: decision {{.*}} $s12vjp_inlining6simple1xS2f_tFTJrSpSr
8989
// CHECK-NEXT: "reverse-mode derivative of vjp_inlining.simple(x:)" inlined into "reverse-mode derivative of vjp_inlining.wrapperOnSimple(x:)"

0 commit comments

Comments
 (0)