radv: remove radv_device_cache_key

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41022>
This commit is contained in:
Rhys Perry 2026-04-23 16:55:15 +01:00 committed by Marge Bot
parent 44b09b8396
commit aac8787fda
3 changed files with 28 additions and 44 deletions

View file

@ -864,37 +864,16 @@ capture_trace(VkQueue _queue)
static void
radv_device_init_cache_key(struct radv_device *device)
{
STATIC_ASSERT(sizeof(enum radeon_family) == 4);
STATIC_ASSERT(sizeof(struct radv_device_cache_key) == 12);
STATIC_ASSERT(sizeof(device->compiler_info.hw) == 12);
STATIC_ASSERT(sizeof(device->compiler_info.key) == 12);
const struct radv_physical_device *pdev = radv_device_physical(device);
struct radv_device_cache_key *key = &device->cache_key;
uint32_t ptr_size = sizeof(void *);
struct mesa_blake3 ctx;
key->family = pdev->info.family;
key->ptr_size = sizeof(void *);
key->conformant_trunc_coord = pdev->info.compiler_info.conformant_trunc_coord;
key->image_2d_view_of_3d = device->vk.enabled_features.image2DViewOf3D && pdev->info.gfx_level == GFX9;
key->mesh_shader_queries = device->vk.enabled_features.meshShaderQueries && pdev->emulate_mesh_shader_queries;
key->primitives_generated_query = radv_uses_primitives_generated_query(device);
/* The Vulkan spec says:
* "Binary shaders retrieved from a physical device with a certain shaderBinaryUUID are
* guaranteed to be compatible with all other physical devices reporting the same
* shaderBinaryUUID and the same or higher shaderBinaryVersion."
*
* That means the driver should compile shaders for the "worst" case of all features being
* enabled, regardless of what features are actually enabled on the logical device.
*/
if (device->vk.enabled_features.shaderObject) {
key->image_2d_view_of_3d = pdev->info.gfx_level == GFX9;
key->primitives_generated_query = true;
}
_mesa_blake3_init(&ctx);
_mesa_blake3_update(&ctx, &device->cache_key, sizeof(device->cache_key));
_mesa_blake3_update(&ctx, &ptr_size, sizeof(ptr_size));
_mesa_blake3_update(&ctx, device->compiler_info.ac, sizeof(struct ac_compiler_info));
_mesa_blake3_update(&ctx, &device->compiler_info.hw, sizeof(device->compiler_info.hw));
_mesa_blake3_update(&ctx, &device->compiler_info.key, sizeof(device->compiler_info.key));
_mesa_blake3_final(&ctx, device->cache_hash);
}
@ -1146,6 +1125,23 @@ radv_device_init_compiler_info(struct radv_device *device)
nggc_max_ps_params = pdev->info.has_dedicated_vram ? 12 : 8;
}
bool image_2d_view_of_3d = device->vk.enabled_features.image2DViewOf3D && pdev->info.gfx_level == GFX9;
bool mesh_shader_queries = device->vk.enabled_features.meshShaderQueries && pdev->emulate_mesh_shader_queries;
bool primitives_generated_query = radv_uses_primitives_generated_query(device);
/* The Vulkan spec says:
* "Binary shaders retrieved from a physical device with a certain shaderBinaryUUID are
* guaranteed to be compatible with all other physical devices reporting the same
* shaderBinaryUUID and the same or higher shaderBinaryVersion."
*
* That means the driver should compile shaders for the "worst" case of all features being
* enabled, regardless of what features are actually enabled on the logical device.
*/
if (device->vk.enabled_features.shaderObject) {
image_2d_view_of_3d = pdev->info.gfx_level == GFX9;
primitives_generated_query = true;
}
struct radv_compiler_info info = {
/* Hardware info */
.ac = &pdev->info.compiler_info,
@ -1166,9 +1162,9 @@ radv_device_init_compiler_info(struct radv_device *device)
.no_ngg_gs = instance->drirc.performance.disable_ngg_gs,
.load_grid_size_from_user_sgpr = pdev->load_grid_size_from_user_sgpr,
.emulate_ngg_gs_query_pipeline_stat = pdev->emulate_ngg_gs_query_pipeline_stat,
.primitives_generated_query = device->cache_key.primitives_generated_query,
.mesh_shader_queries = device->cache_key.mesh_shader_queries,
.image_2d_view_of_3d = device->cache_key.image_2d_view_of_3d,
.primitives_generated_query = primitives_generated_query,
.mesh_shader_queries = mesh_shader_queries,
.image_2d_view_of_3d = image_2d_view_of_3d,
.use_fmask = pdev->use_fmask,
.robust_buffer_access = pdev->use_llvm && (device->vk.enabled_features.robustBufferAccess2 ||
device->vk.enabled_features.robustBufferAccess),

View file

@ -54,18 +54,6 @@ struct radv_layer_dispatch_tables {
struct vk_device_dispatch_table ctx_roll;
};
struct radv_device_cache_key {
enum radeon_family family;
uint32_t ptr_size;
uint32_t conformant_trunc_coord : 1;
uint32_t image_2d_view_of_3d : 1;
uint32_t mesh_shader_queries : 1;
uint32_t primitives_generated_query : 1;
uint32_t reserved : 28;
};
enum radv_force_vrs {
RADV_FORCE_VRS_1x1 = 0,
RADV_FORCE_VRS_2x2,
@ -314,7 +302,6 @@ struct radv_device {
struct radv_debug_nir debug_nir;
struct radv_device_cache_key cache_key;
blake3_hash cache_hash;
/* Not NULL if a GPU hang report has been generated for VK_EXT_device_fault. */

View file

@ -517,7 +517,8 @@ struct radv_compiler_info {
struct {
uint32_t family;
uint32_t address32_hi;
bool rbplus_allowed;
uint32_t rbplus_allowed : 1;
uint32_t padding : 31;
} hw;
/* Misc values included as part of the cache key */