radv: disable gs_fast_launch=2 by default
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 3 Nov 2023 15:25:48 +0000 (15:25 +0000)
committerEric Engestrom <eric@engestrom.ch>
Wed, 8 Nov 2023 18:18:59 +0000 (18:18 +0000)
This currently causes severe performance problems in Remnant 2 and
Alan Wake 2.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@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
docs/envvars.rst
src/amd/vulkan/radv_debug.h
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_instance.c
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader.h

index 484d047be6e0cde660cdf585b616d31bd94f5d95..808371d2157ee48c2d1c4ed99f458c3295136b2e 100644 (file)
         "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
index 4be7a1fe1f296b97bf15d086d263d519497e11a8..8660213bb5485abd49448e7575a905c052fd9188 100644 (file)
@@ -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
 
index fb18bf0c8cb1a628c3542427a47e0e0f31799148..91174c0323ed4c5bed2786ada830ad23e41a9557 100644 (file)
@@ -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);
index 4aa4b930c82398073c425e55bc4a0ead185dc957..17ead40604c9e60a88393256d132d4fca9ae17ad 100644 (file)
@@ -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.
index 03d647ad5a5e09b0ce52f6811adb06ca3a6d3d7a..ffe4bb3a32a882d219e3495e9474d0fa5d3041ae 100644 (file)
@@ -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 *
index d18f5b04875b3633ca5b8fc74154774307670ab3..c855025858cc8765baab8cd2b6e668aee4353553 100644 (file)
@@ -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;
 }
 
index f902d3e1e9456be14298275b371248941acd1e9c..0582e6b1e471fac79ec15f8c6395234974fdb961 100644 (file)
@@ -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];