[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 13:02:47 PDT 2024


================
@@ -2015,6 +2015,13 @@ _HLSL_AVAILABILITY(shadermodel, 6.0)
 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_is_first_lane)
 __attribute__((convergent)) bool WaveIsFirstLane();
 
+// \brief Returns the value of the expression for the given lane index within
+// the specified wave.
+template <typename T>
+_HLSL_AVAILABILITY(shadermodel, 6.0)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_read_lane_at)
+    __attribute__((convergent)) T WaveReadLaneAt(T, int32_t);
----------------
llvm-beanz wrote:

Despite the documentation, this doesn't seem to work in DXC for arbitrary types:

https://godbolt.org/z/48brf1bre

@tex3d, gen_intrin_main says this intrinsic is valid on `any<>`, which seems to be any vector or scalar. Is that correct?

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


More information about the cfe-commits mailing list