test: update llvm ir expectations for autodiff tests when dlopen#149986
test: update llvm ir expectations for autodiff tests when dlopen#149986sgasho wants to merge 5 commits intorust-lang:mainfrom
Conversation
|
2cefacd to
5e6d5bb
Compare
|
(I don't have much time to wait CI results so I'm re-opening this PR now, during CIs are running) |
|
|
||
| // d_square2 | ||
| // CHECK: define internal [4 x float] @fwddiffe4square(ptr noalias noundef readonly align 4 captures(none) dereferenceable(4) %x, [4 x ptr] %"x'") | ||
| // CHECK: define internal fastcc [4 x float] @fwddiffe4square(float %x.0.val, [4 x ptr] %"x'") |
There was a problem hiding this comment.
the linkage probably matters to autodiff tests but the calling convention and the first argument maybe shouldn't, since this is optimization sensitive and we are just trying to verify that batching works: use regexes to ignore these details instead. like this, or just {{( fastcc)?}} like you do elsewhere
| // CHECK: define internal fastcc [4 x float] @fwddiffe4square(float %x.0.val, [4 x ptr] %"x'") | |
| // CHECK: define internal {{[ a-z_]*}} [4 x float] @fwddiffe4square({{[ a-z0-9()_]*}} %x{{.*}}, [4 x ptr] %"x'") |
| // d_square3, the extra float is the original return value (x * x) | ||
| // CHECK: define internal { float, [4 x float] } @fwddiffe4square.1(ptr noalias noundef readonly align 4 captures(none) dereferenceable(4) %x, [4 x ptr] %"x'") | ||
| // d_square1, the extra float is the original return value (x * x) | ||
| // CHECK: define internal fastcc { float, [4 x float] } @fwddiffe4square.{{[0-9]+}}(float %x.0.val, [4 x ptr] %"x'") |
There was a problem hiding this comment.
same idea as my comment on R26
| // CHECK-NEXT: %15 = insertvalue [4 x float] %12, float %14, 3 | ||
| // CHECK-NEXT: ret [4 x float] %15 |
There was a problem hiding this comment.
This one could use a capture here to avoid being so sensitive to specific values
| // CHECK-NEXT: %15 = insertvalue [4 x float] %12, float %14, 3 | |
| // CHECK-NEXT: ret [4 x float] %15 | |
| // CHECK-NEXT: %[[RETVAR:[0-9]+]] = insertvalue [4 x float] %{{[0-9]+}, float %{{[0-9]+}, 3 | |
| // CHECK-NEXT: ret [4 x float] %[[RETVAR]] |
| // CHECK-NEXT: %4 = fadd fast float %"_2'ipl", %"_2'ipl" | ||
| // CHECK-NEXT: %5 = fmul fast float %4, %x.0.val | ||
| // CHECK-NEXT: %6 = insertvalue [4 x float] undef, float %5, 0 | ||
| // CHECK-NEXT: %7 = fadd fast float %"_2'ipl1", %"_2'ipl1" | ||
| // CHECK-NEXT: %8 = fmul fast float %7, %x.0.val | ||
| // CHECK-NEXT: %9 = insertvalue [4 x float] %6, float %8, 1 | ||
| // CHECK-NEXT: %10 = fadd fast float %"_2'ipl2", %"_2'ipl2" | ||
| // CHECK-NEXT: %11 = fmul fast float %10, %x.0.val | ||
| // CHECK-NEXT: %12 = insertvalue [4 x float] %9, float %11, 2 | ||
| // CHECK-NEXT: %13 = fadd fast float %"_2'ipl3", %"_2'ipl3" | ||
| // CHECK-NEXT: %14 = fmul fast float %13, %x.0.val |
There was a problem hiding this comment.
Unless ZuseZ4 prefers this sort of exact matching, this could use CHECK-DAG so we can capture the operations we're actually concerned about: four insertvalues, and an fadd and fmul apiece, in any order.
| // CHECK-NEXT: %_0 = fmul float %x.0.val, %x.0.val | ||
| // CHECK-NEXT: %4 = fadd fast float %"_2'ipl", %"_2'ipl" | ||
| // CHECK-NEXT: %5 = fmul fast float %4, %x.0.val | ||
| // CHECK-NEXT: %6 = insertvalue [4 x float] undef, float %5, 0 | ||
| // CHECK-NEXT: %7 = fadd fast float %"_2'ipl1", %"_2'ipl1" | ||
| // CHECK-NEXT: %8 = fmul fast float %7, %x.0.val | ||
| // CHECK-NEXT: %9 = insertvalue [4 x float] %6, float %8, 1 | ||
| // CHECK-NEXT: %10 = fadd fast float %"_2'ipl2", %"_2'ipl2" | ||
| // CHECK-NEXT: %11 = fmul fast float %10, %x.0.val | ||
| // CHECK-NEXT: %12 = insertvalue [4 x float] %9, float %11, 2 | ||
| // CHECK-NEXT: %13 = fadd fast float %"_2'ipl3", %"_2'ipl3" | ||
| // CHECK-NEXT: %14 = fmul fast float %13, %x.0.val | ||
| // CHECK-NEXT: %15 = insertvalue [4 x float] %12, float %14, 3 | ||
| // CHECK-NEXT: %16 = insertvalue { float, [4 x float] } undef, float %_0, 0 | ||
| // CHECK-NEXT: %17 = insertvalue { float, [4 x float] } %16, [4 x float] %15, 1 | ||
| // CHECK-NEXT: ret { float, [4 x float] } %17 | ||
| // CHECK-NEXT: } |
There was a problem hiding this comment.
all I would say here is reiterating previous commentary
| // debug-NEXT: define internal { float, float } | ||
| // debug-SAME: (ptr %f, float %x, float %dret) | ||
| // release-NEXT: define internal fastcc float | ||
| // release-NEXT: define internal fastcc{{( noundef)?}} float |
There was a problem hiding this comment.
fwiw autodiff only supports main, no older versions. So I'd not mark it as optional, as I hope that we don't regress. Or, at least I'd like to learn about regressions.
There was a problem hiding this comment.
sure.
| // release-NEXT: define internal fastcc{{( noundef)?}} float | |
| // release-NEXT: define internal fastcc noundef float |
| // debug-NEXT: define internal { float, float } | ||
| // debug-SAME: (ptr align 4 %x, ptr align 4 %bx_0, ptr align 4 %y, ptr align 4 %by_0) | ||
| // release-NEXT: define internal fastcc { float, float } | ||
| // release-NEXT: define internal fastcc |
There was a problem hiding this comment.
what is its return type now?
| // CHECK: define internal{{.*}} @diffe_{{.*}}generic6square | ||
| // CHECK-SAME: double | ||
| // CHECK: f{{add|mul}} {{.*}} double |
There was a problem hiding this comment.
hm. this looks very different, now?
Co-authored-by: Jubilee <workingjubilee@gmail.com>
Co-authored-by: Jubilee <workingjubilee@gmail.com>
Co-authored-by: Jubilee <workingjubilee@gmail.com>
|
☔ The latest upstream changes (presumably #152104) made this pull request unmergeable. Please resolve the merge conflicts. |




related pr: #149271
r? @ZuseZ4