Commit 2d36dde
authored
[SYCL] Stop emission of modf intrinsic for NVPTX/AMDGCN (#17958)
A recent change in #126750 changed the lowering of the modf builtin(s)
to lower to the llvm.modf intrinsic. Certain SYCL targets such as NVPTX
and AMDGCN cannot currently handle this intrinsic in the backend because
they don't have the necessary target library info. Even if they did, the
SYCL device libraries are linked in earlier at the IR level so we'd be
left with an unresolved symbol.
We have been working around this at clang codegen time by avoiding the
emission of intrinsics altogether by (ab)using a guard on math
intrinsics.
The problem with us hooking into GenerateIntrinsics like this is that
SYCL is wanting to use it as a guarantee that (a certain subset of)
intrinsics won't be emitted if GenerateIntrinsics is false, whereas
upstream does not make this guarantee: it's an opt-in toggle for a more
optimal lowering strategy. Thus we're always going to be liable to this
sort of upstream change.
This doesn't feel like the right mechanism for SYCL to handle these
builtins (or intrinsics) long term, but this fix restores the previous
behaviour without making things much worse.
Fixes the AMDGCN/NVPTX aspects of #178131 parent a2d44f7 commit 2d36dde
File tree
5 files changed
+9
-8
lines changed- clang/lib/CodeGen
- sycl/test-e2e/DeviceLib
5 files changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3154 | 3154 | | |
3155 | 3155 | | |
3156 | 3156 | | |
3157 | | - | |
3158 | | - | |
3159 | | - | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
3160 | 3161 | | |
3161 | 3162 | | |
3162 | 3163 | | |
| |||
4256 | 4257 | | |
4257 | 4258 | | |
4258 | 4259 | | |
4259 | | - | |
| 4260 | + | |
4260 | 4261 | | |
4261 | 4262 | | |
4262 | 4263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments