[clang] [llvm] [clang][HLSL] Add WaveIsFirstLane() intrinsic (PR #103299)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 05:00:41 PDT 2024


================
@@ -18660,6 +18660,10 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
         llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
         {}, false, true));
   }
+  case Builtin::BI__builtin_hlsl_wave_is_first_lane: {
+    Intrinsic::ID ID = CGM.getHLSLRuntime().getWaveIsFirstLaneIntrinsic();
+    return EmitRuntimeCall(Intrinsic::getDeclaration(&CGM.getModule(), ID));
----------------
Keenuts wrote:

The reason is convergence intrinsics: The EmitRuntimeCall checks for convergence intrinsics and generates them, while CreateIntrinsic doesn't.
We could add the code required for this in CreateIntrinsic, but it would require moving some existing logic in codegen into the IRBuilder (things around convergence intrinsic gen).
So I preferred to add some inconsistencies here (and use EmitRuntimeCall) but avoid  larger code changes.

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


More information about the llvm-commits mailing list