[clang] [llvm] [HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (PR #82536)
Natalie Chouinard via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 4 10:10:33 PST 2024
================
@@ -342,8 +343,19 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
return B.CreateCall(FunctionCallee(DxGroupIndex));
}
if (D.hasAttr<HLSLSV_DispatchThreadIDAttr>()) {
- llvm::Function *DxThreadID = CGM.getIntrinsic(Intrinsic::dx_thread_id);
- return buildVectorInput(B, DxThreadID, Ty);
+ llvm::Function *ThreadIDIntrinsic;
+ switch (CGM.getTarget().getTriple().getArch()) {
+ case llvm::Triple::dxil:
+ ThreadIDIntrinsic = CGM.getIntrinsic(Intrinsic::dx_thread_id);
+ break;
+ case llvm::Triple::spirv:
+ ThreadIDIntrinsic = CGM.getIntrinsic(Intrinsic::spv_thread_id);
+ break;
+ default:
+ llvm_unreachable("Input semantic not supported by target");
+ break;
+ }
+ return buildVectorInput(B, ThreadIDIntrinsic, Ty);
----------------
sudonatalie wrote:
See https://github.com/llvm/llvm-project/issues/83882
https://github.com/llvm/llvm-project/pull/82536
More information about the llvm-commits
mailing list