[Mesa-dev] RFC: parallel shader compiles in mesa

Jason Ekstrand jason at jlekstrand.net
Wed Nov 4 22:29:50 PST 2015


On Wed, Nov 4, 2015 at 8:43 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Sun, Nov 1, 2015 at 4:27 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
>> There was already some work done for this (with i965) a while back:
>>
>> http://lists.freedesktop.org/archives/mesa-dev/2014-July/063008.html
>>
>> IIRC the reason it didn't get merged was that Chia never actually made
>> sure that the compiler was threadsafe (despite some patches fixing
>> some things). I can't seem to find any emails to confirm that, though.
>> Jason has mentioned that when he does parallel shader-db compiles on
>> his desktop, it sometimes crashes, so there are definitely still some
>> races left over. We've religiously avoided global variables and tied
>> everything to nir_shader and stack-local context variables in NIR for
>> exactly this reason, so it should be fine, but I'm not as sure about
>> GLSL IR (or for i965, the backends). Yes, it's painful work, but since
>> when is bolting on multithreading after-the-fact easy? (of ccourse,
>> any races are already a problem today, but I don't think people always
>> had that in mind when writing the code and this is going to make any
>> existing problems much worse).
>
> I don't know of any thread safety problems in the compiler. I fixed a
> few there and one in EGL. The one in EGL (commit dac2e7dea in March)
> fixed the only crash I've seen.
>
> I don't believe Jason has seen any crashes from shader-db's run.c
> since that fix.

To be honest, I don't remember.  I don't recall having seen one in a
while but, then again, I haven't done much shader-db running lately.
But if it was a problem, I probably would have seen it during all my
NIR vec4 testing...  I guess that means I haven't seen it in a while.


More information about the mesa-dev mailing list