mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
radv: Add ability to override the build id for the cache.
This would allow us to keep the shader cache key the same for updates that we know won't impact compilation on SteamOS. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17426>
This commit is contained in:
parent
f286289c7f
commit
97641e5c94
3 changed files with 39 additions and 6 deletions
|
|
@ -542,3 +542,9 @@ option(
|
||||||
value : 'auto',
|
value : 'auto',
|
||||||
description : 'build gallium d3d12 with video support.',
|
description : 'build gallium d3d12 with video support.',
|
||||||
)
|
)
|
||||||
|
option(
|
||||||
|
'radv-build-id',
|
||||||
|
type : 'string',
|
||||||
|
value : '',
|
||||||
|
description : 'Override build id for shader cache keys (hex string). Can be extracted with readelf -x .note.gnu.build-id'
|
||||||
|
)
|
||||||
|
|
@ -153,6 +153,11 @@ if with_ld_version_script
|
||||||
libvulkan_radeon_link_depends += files('vulkan.sym')
|
libvulkan_radeon_link_depends += files('vulkan.sym')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
radv_build_id = get_option('radv-build-id')
|
||||||
|
if radv_build_id != ''
|
||||||
|
radv_flags += '-DRADV_BUILD_ID_OVERRIDE="' + radv_build_id + '"'
|
||||||
|
endif
|
||||||
|
|
||||||
libvulkan_radeon = shared_library(
|
libvulkan_radeon = shared_library(
|
||||||
'vulkan_radeon',
|
'vulkan_radeon',
|
||||||
[libradv_files, radv_entrypoints, sha1_h, radix_sort_spv],
|
[libradv_files, radv_entrypoints, sha1_h, radix_sort_spv],
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,19 @@ radv_get_current_time(void)
|
||||||
return os_time_get_nano();
|
return os_time_get_nano();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
parse_hex(char *out, const char *in, unsigned length)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < length; ++i)
|
||||||
|
out[i] = 0;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < 2 * length; ++i) {
|
||||||
|
unsigned v =
|
||||||
|
in[i] <= '9' ? in[i] - '0' : (in[i] >= 'a' ? (in[i] - 'a' + 10) : (in[i] - 'A' + 10));
|
||||||
|
out[i / 2] |= v << (4 * (1 - i % 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
|
radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
|
||||||
{
|
{
|
||||||
|
|
@ -109,13 +122,22 @@ radv_device_get_cache_uuid(struct radv_physical_device *pdevice, void *uuid)
|
||||||
memset(uuid, 0, VK_UUID_SIZE);
|
memset(uuid, 0, VK_UUID_SIZE);
|
||||||
_mesa_sha1_init(&ctx);
|
_mesa_sha1_init(&ctx);
|
||||||
|
|
||||||
if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx)
|
#ifdef RADV_BUILD_ID_OVERRIDE
|
||||||
#ifdef LLVM_AVAILABLE
|
{
|
||||||
|| (pdevice->use_llvm &&
|
char data[strlen(RADV_BUILD_ID_OVERRIDE) / 2];
|
||||||
!disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx))
|
parse_hex(data, RADV_BUILD_ID_OVERRIDE, ARRAY_SIZE(data));
|
||||||
#endif
|
_mesa_sha1_update(&ctx, data, ARRAY_SIZE(data));
|
||||||
)
|
}
|
||||||
|
#else
|
||||||
|
if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx))
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LLVM_AVAILABLE
|
||||||
|
if (pdevice->use_llvm &&
|
||||||
|
!disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx))
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
_mesa_sha1_update(&ctx, &family, sizeof(family));
|
_mesa_sha1_update(&ctx, &family, sizeof(family));
|
||||||
_mesa_sha1_update(&ctx, &ptr_size, sizeof(ptr_size));
|
_mesa_sha1_update(&ctx, &ptr_size, sizeof(ptr_size));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue