aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Cuda.cpp
diff options
context:
space:
mode:
authorAlex Voicu <alexandru.voicu@amd.com>2024-06-25 12:19:28 +0100
committerGitHub <noreply@github.com>2024-06-25 12:19:28 +0100
commit9acb533c38be833ec1d8daa06e127a9de8f0a5ef (patch)
treebc9ee9a1d250438beb04b15fc621e8fbc410788c /clang/lib/Basic/Cuda.cpp
parent68efc506f58776fdfcfc60707f8fe52584736d8a (diff)
downloadllvm-9acb533c38be833ec1d8daa06e127a9de8f0a5ef.zip
llvm-9acb533c38be833ec1d8daa06e127a9de8f0a5ef.tar.gz
llvm-9acb533c38be833ec1d8daa06e127a9de8f0a5ef.tar.bz2
[clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (#95061)
This patch augments the HIPAMD driver to allow it to target AMDGCN flavoured SPIR-V compilation. It's mostly straightforward, as we re-use some of the existing SPIRV infra, however there are a few notable additions: - we introduce an `amdgcnspirv` offload arch, rather than relying on using `generic` (this is already fairly overloaded) or simply using `spirv` or `spirv64` (we'll want to use these to denote unflavoured SPIRV, once we bring up that capability) - initially it is won't be possible to mix-in SPIR-V and concrete AMDGPU targets, as it would require some relatively intrusive surgery in the HIPAMD Toolchain and the Driver to deal with two triples (`spirv64-amd-amdhsa` and `amdgcn-amd-amdhsa`, respectively) - in order to retain user provided compiler flags and have them available at JIT time, we rely on embedding the command line via `-fembed-bitcode=marker`, which the bitcode writer had previously not implemented for SPIRV; we only allow it conditionally for AMDGCN flavoured SPIRV, and it is handled correctly by the Translator (it ends up as a string literal) Once the SPIRV BE is no longer experimental we'll switch to using that rather than the translator. There's some additional work that'll come via a separate PR around correctly piping through AMDGCN's implementation of `printf`, for now we merely handle its flags correctly.
Diffstat (limited to 'clang/lib/Basic/Cuda.cpp')
-rw-r--r--clang/lib/Basic/Cuda.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp
index 1d96a92..af99c4d 100644
--- a/clang/lib/Basic/Cuda.cpp
+++ b/clang/lib/Basic/Cuda.cpp
@@ -148,6 +148,7 @@ static const CudaArchToStringMap arch_names[] = {
{CudaArch::GFX12_GENERIC, "gfx12-generic", "compute_amdgcn"},
GFX(1200), // gfx1200
GFX(1201), // gfx1201
+ {CudaArch::AMDGCNSPIRV, "amdgcnspirv", "compute_amdgcn"},
{CudaArch::Generic, "generic", ""},
// clang-format on
};