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

Shader Compilation Cache: Can serialize & deserialize ComputePipeline/ShaderModule #4812

Closed
nathanielsimard opened this issue Nov 30, 2023 · 2 comments

Comments

@nathanielsimard
Copy link

It would be highly beneficial to implement a mechanism for caching shader compilation on disk. This could involve making ShaderModule or ComputePipeline serializable/deserializable, thereby preventing the need to recompile each shader when launching an application.

While I don't have a specific solution to propose, I would be content as long as we could avoid recompiling all kernels on a device with a cache. It's worth noting that the cache could be tailored to the specifics of each Graphics API.

In our usage of wgpu as a backend in Burn (https://burn.dev), it would be particularly advantageous to avoid recompiling all compute shaders when launching a model for inference or training, as this would significantly reduce cold start times. Furthermore, I envision that game engines built on top of wgpu could also derive substantial benefits from incorporating such a feature.

@daxpedda
Copy link
Contributor

daxpedda commented Dec 1, 2023

Cc #3103.

@Wumpf
Copy link
Member

Wumpf commented Dec 2, 2023

Makes sense, but I think the issue daxpedda pointed out is indeed a duplicate

Btw. @nathanielsimard if you're on Vulkan you can already pass in a precompiled SpirV blob to save you the compliation step. But there is no platform indpeendent mechanism yet sadly!
https://docs.rs/wgpu/latest/wgpu/enum.ShaderSource.html#variant.SpirV

@Wumpf Wumpf closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants