[Mesa-dev] [PATCH 0/4] RadeonSI: Multithreaded shader compilation

Marek Olšák maraeo at gmail.com
Sat Jul 9 15:49:00 UTC 2016


On Fri, Jul 8, 2016 at 3:20 AM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> On Wed, 2016-06-29 at 18:32 +0200, Marek Olšák wrote:
>> Hi,
>>
>> This series implements basic multithreaded LLVM shader compilation
>> in a minimally invasive way. (+51 lines of code in the main patch)
>>
>> It doesn't help on-demand shader compilation, but it does improve
>> loading and startup times by being able to saturate up to 4 CPU cores
>> if given enough shaders to compile. A proper shader cache might make
>> this redundant, but we don't have that now.
>
> Have you had a chance to take a look at my recent shader cache work
> [1]? The glsl work is mostly done I'm now just cleaning up and fixing
> up the fallback paths for when we have a cache miss. I'm not sure if
> you guys will need the fallback path or not since you have a way
> dealing with varients, you might be ok which would make things much
> simpler.
>
> Anyway I don't think that getting something up and running would be a
> large amount of work. Most of your time would likely be spent tweaking
> the glsl to tgsi path to haveit to skip over the IR conversion and just
> grab the required state.
>
> The two files you would find most interesting would be:
>
> src/compiler/glsl/shader_cache.cpp
> src/mesa/drivers/dri/i965/brw_shader_cache.c
>
> Everything else (besided the cache code itself) is pretty much just
> wiring things up to be called at the right time, or skipped.
>
>
> [1] https://github.com/tarceri/Mesa_arrays_of_arrays.git shader-cache20

No, I haven't looked at it.

An on-disk shader cache would be nice to have, but it's not a pressing
thing since we don't really get many apps compiling shaders before
drawing. UE4 was doing that with GL 4.1 but not GL4.3, so that's cool.
The only app where a shader cache would help a lot is Borderlands 2.
Sadly, the same game would benefit from OpenGL driver multithreading
even more, because once all shaders are compiled, the game is
CPU-bound most of the time with frame rates as low as 20 on Core i5
3570.

All in all, I need more user feedback to be sure if the on-disk shader
cache would make any difference outside of Borderlands 2.

On the other hand, asynchronous compilation should open up new shader
optimization opportunities, and that may be more important for us in
the long run.

Marek


More information about the mesa-dev mailing list