From fe067b17d908d8f02e88ef3c4433ec5fbb66b2a9 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 29 Apr 2026 13:23:47 +0100 Subject: [PATCH] radv: split radv_compiler_info's family into debug::family and key::family We used this for two different purposes with different caching requirements: - it's always needed for LLVM, and needs to be part of the cache key - it's needed for disassembly with ACO, and shouldn't be part of the cache key Eventually, we'll want the family to only be part of the cache key if LLVM is used, but still accessable for when ACO needs the disassembler. If we put it in radv_compiler_info::debug, we'll need to treat that specially to hash it into the key when LLVM is used. If we put it in radv_compiler_info::key, that will hash it into the key unnecessarily if ACO is used and disassembly might be needed. So just put the family in both, and use debug::family for disassembly and key::family for LLVM. Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_device.c | 7 ++++--- src/amd/vulkan/radv_shader.c | 4 ++-- src/amd/vulkan/radv_shader.h | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 3806f557332..e44af415f86 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -864,8 +864,8 @@ capture_trace(VkQueue _queue) static void radv_device_init_cache_key(struct radv_device *device) { - STATIC_ASSERT(sizeof(device->compiler_info.hw) == 12); - STATIC_ASSERT(sizeof(device->compiler_info.key) == 16); + STATIC_ASSERT(sizeof(device->compiler_info.hw) == 8); + STATIC_ASSERT(sizeof(device->compiler_info.key) == 20); uint32_t ptr_size = sizeof(void *); @@ -1147,7 +1147,6 @@ radv_device_init_compiler_info(struct radv_device *device) .ac = &pdev->info.compiler_info, .hw = { - .family = pdev->info.family, .address32_hi = pdev->info.address32_hi, .address_prt_wa_control_bit = pdev->info.address_prt_wa_control_bit, .rbplus_allowed = pdev->info.rbplus_allowed, @@ -1190,6 +1189,7 @@ radv_device_init_compiler_info(struct radv_device *device) .lower_terminate_to_discard = instance->drirc.debug.lower_terminate_to_discard, .no_implicit_varying_subgroup_size = instance->drirc.debug.no_implicit_varying_subgroup_size, .force_aniso = device->force_aniso, + .family = pdev->info.family, /* Wave/subgroup sizes */ .ge_wave_size = pdev->ge_wave_size, @@ -1221,6 +1221,7 @@ radv_device_init_compiler_info(struct radv_device *device) /* Capture shader statistics when RGP is enabled to correlate shader hashes with Fossilize. */ .capture_shader_stats = (instance->debug_flags & (RADV_DEBUG_DUMP_SHADER_STATS | RADV_DEBUG_PSO_HISTORY)) || device->keep_shader_info || (instance->vk.trace_mode & RADV_TRACE_MODE_RGP), + .family = pdev->info.family, }, .rra_trace = &device->rra_trace, /* Cache */ diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index efcbd15efeb..04c924c0d14 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -3278,7 +3278,7 @@ radv_fill_llvm_compiler_options(struct radv_llvm_compiler_options *options, bool can_dump_shader, bool keep_shader_info) { options->compiler_info = compiler_info->ac; - options->family = compiler_info->hw.family; + options->family = compiler_info->key.family; options->address32_hi = compiler_info->hw.address32_hi; /* robust_buffer_access_llvm here used by LLVM only, pipeline robustness is not exposed there. */ options->robust_buffer_access = compiler_info->key.robust_buffer_access; @@ -3306,7 +3306,7 @@ radv_aco_fill_compiler_options(struct aco_compiler_options *aco_info, const stru aco_info->is_opengl = false; aco_info->optimisations_disabled = stage_key->optimisations_disabled; aco_info->gfx_level = compiler_info->ac->gfx_level; - aco_info->family = compiler_info->hw.family; + aco_info->family = compiler_info->debug.family; aco_info->address32_hi = compiler_info->hw.address32_hi; } diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index bd9355675eb..0208801dea6 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -505,7 +505,6 @@ struct radv_compiler_info { const struct ac_compiler_info *ac; struct { - uint32_t family; uint32_t address32_hi; uint32_t rbplus_allowed : 1; uint32_t address_prt_wa_control_bit : 8; @@ -549,6 +548,8 @@ struct radv_compiler_info { int32_t force_aniso; + uint32_t family; + /* Wave/subgroup sizes */ uint8_t ge_wave_size; uint8_t ps_wave_size; @@ -577,6 +578,7 @@ struct radv_compiler_info { bool keep_shader_info; bool capture_shaders; bool capture_shader_stats; + uint32_t family; /* For ACO disassembly only */ } debug; struct radv_rra_trace_data *rra_trace;