From 353fe94c0ef7434ec48db107fa76849c69faa4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 12 Mar 2026 22:35:32 -0400 Subject: [PATCH] Rename SHA1 words to BLAKE3 Acked-by: Alyssa Rosenzweig Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/asahi/lib/agx_device.c | 2 +- src/compiler/nir/nir_shader_compiler_options.h | 2 +- src/freedreno/common/freedreno_uuid.c | 2 +- src/gallium/auxiliary/util/u_live_shader_cache.c | 6 +++--- src/gallium/drivers/crocus/crocus_context.h | 2 +- src/gallium/drivers/iris/iris_context.h | 2 +- src/gallium/drivers/panfrost/pan_context.h | 2 +- src/gallium/drivers/radeonsi/si_state_shaders.cpp | 4 ++-- src/mesa/main/shader_types.h | 4 ++-- src/vulkan/runtime/vk_pipeline.h | 2 +- src/vulkan/runtime/vk_shader.c | 6 +++--- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/asahi/lib/agx_device.c b/src/asahi/lib/agx_device.c index 35a7e335a21..f158e0e7ace 100644 --- a/src/asahi/lib/agx_device.c +++ b/src/asahi/lib/agx_device.c @@ -892,7 +892,7 @@ agx_get_device_uuid(const struct agx_device *dev, void *uuid) /* The device UUID uniquely identifies the given device within the machine. * Since we never have more than one device, this doesn't need to be a real - * UUID, so we use SHA1("agx" + gpu_generation + gpu_variant + gpu_revision). + * UUID, so we use BLAKE3("agx" + gpu_generation + gpu_variant + gpu_revision). */ static const char *device_name = "agx"; _mesa_blake3_update(&blake3_ctx, device_name, strlen(device_name)); diff --git a/src/compiler/nir/nir_shader_compiler_options.h b/src/compiler/nir/nir_shader_compiler_options.h index 8b9e1d55ff4..9efb3f8a985 100644 --- a/src/compiler/nir/nir_shader_compiler_options.h +++ b/src/compiler/nir/nir_shader_compiler_options.h @@ -875,7 +875,7 @@ typedef struct nir_shader_compiler_options { * outputs to inputs. * * Drivers can set the maximum cost based on the types of consecutive - * shaders or shader SHA1s. + * shaders or shader BLAKE3s. * * Drivers should also set "varying_estimate_instr_cost". */ diff --git a/src/freedreno/common/freedreno_uuid.c b/src/freedreno/common/freedreno_uuid.c index 1fa5aba8242..43674f7bf27 100644 --- a/src/freedreno/common/freedreno_uuid.c +++ b/src/freedreno/common/freedreno_uuid.c @@ -47,7 +47,7 @@ fd_get_device_uuid(void *uuid, const struct fd_dev_id *id) /* The device UUID uniquely identifies the given device within the machine. * Since we never have more than one device, this doesn't need to be a real - * UUID, so we use SHA1("freedreno" + gpu_id). + * UUID, so we use BLAKE3("freedreno" + gpu_id). * * @TODO: Using the GPU id could be too restrictive on the off-chance that * someone would like to use this UUID to cache pre-tiled images or something diff --git a/src/gallium/auxiliary/util/u_live_shader_cache.c b/src/gallium/auxiliary/util/u_live_shader_cache.c index 19e9e902701..bd9aa1e56f1 100644 --- a/src/gallium/auxiliary/util/u_live_shader_cache.c +++ b/src/gallium/auxiliary/util/u_live_shader_cache.c @@ -37,13 +37,13 @@ static uint32_t key_hash(const void *key) { - /* Take the first dword of SHA1. */ + /* Take the first dword of BLAKE3. */ return *(uint32_t*)key; } static bool key_equals(const void *a, const void *b) { - /* Compare SHA1s. */ + /* Compare BLAKE3s. */ return memcmp(a, b, 20) == 0; } @@ -97,7 +97,7 @@ util_live_shader_cache_get(struct pipe_context *ctx, return NULL; } - /* Compute SHA1 of pipe_shader_state. */ + /* Compute BLAKE3 of pipe_shader_state. */ blake3_hasher blake3_ctx; unsigned char blake3[BLAKE3_KEY_LEN]; _mesa_blake3_init(&blake3_ctx); diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h index 9c24a971c32..069e3a1be07 100644 --- a/src/gallium/drivers/crocus/crocus_context.h +++ b/src/gallium/drivers/crocus/crocus_context.h @@ -308,7 +308,7 @@ struct crocus_uncompiled_shader { struct pipe_stream_output_info stream_output; - /* A SHA1 of the serialized NIR for the disk cache. */ + /* A BLAKE3 of the serialized NIR for the disk cache. */ unsigned char nir_sha1[BLAKE3_KEY_LEN]; unsigned program_id; diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 70d1e65a542..eb0f201bf71 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -545,7 +545,7 @@ struct iris_uncompiled_shader { struct pipe_stream_output_info stream_output; - /* A SHA1 of the serialized NIR for the disk cache. */ + /* A BLAKE3 of the serialized NIR for the disk cache. */ unsigned char nir_sha1[BLAKE3_KEY_LEN]; /* Hash value based on shader source program */ diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index f8b766d1f12..d324093660e 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -396,7 +396,7 @@ struct panfrost_uncompiled_shader { */ const nir_shader *nir; - /* A SHA1 of the serialized NIR for the disk cache. */ + /* A BLAKE3 of the serialized NIR for the disk cache. */ unsigned char nir_sha1[BLAKE3_KEY_LEN]; /* Stream output information */ diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index e56c064d94c..6252085e161 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -460,13 +460,13 @@ bool si_shader_cache_load_shader(struct si_screen *sscreen, unsigned char ir_bla static uint32_t si_shader_cache_key_hash(const void *key) { - /* Take the first dword of SHA1. */ + /* Take the first dword of BLAKE3. */ return *(uint32_t *)key; } static bool si_shader_cache_key_equals(const void *a, const void *b) { - /* Compare SHA1s. */ + /* Compare BLAKE3s. */ return memcmp(a, b, 20) == 0; } diff --git a/src/mesa/main/shader_types.h b/src/mesa/main/shader_types.h index 8261d06b409..b91361c5523 100644 --- a/src/mesa/main/shader_types.h +++ b/src/mesa/main/shader_types.h @@ -179,7 +179,7 @@ struct gl_shader enum gl_compile_status CompileStatus; - /** SHA1 of the pre-processed source used by the disk cache. */ + /** BLAKE3 of the pre-processed source used by the disk cache. */ uint8_t disk_cache_sha1[BLAKE3_KEY_LEN]; /** BLAKE3 of the original source before replacement, set by glShaderSource. */ blake3_hash source_blake3; @@ -323,7 +323,7 @@ struct gl_shader_program_data { GLint RefCount; /**< Reference count */ - /** SHA1 hash of linked shader program */ + /** BLAKE3 hash of linked shader program */ unsigned char blake3[BLAKE3_KEY_LEN]; unsigned NumUniformStorage; diff --git a/src/vulkan/runtime/vk_pipeline.h b/src/vulkan/runtime/vk_pipeline.h index 10a4d814f77..029bf0c7f87 100644 --- a/src/vulkan/runtime/vk_pipeline.h +++ b/src/vulkan/runtime/vk_pipeline.h @@ -83,7 +83,7 @@ PRAGMA_DIAGNOSTIC_POP /** Hash VkPipelineShaderStageCreateInfo info * * Returns the hash of a VkPipelineShaderStageCreateInfo: - * SHA1(info->module->sha1, + * BLAKE3(info->module->sha1, * info->pName, * vk_stage_to_mesa_stage(info->stage), * info->pSpecializationInfo) diff --git a/src/vulkan/runtime/vk_shader.c b/src/vulkan/runtime/vk_shader.c index f6d9ce151d7..0823db25141 100644 --- a/src/vulkan/runtime/vk_shader.c +++ b/src/vulkan/runtime/vk_shader.c @@ -357,7 +357,7 @@ vk_shader_serialize(struct vk_device *device, blake3_hasher blake3_ctx; _mesa_blake3_init(&blake3_ctx); - /* Hash the header with a zero SHA1 */ + /* Hash the header with a zero BLAKE3 */ _mesa_blake3_update(&blake3_ctx, &header, sizeof(header)); /* Hash the serialized data */ @@ -430,7 +430,7 @@ vk_shader_deserialize(struct vk_device *device, blake3_hasher blake3_ctx; _mesa_blake3_init(&blake3_ctx); - /* Hash the header with a zero SHA1 */ + /* Hash the header with a zero BLAKE3 */ struct vk_shader_bin_header blake3_header = header; memset(blake3_header.blake3, 0, sizeof(blake3_header.blake3)); _mesa_blake3_update(&blake3_ctx, &blake3_header, sizeof(blake3_header)); @@ -444,7 +444,7 @@ vk_shader_deserialize(struct vk_device *device, return vk_error(device, VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT); /* We've now verified that the header matches and that the data has the - * right SHA1 hash so it's safe to call into the driver. + * right BLAKE3 hash so it's safe to call into the driver. */ return ops->deserialize(device, &blob, header.version, pAllocator, shader_out);