Mesa (main): zink: lower subgroup ballot instructions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 27 22:55:46 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Apr  5 12:00:56 2021 -0400

zink: lower subgroup ballot instructions

this handles rewrites of ballot-related instructions/builtins to spirv
vec4 types from the native GLSL U64 type

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11990>

---

 src/gallium/drivers/zink/zink_compiler.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 3b09441de25..0f6603aa844 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -961,6 +961,17 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
    NIR_PASS_V(nir, lower_work_dim);
    NIR_PASS_V(nir, nir_lower_regs_to_ssa);
    NIR_PASS_V(nir, lower_baseinstance);
+
+   {
+      nir_lower_subgroups_options subgroup_options = {0};
+      subgroup_options.lower_to_scalar = true;
+      subgroup_options.subgroup_size = screen->info.props11.subgroupSize;
+      subgroup_options.ballot_bit_size = 32;
+      subgroup_options.ballot_components = 4;
+      subgroup_options.lower_subgroup_masks = true;
+      NIR_PASS_V(nir, nir_lower_subgroups, &subgroup_options);
+   }
+
    optimize_nir(nir);
    NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
    NIR_PASS_V(nir, lower_discard_if);



More information about the mesa-commit mailing list