gallivm: Use first_active_invocation for ubo/kernel memory loads.
authorEmma Anholt <emma@anholt.net>
Tue, 28 Feb 2023 20:13:39 +0000 (12:13 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 2 Mar 2023 04:47:35 +0000 (04:47 +0000)
commita2b054c8f0a712c1377580c038d1c68995eca028
tree59c6ee57010b8f060db67ca6bf404c0082ff1cf3
parent1be626b618b2fc632d4692ee6c9e725e37a277ab
gallivm: Use first_active_invocation for ubo/kernel memory loads.

If we're just loading memory, we can take the scalar offset_is_uniform
paths even the first active invocation is nonzero, saving a bunch of
looping and bounds checking for per-element loads.  And, if we don't have
an active invocation, doing the load for element 0 (which is
bounds-checked to return 0 if element 0 had a bad value in it) before
throwing away the result is still better than doing bounds-checked loads
for each element before throwing away the result.

dEQP-VK.ubo.random.16bit.scalar.92 goes from 16.5 to 14.0 seconds.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21142>
src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c