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

Author: Caio Marcelo de Oliveira Filho <[email protected]>
Date:   Thu Sep 16 17:52:38 2021 -0700

anv: Simplify subgroup_size_type rules for compute shaders

The populate_base_prog_key will set VARYING depending if the pipeline
flag is used.  Later, when full subgroups flag is set, it will flip to
UNIFORM -- which for compute shaders is effectively the same, so don't
bother setting it again.

Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12946>

---

 src/intel/vulkan/anv_pipeline.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 864c9733224..4d1c0ade215 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -567,18 +567,15 @@ populate_cs_prog_key(const struct intel_device_info 
*devinfo,
              rss_info->requiredSubgroupSize == 16 ||
              rss_info->requiredSubgroupSize == 32);
       key->base.subgroup_size_type = rss_info->requiredSubgroupSize;
-   } else if (flags & 
VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT) {
+   } else if (flags & 
VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT &&
+              !(flags & 
VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT)) {
       /* If the client expressly requests full subgroups and they don't
-       * specify a subgroup size, we need to pick one.  If they're requested
-       * varying subgroup sizes, we set it to UNIFORM and let the back-end
-       * compiler pick.  Otherwise, we specify the API value of 32.
-       * Performance will likely be terrible in this case but there's nothing
-       * we can do about that.  The client should have chosen a size.
+       * specify a subgroup size neither allow varying subgroups, we need to
+       * pick one.  So we specify the API value of 32.  Performance will
+       * likely be terrible in this case but there's nothing we can do about
+       * that.  The client should have chosen a size.
        */
-      if (flags & 
VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT)
-         key->base.subgroup_size_type = BRW_SUBGROUP_SIZE_UNIFORM;
-      else
-         key->base.subgroup_size_type = BRW_SUBGROUP_SIZE_REQUIRE_32;
+      key->base.subgroup_size_type = BRW_SUBGROUP_SIZE_REQUIRE_32;
    }
 }
 

Reply via email to