Mesa (main): ir3,turnip: Enable subgroup ops support in all stages on gen4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 21:17:58 UTC 2021


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

Author: Danylo Piliaiev <dpiliaiev at igalia.com>
Date:   Tue Nov 16 14:53:32 2021 +0200

ir3,turnip: Enable subgroup ops support in all stages on gen4

Signed-off-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13817>

---

 src/freedreno/ir3/ir3_nir.c      | 27 +++++++++++++++------------
 src/freedreno/vulkan/tu_device.c |  4 ++++
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 25eea123683..68ee063179b 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -527,21 +527,24 @@ ir3_nir_post_finalize(struct ir3_compiler *compiler, nir_shader *s)
       NIR_PASS_V(s, nir_lower_mediump_io, nir_var_shader_out, 0, false);
    }
 
+   if ((s->info.stage == MESA_SHADER_COMPUTE) ||
+       (s->info.stage == MESA_SHADER_KERNEL) ||
+       compiler->has_getfiberid) {
+      OPT(s, nir_lower_subgroups,
+          &(nir_lower_subgroups_options){
+             .subgroup_size = 128,
+             .ballot_bit_size = 32,
+             .ballot_components = 4,
+             .lower_to_scalar = true,
+             .lower_vote_eq = true,
+             .lower_subgroup_masks = true,
+             .lower_read_invocation_to_cond = true,
+          });
+   }
+
    if ((s->info.stage == MESA_SHADER_COMPUTE) ||
        (s->info.stage == MESA_SHADER_KERNEL)) {
       bool progress = false;
-      NIR_PASS(progress, s, nir_lower_subgroups,
-               &(nir_lower_subgroups_options){
-                  .subgroup_size = 128,
-                  .ballot_bit_size = 32,
-                  .ballot_components = 4,
-                  .lower_to_scalar = true,
-                  .lower_vote_eq = true,
-                  .lower_subgroup_masks = true,
-                  .lower_read_invocation_to_cond = true,
-               });
-
-      progress = false;
       NIR_PASS(progress, s, ir3_nir_lower_subgroup_id_cs);
 
       /* ir3_nir_lower_subgroup_id_cs creates extra compute intrinsics which
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 6b4201ebfe7..a894dc68ff2 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -807,6 +807,10 @@ tu_get_physical_device_properties_1_1(struct tu_physical_device *pdevice,
    p->subgroupSupportedOperations = VK_SUBGROUP_FEATURE_BASIC_BIT |
                                     VK_SUBGROUP_FEATURE_VOTE_BIT |
                                     VK_SUBGROUP_FEATURE_BALLOT_BIT;
+   if (pdevice->info->a6xx.has_getfiberid) {
+      p->subgroupSupportedStages |= VK_SHADER_STAGE_ALL_GRAPHICS;
+   }
+
    p->subgroupQuadOperationsInAllStages = false;
 
    p->pointClippingBehavior = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES;



More information about the mesa-commit mailing list