[clang] [llvm] [HLSL] Handle WaveActiveBallot struct return type appropriately (PR #175105)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 9 14:00:08 PST 2026


================
@@ -3507,6 +3507,11 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_wave_active_ballot: {
+    if (SemaRef.checkArgCount(TheCall, 1))
+      return true;
+    break;
+  }
----------------
farzonl wrote:

Can you explain a bit more why you are making the clang builtin less type aware  and only checking arg count? Why can't we do `_ExtVector<4, unsigned int>`? Keep in mind the SPIRV intrinsic is  defined like so `def int_spv_wave_ballot : ClangBuiltin<"__builtin_spirv_subgroup_ballot">,` 

The gpu offload folks used the old return type and made a spirv specific builtin `__builtin_spirv_subgroup_ballot` that also returns vector of size 4.

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


More information about the cfe-commits mailing list