Commit 4189858
Jakub Chlanda
[SYCL] Match explicit offload arch for AMD and NVIDIA (#7028)
Fixes: #6792
When specifying multiple SYCL targets make sure that we correctly match
offload arch with the target. Normally this is fixed up later on (when
calling `SYCLActionBuilder::withBoundArchForToolChain`), but in case of
creating libraries we might end up in a broken state, as the code relies
on ordering of the gpu map.
See the phases of the following clang invocation:
`clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa
-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx908
-Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_86 -c in.cpp
-o out.o -ccc-print-phases`
```
+- 0: input, "/dash_c_multiple_targets.cpp", c++, (device-sycl, gfx908)
+- 1: preprocessor, {0}, c++-cpp-output, (device-sycl, gfx908)
+- 2: compiler, {1}, ir, (device-sycl, gfx908)
+- 3: offload, "device-sycl (nvptx64-nvidia-cuda:gfx908)" {2}, ir
| +- 4: input, "/dash_c_multiple_targets.cpp", c++, (device-sycl, sm_86)
| +- 5: preprocessor, {4}, c++-cpp-output, (device-sycl, sm_86)
| +- 6: compiler, {5}, ir, (device-sycl, sm_86)
|- 7: offload, "device-sycl (amdgcn-amd-amdhsa:sm_86)" {6}, ir
| +- 8: input, "/dash_c_multiple_targets.cpp", c++, (host-sycl)
| +- 9: append-footer, {8}, c++, (host-sycl)
| +- 10: preprocessor, {9}, c++-cpp-output, (host-sycl)
| +- 11: offload, "host-sycl (x86_64-unknown-linux-gnu)" {10}, "device-sycl (amdgcn-amd-amdhsa:sm_86)" {6}, c++-cpp-output
| +- 12: compiler, {11}, ir, (host-sycl)
| +- 13: backend, {12}, assembler, (host-sycl)
|- 14: assembler, {13}, object, (host-sycl)
15: clang-offload-bundler, {3, 7, 14}, object, (host-sycl)
```
where we end up in mismatched offload arch.1 parent 9533871 commit 4189858
2 files changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5806 | 5806 | | |
5807 | 5807 | | |
5808 | 5808 | | |
5809 | | - | |
| 5809 | + | |
| 5810 | + | |
| 5811 | + | |
| 5812 | + | |
| 5813 | + | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
| 5817 | + | |
5810 | 5818 | | |
5811 | 5819 | | |
5812 | 5820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
0 commit comments