Mesa (master): radv: workaround games which assume full subgroups if cswave32 is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 7 15:23:04 UTC 2021


Module: Mesa
Branch: master
Commit: cacce76db9b4e4da516d692208280e74fb2437ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cacce76db9b4e4da516d692208280e74fb2437ab

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Dec  3 17:38:51 2020 +0000

radv: workaround games which assume full subgroups if cswave32 is enabled

This assumption becomes incorrect with RADV_PERFTEST=cswave32.

Games include Detroit: Become Human and Doom Eternal.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7918>

---

 src/amd/vulkan/radv_pipeline.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 0f376781e2f..92bace2480e 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -2776,6 +2776,18 @@ radv_fill_shader_keys(struct radv_device *device,
 		if (!subgroup_size)
 			subgroup_size = device->physical_device->cs_wave_size;
 
+		unsigned local_size = nir[MESA_SHADER_COMPUTE]->info.cs.local_size[0] *
+				      nir[MESA_SHADER_COMPUTE]->info.cs.local_size[1] *
+				      nir[MESA_SHADER_COMPUTE]->info.cs.local_size[2];
+
+		/* Games don't always request full subgroups when they should,
+		 * which can cause bugs if cswave32 is enabled.
+		 */
+		if (device->physical_device->cs_wave_size == 32 &&
+		    nir[MESA_SHADER_COMPUTE]->info.cs.uses_wide_subgroup_intrinsics &&
+		    !req_subgroup_size && local_size % RADV_SUBGROUP_SIZE == 0)
+			require_full_subgroups = true;
+
 		if (require_full_subgroups && !req_subgroup_size) {
 			/* don't use wave32 pretending to be wave64 */
 			subgroup_size = RADV_SUBGROUP_SIZE;



More information about the mesa-commit mailing list