[clang] Add spirv-val compilation step when targeting SPIR-V (PR #188150)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 27 08:52:09 PDT 2026
================
@@ -315,6 +315,23 @@ void tools::hlsl::Validator::ConstructJob(Compilation &C, const JobAction &JA,
Exec, CmdArgs, Inputs, Input));
}
+void tools::hlsl::SPIRV_Validator::ConstructJob(
+ Compilation &C, const JobAction &JA, const InputInfo &Output,
+ const InputInfoList &Inputs, const ArgList &Args,
+ const char *LinkingOutput) const {
+ std::string SPIRVValPath = getToolChain().GetProgramPath("spirv-val");
+ assert(SPIRVValPath != "spirv-val" && "cannot find spirv-val");
+
+ ArgStringList CmdArgs;
+ assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
+ const InputInfo &Input = Inputs[0];
+ CmdArgs.push_back(Input.getFilename());
----------------
s-perron wrote:
You will need more arguments than this.
1. You will need to [target environment](https://github.com/KhronosGroup/SPIRV-Tools/blob/4743e69a64255650ac902d87dc51022b6604c607/tools/val/val.cpp#L80). You will have to look at the triple to get which version of spir-v you are targeting, and generate the correct command line argument.
2. We will want to use the [scalar block layout](https://github.com/KhronosGroup/SPIRV-Tools/blob/4743e69a64255650ac902d87dc51022b6604c607/tools/val/val.cpp#L61) as well. This is needed to be able to correctly represent the default HLSL memory layout.
These are the only options we set in DXC that are relevant at this time.
https://github.com/llvm/llvm-project/pull/188150
More information about the cfe-commits
mailing list