-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[HLSL][clang] Move hlsl_wave_get_lane_index to EmitHLSLBuiltinExpr #87131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-hlsl @llvm/pr-subscribers-clang-codegen Author: Marc Auberer (marcauberer) ChangesResolves #87109 Full diff: https://github.com/llvm/llvm-project/pull/87131.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 287e763bad82dd..96ae16ba94c349 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5892,16 +5892,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Name),
{NDRange, Kernel, Block}));
}
-
- case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
- auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
- llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
- {}, false, true));
- if (getTarget().getTriple().isSPIRVLogical())
- CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
- return RValue::get(CI);
- }
-
case Builtin::BI__builtin_store_half:
case Builtin::BI__builtin_store_halff: {
Value *Val = EmitScalarExpr(E->getArg(0));
@@ -18317,6 +18307,14 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
/*ReturnType=*/Op0->getType(), Intrinsic::dx_rsqrt,
ArrayRef<Value *>{Op0}, nullptr, "dx.rsqrt");
}
+ case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
+ auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
+ llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
+ {}, false, true));
+ if (getTarget().getTriple().isSPIRVLogical())
+ CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
+ return RValue::get(CI);
+ }
}
return nullptr;
}
|
@llvm/pr-subscribers-clang Author: Marc Auberer (marcauberer) ChangesResolves #87109 Full diff: https://github.com/llvm/llvm-project/pull/87131.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 287e763bad82dd..96ae16ba94c349 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5892,16 +5892,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Name),
{NDRange, Kernel, Block}));
}
-
- case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
- auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
- llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
- {}, false, true));
- if (getTarget().getTriple().isSPIRVLogical())
- CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
- return RValue::get(CI);
- }
-
case Builtin::BI__builtin_store_half:
case Builtin::BI__builtin_store_halff: {
Value *Val = EmitScalarExpr(E->getArg(0));
@@ -18317,6 +18307,14 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
/*ReturnType=*/Op0->getType(), Intrinsic::dx_rsqrt,
ArrayRef<Value *>{Op0}, nullptr, "dx.rsqrt");
}
+ case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
+ auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
+ llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
+ {}, false, true));
+ if (getTarget().getTriple().isSPIRVLogical())
+ CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
+ return RValue::get(CI);
+ }
}
return nullptr;
}
|
68d1215
to
283fe4e
Compare
283fe4e
to
b275a7b
Compare
Hi @marcauberer The change looks good. I'm 99% sure this won't have an effect on the SPIRV backend, however there is still that 1% chance it does. The tests I want to check landed in this PR For convenience this is what you can pass to
Since you aren't changing anything in the SPIRV backend the github action didn't trigger. So if you could do one of two things after I approve, I would appreciate it, Option 1: build spirv backend and test the above test cases
Option 2: watch or trigger the SPIR_V Test github actions |
minor nit pick, you don't have to do this one: In the title could you make the HLSL prefix first. It helps with some bookeeping we are doing. |
@farzonl All three tests pass 👍🏽 $ ./bin/llvm-lit ../llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveGetLaneIndex.ll ../llvm/test/CodeGen/SPIRV/scfg-add-pre-headers.ll ../llvm/test/CodeGen/SPIRV/transcoding/spirv-private-array-initialization.ll
-- Testing: 3 tests, 3 workers --
PASS: LLVM :: CodeGen/SPIRV/scfg-add-pre-headers.ll (1 of 3)
PASS: LLVM :: CodeGen/SPIRV/transcoding/spirv-private-array-initialization.ll (2 of 3)
PASS: LLVM :: CodeGen/SPIRV/hlsl-intrinsics/WaveGetLaneIndex.ll (3 of 3)
Testing Time: 0.04s
Total Discovered Tests: 3
Passed: 3 (100.00%) |
Workflow run also succeeded: https://github.com/llvm/llvm-project/actions/runs/8493247308 |
Hi! Thanks @farzonl and @marcauberer for making sure SPIR-V backend didn't break, really appreciate it! 😊 |
Resolves #87109