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

Matt Turner mattst88 at gmail.com
Wed Nov 4 20:43:09 PST 2015


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.


More information about the mesa-dev mailing list