Benefits of cryptographic hash functions for uniquely identifing Vulkan shaders.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Jul 3 09:34:06 UTC 2023


We throw away the original for space though, so there is nothing to compare
on collision (hence the cryptographic hash).

On Mon, Jul 3, 2023 at 10:23 AM abel.bernabeu at gmail.com <
abel.bernabeu at gmail.com> wrote:

> Two cents, sorry if too obvious.
>
> If you want to try to squeeze more performance here, it seems valid to try
> to fallback to full comparison in case of collision. The algorithm will be
> correct irrespective of your (bad luck) with hash collisions, and at worst,
> with an insignificant probability, the time cost is O(n*n), but the typical
> cost will remain close to always O(n).
>
> That way you try cheaper hashing algorithms without worry.
>
> Regards.
>
>
>
> On Thu, 29 Jun 2023 at 13:35, Marek Olšák <maraeo at gmail.com> wrote:
>
>> If there is a hash collision, it will cause a GPU hang. A cryptographic
>> hash function reduces that chance to practically zero.
>>
>> Marek
>>
>> On Thu, Jun 29, 2023, 07:04 mikolajlubiak1337 <
>> mikolajlubiak1337 at proton.me> wrote:
>>
>>> Hi,
>>> I have recently read Phoronix article[1] about you switching to BLAKE3
>>> instead of SHA1.
>>> If BLAKE3 is a cryptographic hash function wouldn't it be faster to use
>>> a non cryptographic hash function or even a checksum function? Do you need
>>> the benefits of cryptographic hash functions over other hash/checksum
>>> functions for the purpose of uniquely identifing Vulkan shaders?
>>>
>>> [1]: https://www.phoronix.com/news/Mesa-BLAKE3-Shader-Hashing
>>>
>>> -- me
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20230703/9c8057c8/attachment.htm>


More information about the mesa-dev mailing list