[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mesa3d-dev
Subject:    Re: Benefits of cryptographic hash functions for uniquely identifing Vulkan shaders.
From:       Bas Nieuwenhuizen <bas () basnieuwenhuizen ! nl>
Date:       2023-07-03 9:34:06
Message-ID: CAP+8YyFqtNWWqWA+qq8M_b9Jf7SoS9U0fRjQrhuW5q7nTzJzrQ () mail ! gmail ! com
[Download RAW message or body]

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@gmail.com <
abel.bernabeu@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@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@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
>>>
>>>

[Attachment #3 (text/html)]

<div dir="ltr">We throw away the original for space though, so there is nothing to \
compare on collision (hence the cryptographic hash).<br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 3, 2023 at \
10:23 AM <a href="mailto:abel.bernabeu@gmail.com">abel.bernabeu@gmail.com</a> \
&lt;<a href="mailto:abel.bernabeu@gmail.com">abel.bernabeu@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Two \
cents, sorry if too obvious.<div><br></div><div>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).</div><div><br></div><div>That \
way you try cheaper hashing algorithms without \
worry.</div><div><br></div><div>Regards.</div><div><br></div><div><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 29 Jun 2023 at 13:35, \
Marek Olšák &lt;<a href="mailto:maraeo@gmail.com" \
target="_blank">maraeo@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="auto">If there is a hash collision, it \
will cause a GPU hang. A cryptographic hash function reduces that chance to \
practically zero.<div dir="auto"><br></div><div dir="auto">Marek</div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 29, 2023, 07:04 \
mikolajlubiak1337 &lt;<a href="mailto:mikolajlubiak1337@proton.me" \
target="_blank">mikolajlubiak1337@proton.me</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Hi,<br> I have recently read Phoronix article[1] \
about you switching to BLAKE3 instead of SHA1.<br> If BLAKE3 is a cryptographic hash \
function wouldn&#39;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?<br> <br>
[1]: <a href="https://www.phoronix.com/news/Mesa-BLAKE3-Shader-Hashing" \
rel="noreferrer noreferrer" \
target="_blank">https://www.phoronix.com/news/Mesa-BLAKE3-Shader-Hashing</a><br> <br>
-- me<br>
<br>
</blockquote></div>
</blockquote></div>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic