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

Timothy Arceri timothy.arceri at collabora.com
Fri Jul 8 01:20:26 UTC 2016


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

> 
> Implementation:
> 
>    si_create_shader_selector doesn't compile main shader parts and
>    geometry shaders, but instead schedules an async job that does
> that.
> 
>    si_shader_select (in a draw call) waits for the job to complete
>    before assembling a shader variant from multiple binaries.
> 
> Results:
> 
> Loading times (using a stopwatch and multiple tries):
>    Elemental Demo (black screen time): 10.45 -> 8.16 seconds (-2.29
> s)
>    Unigine Heaven (loading time): 13.4 -> 12.2 seconds (-1.2 s)
> 
> Apitrace running times:
>    DiRT Showdown: 101.3 - > 94 seconds (-7.3 seconds)
>    Left 4 Dead 2: 37.5 -> 30 seconds (-7.5 seconds)
>    Borderlands 2: 36.9 -> 36.1 seconds (-0.8 seconds)
>      (the last one is an example of on-demand compilation)
> 
> Please review.
> 
> Marek
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list