radv: assert there is no padding in cache keys

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@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-17 10:48:57 +01:00 committed by Marge Bot
parent 5ee0935861
commit 0249fcfbb6
3 changed files with 7 additions and 0 deletions

View file

@ -236,6 +236,8 @@ static bool handle_env_var_force_family(struct radeon_info *info)
void
ac_fill_compiler_info(struct radeon_info *info, const struct drm_amdgpu_info_device *device_info)
{
/* We use ac_compiler_info for shader cache keys, so make sure there is no padding. */
STATIC_ASSERT(sizeof(enum amd_gfx_level) == 4);
STATIC_ASSERT(sizeof(struct ac_compiler_info) == 56);
struct ac_compiler_info *out = &info->compiler_info;

View file

@ -864,6 +864,8 @@ capture_trace(VkQueue _queue)
static void
radv_device_init_cache_key(struct radv_device *device)
{
STATIC_ASSERT(sizeof(struct radv_device_cache_key) == 4);
const struct radv_physical_device *pdev = radv_device_physical(device);
struct radv_device_cache_key *key = &device->cache_key;
struct mesa_blake3 ctx;

View file

@ -291,6 +291,9 @@ parse_hex(char *out, const char *in, unsigned length)
static void
radv_physical_device_init_cache_key(struct radv_physical_device *pdev)
{
STATIC_ASSERT(sizeof(enum radeon_family) == 4);
STATIC_ASSERT(sizeof(struct radv_physical_device_cache_key) == 12);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
struct radv_physical_device_cache_key *key = &pdev->cache_key;