Module: Mesa
Branch: main
Commit: bb122202b6dabc8e0e14683ca9df6813761bc2c2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb122202b6dabc8e0e14683ca9df6813761bc2c2

Author: Emma Anholt <[email protected]>
Date:   Tue Feb 28 12:35:40 2023 -0800

gallivm: Add some notes about other invocation_0_must_be_active usages.

So that the next person trying to cut down LLVM compile times doesn't trip
over this.

Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21142>

---

 src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index a80675fa4f0..b13a5258e6d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -930,6 +930,9 @@ static void emit_load_global(struct lp_build_nir_context 
*bld_base,
 
    res_bld = get_int_bld(bld_base, true, bit_size);
 
+   /* Note, we don't use first_active_invocation here, since we aren't
+    * guaranteed that there is actually an active invocation.
+    */
    if (offset_is_uniform && invocation_0_must_be_active(bld_base)) {
       /* If the offset is uniform, then use the address from invocation 0 to
        * load, and broadcast to all invocations.
@@ -1418,7 +1421,9 @@ static void emit_store_mem(struct lp_build_nir_context 
*bld_base,
    offset = lp_build_shr_imm(uint_bld, offset, shift_val);
 
    /* If the address is uniform, then just store the value from the first
-    * channel instead of making LLVM unroll the invocation loop.
+    * channel instead of making LLVM unroll the invocation loop.  Note that we
+    * don't use first_active_uniform(), since we aren't guaranteed that there 
is
+    * actually an active invocation.
     */
    if (index_and_offset_are_uniform && invocation_0_must_be_active(bld_base)) {
       LLVMValueRef ssbo_limit;

Reply via email to