From 0c6b39d4fb133a3a99c9543b0a064f9316970175 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 19 Aug 2025 10:05:09 +0200 Subject: [PATCH] radv: add RADV_GFX12_HIZ_WA to select the HiZ wa behavior on GFX12 Will be useful for benchmarking. Signed-off-by: Samuel Pitoiset Part-of: --- docs/envvars.rst | 13 +++++++++++++ src/amd/vulkan/radv_physical_device.c | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index ffd877c529a..5703fb83075 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1612,6 +1612,19 @@ RADV driver environment variables ``peak`` force GPU clocks to their maximum level, this is the default value +.. envvar:: RADV_GFX12_HIZ_WA + + choose the specific HiZ workaround to apply on GFX12 (RDNA4). The possible + values are: + + ``disabled`` + no HiZ workaround is enabled, use at your own risk but optimal for performance + ``partial`` + mitigate the issue partially, potentially risky but performance should be + mostly optimal (default value) + ``full`` + mitigate the issue completely, no risk but performance might be decreased + .. envvar:: ACO_DEBUG a comma-separated list of named flags, which do various things: diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index eb2e79c8677..15510ae23a9 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -2308,8 +2308,21 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm if (pdev->info.gfx_level == GFX12 && instance->drirc.disable_hiz_his_gfx12) pdev->use_hiz = false; - if (pdev->info.gfx_level == GFX12) - pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_PARTIAL; + if (pdev->info.gfx_level == GFX12) { + const char *gfx12_hiz_wa_str = getenv("RADV_GFX12_HIZ_WA"); + + pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_PARTIAL; /* Default */ + + if (gfx12_hiz_wa_str) { + if (!strcmp(gfx12_hiz_wa_str, "disabled")) { + pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_DISABLED; + } else if (!strcmp(gfx12_hiz_wa_str, "partial")) { + pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_PARTIAL; + } else if (!strcmp(gfx12_hiz_wa_str, "full")) { + pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_FULL; + } + } + } pdev->use_ngg = (pdev->info.gfx_level >= GFX10 && pdev->info.family != CHIP_NAVI14 && !(instance->debug_flags & RADV_DEBUG_NO_NGG)) ||