[clang] [Clang] Add standalone AMDGPU SPIR-V toolchain (PR #144576)

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 17 11:07:44 PDT 2025


================
@@ -417,3 +417,17 @@ void HIPAMDToolChain::checkTargetID(
     getDriver().Diag(clang::diag::err_drv_bad_target_id)
         << *PTID.OptionalTargetID;
 }
+
+SPIRVAMDToolChain::SPIRVAMDToolChain(const Driver &D,
+                                     const llvm::Triple &Triple,
+                                     const ArgList &Args)
+    : ROCMToolChain(D, Triple, Args) {
+  // Lookup binaries into the driver directory, this is used to
+  // discover the clang-offload-bundler executable.
+  getProgramPaths().push_back(getDriver().Dir);
+}
+
+Tool *SPIRVAMDToolChain::buildLinker() const {
+  assert(getTriple().getArch() == llvm::Triple::spirv64);
----------------
sarnex wrote:

It looks like we use `SPIRVAMDToolChain` for `spirv32` or `spirv64` but we assert it's `spirv64` here. Can `spirv32` never hit this? 

Should we add a `spirv32` test case?

https://github.com/llvm/llvm-project/pull/144576


More information about the cfe-commits mailing list