[clang] [llvm] [clang][HLSL][SPRI-V] Add convergence intrinsics (PR #80680)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 07:04:37 PDT 2024


Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/80680 at github.com>


================
@@ -1295,11 +1295,13 @@ double4 trunc(double4);
 /// true, across all active lanes in the current wave.
 _HLSL_AVAILABILITY(shadermodel, 6.0)
 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits)
+__attribute__((convergent))
----------------
llvm-beanz wrote:

> Convergence requires all transitive callers to also be convergent. No real code is going to do this. The existence of convergence operations means you have a convergent language and must optimize to known-not-convergent

In languages like OpenCL and HLSL, this requirement is actually fine and we don't need it explicitly annotated. OpenCL and HLSL are effectively single-source kernel languages and all code gets inlined. So we can do robust attribute propagation.

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


More information about the cfe-commits mailing list