[Mesa-dev] [PATCH 1/3] glsl: delay optimisations on individual shaders when cache is available

Grazvydas Ignotas notasas at gmail.com
Mon Mar 27 23:26:22 UTC 2017


On Mon, Mar 27, 2017 at 12:43 PM, Timothy Arceri <tarceri at itsqueeze.com>
wrote:
>
>
> On 27/03/17 20:30, Grazvydas Ignotas wrote:
>>
>> On Mon, Mar 27, 2017 at 6:14 AM, Timothy Arceri <tarceri at itsqueeze.com>
>> wrote:
>>>
>>> Due to a max limit of 65,536 entries on the index table that we use to
>>> decide if we can skip compiling individual shaders, it is very likely
>>> we will have collisions.
>>>
>>> To avoid doing too much work when the linked program may be in the
>>> cache this patch delays calling the optimisations until link time.
>>>
>>> Improves cold cache start-up times on Deus Ex by ~20 seconds.
>>>
>>> When deleting the cache index to simulate a worst case scenario
>>> of colisions in the index, warm cache start-up time improve by
>>
>>
>> typo: collisions
>>
>>> ~45 seconds.
>>
>>
>> I wonder if it won't make the experience worse in some cases. For
>> example Talos compiles all the shaders on the loading screen, and then
>> seems to link them ingame during gameplay, so if too much work is
>> delayed to link time, on cold cache there might be faster loading
>> times but ingame stalls will be much worse than they currently are.
>> That needs more testing though, I'll try to do some in the evening.
>
>
> Yeah I thought about that, but usually games that do that don't link all
the
> shaders at run time just some of them, and since shaders are often linked
> into different programs, and we can detect and skip shaders that have been
> compiled before we shouldn't hit too many that need to be optimised.
>
> And as always with shader cache the pain is only on the first run and then
> its all positives for each run after that.
>
> That said any testing would be great, I'm fairly confident the impact
should
> be minimal. I'll send a v2 of the series out shortly with some fixes.

As promised, I've ran some games and all looks good, with subjective
load-a-level-on-cold-cache I haven't noticed any difference between before
and after the series. I've noted down some loading times, *_lvl ones load
some level from the main menu I have saves in that game, the remaining ones
are game startup times:

               before    after
               cold hot  cold hot
DeusExMDbench: 285  34   261  27
Talos:         20   20   18   17
L4D2_lvl:      19   19   19   18
AlienIsl:      27   18   24   17
AlienIsl_lvl:  47   26   43   23
SOMA:          14   14   14   14
SOMA_lvl:      13   13   13   13
TombR_lvl:      7    5   7    5

As I don't feel like I know the code enough to fully understand the
changes, the series gets my
Tested-by: Grazvydas Ignotas <notasas at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170328/50bcfbf7/attachment.html>


More information about the mesa-dev mailing list