gallivm: Return 0 first_active_invocation when we know that up front.

46 -> 30 seconds on
dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_i16vec4 by
not spamming LLVM with so many loops.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21001>
This commit is contained in:
Emma Anholt 2023-01-30 13:42:48 -08:00
parent dc7c518abe
commit c11fa55f6d

View file

@ -100,6 +100,9 @@ static LLVMValueRef first_active_invocation(struct lp_build_nir_context *bld_bas
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
if (invocation_0_must_be_active(bld_base))
return lp_build_const_int32(gallivm, 0);
/* have to find the first active (nonzero) invocation in the exec_mask
* vector, but there's no nice LLVM intrinsic to do so. Loop down from the
* last invocation to the first, storing the loop counter to a scalar temp