[clang] [HIP][SPIRV] Enable the SPIRV backend instead of the translator through an experimental flag. (PR #162282)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 10 08:19:19 PDT 2025
================
@@ -175,15 +175,33 @@ void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
constructLlvmLinkCommand(C, JA, Inputs, LinkedBCFile, Args);
- // Emit SPIR-V binary.
- llvm::opt::ArgStringList TrArgs{
- "--spirv-max-version=1.6",
- "--spirv-ext=+all",
- "--spirv-allow-unknown-intrinsics",
- "--spirv-lower-const-expr",
- "--spirv-preserve-auxdata",
- "--spirv-debug-info-version=nonsemantic-shader-200"};
- SPIRV::constructTranslateCommand(C, *this, JA, Output, LinkedBCFile, TrArgs);
+ bool UseSPIRVBackend = Args.hasFlag(
+ options::OPT_use_experimental_spirv_backend,
+ options::OPT_no_use_experimental_spirv_backend, /*Default=*/false);
+
+ // Emit SPIR-V binary either using the SPIRV backend or the translator.
+ if (UseSPIRVBackend) {
+ llvm::opt::ArgStringList CmdArgs;
+ const char *Triple =
+ C.getArgs().MakeArgString("-triple=spirv64-amd-amdhsa");
+ CmdArgs.append({"-cc1", Triple, "-emit-obj", LinkedBCFile.getFilename(),
----------------
arsenm wrote:
This also seems to be reinventing driver infrastructure it shouldn't need to? There should be some function to call for this. In particular I'm worried about the hardcoded -emit-obj here, probably breaks -save-temps?
https://github.com/llvm/llvm-project/pull/162282
More information about the cfe-commits
mailing list