Troubleshoot - unexpected results when testing shader caching

53 views
Skip to first unread message

roy cabouly

unread,
Sep 6, 2020, 8:09:05 AM9/6/20
to Graphics-dev
Hi,
I am trying to learn the chromium code that relates to shader caching.
I have done a test to see the actual results that should come when shaders are cached (e.g lower time to compile and link the program).

The test compile and links 40 different programs. The first time I ran it I saw it took ~200ms for each program to link, and in other times I ran it on the same chrome instance , it took ~5ms. so far so good.

But when I closed the chrome instance, opened it again and ran my test again, it took (again) ~200ms, as if the shaders weren't cached in disk. 
Why does it happen? I couldn't see any policy that is implemented in shader_disk_cache or in program_cache_manager that could cause it to not be cached on disk.

Another unexpected result I got was that when I ran chrome with flag --disable-gpu-program-cache, and ran the test twice, the second time the programs still linked very fast (~5ms) as if they were cached in memory. (I saw in code that when this flag is supplied the MemoryProgramCache doesn't get created so its weird that it happens).

Sure there must be something wrong on how I understood the code maybe or something else so I would really appreciate if someone can help me out (maybe point me to places where I can read more about the shader caching).

I will note that I run all my tests on windows 10, 64 bit.

Not sure this is the right place to ask for help in troubleshooting like this, so if not maybe you can point me out to a place where I could get help?

Thanks a lot, Roy

Brian Osman

unread,
Sep 6, 2020, 10:26:25 AM9/6/20
to roy cabouly, Graphics-dev
You mentioned that your test compiles and links a specific number of programs - are you testing this with WebGL? If so, those shaders do not go through Skia, so GrShaderCache isn't used (I think). I don't know the entire stack, but you may be encountering the results of a different (in memory) cache being used by ANGLE. (Or possibly just a driver cache tied to the process?)

--
To unsubscribe from this group and stop receiving emails from it, send an email to graphics-dev...@chromium.org.

yang gu

unread,
Sep 6, 2020, 11:10:07 AM9/6/20
to Graphics-dev, Brian Osman, Graphics-dev, roy cabouly
You didn't mention your GPU. If it's Intel platform, Intel driver used to have an issue to cache the shader in the place where Chrome couldn't read due to sandbox. Later on, Intel fixed it in new driver and Chrome also worked around it, given driver could not be widely adopted soon. Recently Chrome introduced a new GPU sandbox "AppContainer", and maybe it will break some assumption again. 
Can you please report a Chrome issue (https://bugs.chromium.org/p/chromium/issues/entry) with your findings? And please also attach your about://gpu. We will follow up. Thanks!

roy cabouly

unread,
Sep 6, 2020, 12:07:40 PM9/6/20
to Graphics-dev, yang gu, Brian Osman, Graphics-dev, roy cabouly
thanks a lot!!
I have made 2 issues, one regarding to the problem where the shader disk cache doesn't seem to work (https://bugs.chromium.org/p/chromium/issues/detail?id=1125363),
and another one regarding the problem where using --disable-gpu-program-cache doesn't prevent caching (https://bugs.chromium.org/p/chromium/issues/detail?id=1125365)

yang gu

unread,
Sep 6, 2020, 8:14:39 PM9/6/20
to Graphics-dev, roy cabouly, yang gu, Brian Osman, Graphics-dev
Thanks for reporting the issues, and I will investigate them right now. 
Reply all
Reply to author
Forward
0 new messages