[clang] [clang][Driver] Support for the SPIR-V backend in the new driver when compiling HIP (PR #167543)
Manuel Carrasco via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 19 08:50:56 PST 2025
================
@@ -5236,6 +5268,22 @@ Action *Driver::ConstructPhaseAction(
: types::TY_LLVM_BC;
return C.MakeAction<BackendJobAction>(Input, Output);
}
+
+ // The SPIRV backend compilation path for HIP must avoid external
+ // dependencies. The default compilation path assembles and links its
+ // output, but the SPIRV assembler and linker are external tools. This code
+ // ensures the backend emits binary SPIRV directly to bypass those steps and
+ // avoid failures. Without -save-temps, the compiler may already skip
+ // assembling and linking. With -save-temps, these steps must be explicitly
+ // disabled, as done here. We also force skipping these steps regardless of
+ // -save-temps to avoid relying on optimizations (unless -S is set).
+ bool IsBinarySPIRVOutput =
+ UseSPIRVBackendForHipDeviceOnlyNoRDC && !Args.hasArg(options::OPT_S);
+ if (IsBinarySPIRVOutput) {
+ // The current HIP bundling expects the type to be types::TY_Image
+ return C.MakeAction<BackendJobAction>(Input, types::TY_Image);
+ }
----------------
mgcarrasco wrote:
Solved, thanks.
https://github.com/llvm/llvm-project/pull/167543
More information about the cfe-commits
mailing list