Module: Mesa
Branch: staging/23.3
Commit: f30bd0074e229744b0c0ccf03d5979e3cbdc9835
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f30bd0074e229744b0c0ccf03d5979e3cbdc9835

Author: Rhys Perry <pendingchao...@gmail.com>
Date:   Fri Nov  3 15:25:48 2023 +0000

radv: disable gs_fast_launch=2 by default

This currently causes severe performance problems in Remnant 2 and
Alan Wake 2.

Signed-off-by: Rhys Perry <pendingchao...@gmail.com>
Reviewed-by: Timur Kristóf <timur.kris...@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Fixes: 28ebe62af2cb ("radv: enable mesh shader gs_fast_launch=2 and multi-row 
export")
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10071
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26090>
(cherry picked from commit 2011b678c538b451eef5a1986adee7e25d6ee04f)

---

 .pick_status.json              | 2 +-
 docs/envvars.rst               | 2 ++
 src/amd/vulkan/radv_debug.h    | 1 +
 src/amd/vulkan/radv_device.c   | 3 ++-
 src/amd/vulkan/radv_instance.c | 1 +
 src/amd/vulkan/radv_pipeline.c | 5 +++++
 src/amd/vulkan/radv_shader.h   | 1 +
 7 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 484d047be6e..808371d2157 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -454,7 +454,7 @@
         "description": "radv: disable gs_fast_launch=2 by default",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "28ebe62af2cb38f73790f31dce4b0448268eb2e1",
         "notes": null
diff --git a/docs/envvars.rst b/docs/envvars.rst
index 4be7a1fe1f2..8660213bb54 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -1342,6 +1342,8 @@ RADV driver environment variables
       enable wave64 for ray tracing shaders (GFX10+)
    ``video_decode``
       enable experimental video decoding support
+   ``gsfastlaunch2``
+      use GS_FAST_LAUNCH=2 for Mesh shaders (GFX11+)
 
 .. envvar:: RADV_TEX_ANISO
 
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index fb18bf0c8cb..91174c0323e 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -88,6 +88,7 @@ enum {
    RADV_PERFTEST_NGG_STREAMOUT = 1u << 11,
    RADV_PERFTEST_VIDEO_DECODE = 1u << 12,
    RADV_PERFTEST_DMA_SHADERS = 1u << 13,
+   RADV_PERFTEST_GS_FAST_LAUNCH_2 = 1u << 14,
 };
 
 bool radv_init_trace(struct radv_device *device);
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4aa4b930c82..17ead40604c 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -940,7 +940,8 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const 
VkDeviceCreateInfo *pCr
    device->pbb_allowed =
       device->physical_device->rad_info.gfx_level >= GFX9 && 
!(device->instance->debug_flags & RADV_DEBUG_NOBINNING);
 
-   device->mesh_fast_launch_2 = device->physical_device->rad_info.gfx_level >= 
GFX11;
+   device->mesh_fast_launch_2 = (device->instance->perftest_flags & 
RADV_PERFTEST_GS_FAST_LAUNCH_2) &&
+                                device->physical_device->rad_info.gfx_level >= 
GFX11;
 
    /* The maximum number of scratch waves. Scratch space isn't divided
     * evenly between CUs. The number is only a function of the number of CUs.
diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c
index 03d647ad5a5..ffe4bb3a32a 100644
--- a/src/amd/vulkan/radv_instance.c
+++ b/src/amd/vulkan/radv_instance.c
@@ -99,6 +99,7 @@ static const struct debug_control radv_perftest_options[] = 
{{"localbos", RADV_P
                                                              {"ngg_streamout", 
RADV_PERFTEST_NGG_STREAMOUT},
                                                              {"video_decode", 
RADV_PERFTEST_VIDEO_DECODE},
                                                              {"dmashaders", 
RADV_PERFTEST_DMA_SHADERS},
+                                                             {"gsfastlaunch2", 
RADV_PERFTEST_GS_FAST_LAUNCH_2},
                                                              {NULL, 0}};
 
 const char *
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index d18f5b04875..c855025858c 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -214,6 +214,11 @@ radv_generate_pipeline_key(const struct radv_device 
*device, const VkPipelineSha
          key.vertex_robustness1 = 1u;
    }
 
+   for (uint32_t i = 0; i < num_stages; i++) {
+      if (stages[i].stage == VK_SHADER_STAGE_MESH_BIT_EXT && 
device->mesh_fast_launch_2)
+         key.mesh_fast_launch_2 = 1u;
+   }
+
    return key;
 }
 
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index f902d3e1e94..0582e6b1e47 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -99,6 +99,7 @@ struct radv_pipeline_key {
    uint32_t mesh_shader_queries : 1;
 
    uint32_t vertex_robustness1 : 1;
+   uint32_t mesh_fast_launch_2 : 1;
 
    struct radv_shader_stage_key stage_info[MESA_VULKAN_SHADER_STAGES];
 

Reply via email to