From 9d824bd123ca79aa3ed89977ceaac844ee94430f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 6 May 2024 22:19:09 -0400 Subject: [PATCH] nir: add quad_ballot_agx intrinsic to lower quad votes in nir. Signed-off-by: Alyssa Rosenzweig Acked-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir_intrinsics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 2237208a918..afedab3e979 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -1803,6 +1803,9 @@ intrinsic("load_fep_w_v3d", dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER]) # Equivalent to popcount(ballot(true) & ((1 << subgroup_invocation) - 1)) system_value("active_subgroup_invocation_agx", 1) +# Like ballot() but only within a quad. +intrinsic("quad_ballot_agx", src_comp=[1], dest_comp=1, flags=[CAN_ELIMINATE]) + # With [0, 1] clipping, no transform is needed on the output z' = z. But with [-1, # 1] clipping, we need to transform z' = (z + w) / 2. We express both cases as a # lerp between z and w, where this is the lerp coefficient: 0 for [0, 1] and 0.5