-
Notifications
You must be signed in to change notification settings - Fork 548
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
Pipeline caches on DX12 #2877
Comments
Howdy, I would like to work on this if it is not being worked on currently. |
It's not being worked on, but still very much needed. Your help is much welcome! |
Regarding the data parameter in the create_pipeline_cache. As the cache needs to be loaded from disk, I was thinking of passing the file path via the data parameter. This provides two scenarios that I could think of:
I am in favor of option 2, but that would mean that a Is option 2 one way of doing it and having the data parameter be used as a file path or is there another option that I am completely unaware of? A thought just occurred to me: will having data be used for the file path break code compatibility across backends? (I am fairly new to Pipeline Caches, so there could be some things I may be missing. If there are any documents or articles that you recommend I read, please feel free to share) |
Hi, just to let you know I've started looking into this since it seems to be free |
A few things came up unexpectedly in the last few weeks which meant I had basically no free time but I'm back working on this now |
Ok I've been reading the D3D12 documentation and I think I'm pretty clear on that but I've a question on the gfx-rs API. In the dx12 So should I continue trying to use |
You'd declare a struct with stuff inside. There is no ready to go implementation for you, or otherwise this bug would be closed long ago. The struct would need to contain some sort of a hashmap from D3D12 pipeline states to D3D12 blobs.
This is an entirely different thing, unrelated to the problem at hand. It should be renamed to avoid confusion. In general, looking at #3719 should give you a rough idea :) |
Perfect that clears things up, thanks! |
Just a small update since it's been a while, I have the basic functionality of saving / loading the cache to and from disk done I think but I'm getting an invalid argument error when I actually try to use the cached blob so I'm pretty much just debugging that now |
There's been a bit of a disaster. So last Saturday I was on my laptop then all of a sudden it turned off.....and hasn't turned on since, won't charge either just dead like I have to write this from my work laptop. I actually had this task pretty much finished I think but of course I didn't back it up by pushing any changes to my fork so they're gone basically. If this is still free by the time I get set up with a new laptop I'll actually finish it then, but that could be weeks. |
That's unfortunate! Hope you can recover anything. |
We have the API for pipeline caches, but the backends don't yet fully implement it. See create_graphics_pipeline signature and other use of
PipelineCache
.D3D12 could store the pipeline blobs in the cache: https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ns-d3d12-d3d12_cached_pipeline_state
We'd need to be able to save/load that cache from disk, as well as properly select one (of those saved in the
PipelineCache
implementation) when a new pipeline is created:The logic of the backend, when creating a pipeline with the cache provided, would need to be the following:
HashMap<PipelineState, D3D12_CACHED_PIPELINE_STATE>
owned by the pipeline cache.D3D12_ERROR_DRIVER_VERSION_MISMATCH
orD3D12_ERROR_ADAPTER_NOT_FOUND
, issue awarn!
message accordingly and proceed again but without using theD3D12_CACHED_PIPELINE_STATE
.Note: pipeline caches are internally synchronized, so any mutation of them should be done behind a sync structure, such as
RwLock
orMutex
. Alternatively, if you feel courageous, may try Kudzu like explained in #2860Marking as high priority because it is requested by the Szeged team in order to speed up WebRender startup when running on DX12. cc @zakorgy
The text was updated successfully, but these errors were encountered: