[clang] [llvm] [Driver][clang-linker-wrapper] Add initial support for OpenMP offloading to generic SPIR-V (PR #120145)
Nick Sarnie via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 10:20:41 PST 2024
================
@@ -922,6 +947,8 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
IsAMDOffloadArch(StringToOffloadArch(
getProcessorFromTargetID(*AMDTriple, Arch)))) {
DerivedArchs[AMDTriple->getTriple()].insert(Arch);
+ } else if (SPIRVTriple && Arch == (*SPIRVTriple).str()) {
----------------
sarnex wrote:
Yeah so here this is a case where SPIR-V is an outlier so stuff gets weird. This code gets hit when `-fopenmp` is passed, `-fopenmp-targets` is not passed, and `--offload-arch` is passed and we need to deduce the toolchain based on the offload arch. I implemented it such that you can pass `spirv64-intel` to `--offload-arch` and it will use the SPIR-V OpenMP toolchain. Arch will be `spirv64-intel` so we go inside the `if` and everything works.
Another option is that we could not allow the `spirv64-intel` option to `--offload-arch` to deduce to the SPIR-V OpenMP toolchain in this case, so basically you can't use `--offload-arch` with this toolchain. Maybe that's philosophically better.
Let me know what you think.
https://github.com/llvm/llvm-project/pull/120145
More information about the llvm-commits
mailing list