Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pipeline data cache for OpenGL and D3D12 #7999

Merged
merged 4 commits into from Apr 20, 2019

Conversation

2 participants
@stenzek
Copy link
Contributor

stenzek commented Apr 15, 2019

Based on bug reports, it seems that some drivers (Intel and AMD) may not have their own disk cache for D3D12 pipelines. This was resulting in shader compilation occurring every time the emulator was booted.

This PR implements a pipeline data cache. "Cache data" can be used to assist a driver with creating pipelines by using previously-compiled shader ISA. Note that the pipeline data cache does not replace the UID cache, there is no guarantee that the cache data will be accepted by the driver.

I also extended this to OpenGL, using program binaries as the payload. This means for Android devices which don't have a disk cache, it will speed up game booting. Synchronous ubershader stuttering in D3D12 could also be improved, as the ubershader variants will be cached.

If any pipelines fail to create from the cache data, the entire cache is thrown out, and rebuilt from the UID cache. This means that driver updates won't cause duplicate entries in the cache :)

stenzek added some commits Apr 15, 2019

@Ebola16

This comment has been minimized.

Copy link
Member

Ebola16 commented Apr 16, 2019

With "Compile shaders before starting" enabled and after initial shader compilation:

D3D12 takes longer to start up than D3D11 on Windows 10.
Win 10 Pro x64
Intel Core i7-4702MQ CPU @2.20GHz
GeForce GT 750M
2x 8GB Hynix 1600MHz
GeForce Game Ready Driver 425.31

OGL takes significantly longer to start up than Vulkan on Android.
Samsung Galaxy Note8 (SM-N950U)
Qualcomm Snapdragon 835
Octa-core (4x2.35 GHz Kryo & 4x1.9 GHz Kryo)
Adreno 540
6GB RAM (LPDDR4)
Android 9
OpenGL ES 3.2 V@331.0

Is there anything that can be done about the slowness vs. other backends?

But still fixes:
D3D12: Shader recompilation occurs on every game startup
Android: Ubershaders appear to be completely recompiled every time

@stenzek

This comment has been minimized.

Copy link
Contributor Author

stenzek commented Apr 16, 2019

That is expected. DX11 has no pipeline compilation and this work can be deferred to the driver thread.

GL being slow on Android is probably just qcom's driver. It's the same on NV on desktop, the Vulkan compiler is faster, it's just not as noticeable. You shouldn't see shader compilation on every boot anymore, however.

@Ebola16

This comment has been minimized.

Copy link
Member

Ebola16 commented Apr 16, 2019

Alright, then this PR looks good function-wise. Thanks!

@stenzek stenzek merged commit c26f53b into dolphin-emu:master Apr 20, 2019

10 checks passed

default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details

@stenzek stenzek deleted the stenzek:pipeline-cache-data branch Apr 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.