From c11fa55f6dbe5bea5e6a3548642235e5092cf0ec Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 30 Jan 2023 13:42:48 -0800 Subject: [PATCH] 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 Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index c0f9db03358..83e0887328b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -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