[clang] [llvm] [HLSL] Implement ddx/ddy_coarse intrinsics (PR #164831)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 14 06:32:29 PST 2025


================
@@ -3099,6 +3101,66 @@ bool SPIRVInstructionSelector::wrapIntoSpecConstantOp(
   return Result;
 }
 
+bool SPIRVInstructionSelector::selectDpdCoarse(Register ResVReg,
+                                               const SPIRVType *ResType,
+                                               MachineInstr &I,
+                                               const unsigned DPdOpCode) const {
+  if (!STI.isShader()) {
+    std::string DiagMsg;
+    raw_string_ostream OS(DiagMsg);
+    I.print(OS, true, false, false, false);
+    DiagMsg += " is only supported in shaders.\n";
+    report_fatal_error(DiagMsg.c_str(), false);
+  }
----------------
Keenuts wrote:

+1 for a helper, also, I'd be fine with a simple hard-coded message like "Derivative instructions require the Fragment execution model." (which implies Shader env)

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


More information about the llvm-commits mailing list