Module: Mesa Branch: main Commit: 2011b678c538b451eef5a1986adee7e25d6ee04f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2011b678c538b451eef5a1986adee7e25d6ee04f
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> --- 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 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 9e225a3c2be..b46b070a13c 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 82d93f4e196..d28c2de8043 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -88,6 +88,7 @@ enum { RADV_PERFTEST_RT_WAVE_64 = 1u << 10, RADV_PERFTEST_VIDEO_DECODE = 1u << 11, RADV_PERFTEST_DMA_SHADERS = 1u << 12, + RADV_PERFTEST_GS_FAST_LAUNCH_2 = 1u << 13, }; 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 f3c92ed7197..c6ada5e8354 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -943,7 +943,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 4757fe89949..abc410e33b8 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 {"rtwave64", RADV_PERFTEST_RT_WAVE_64}, {"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 5b203a16235..d6581e13451 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];