PSO cache

Started by
4 comments, last by Alessio1989 8 years, 8 months ago

Does anyone knows how to cache a PSO in D3D12?

It provides an interface called GetCachedBlob returning serialized data which can be used to regenerate the same PSO later, so that developers can cook a PSO cache for accelerating the creation of PSOs.

My question is how to use the cached blob to regenerate the exact same PSO?

D3D12_GRAPHICS_PIPELINE_STATE_DESC includes an description called D3D12_CACHED_PIPELINE_STATE, however it failed to create the PSO if only the cached fields are filled. It still needs full description with the extra PSO cached state to regenerate the PSO.

Thanks

Advertisement
You'll likely have to wait until the final DX12 is officially released with final docs and samples.

Right now the people who know this cannot answer you without probably breaking NDAs; unless you're lucky enough to find someone who figured it out on his own (which is probably not a good idea because the information would be half-cooked).


Right now the people who know this cannot answer you without probably breaking NDAs; unless you're lucky enough to find someone who figured it out on his own (which is probably not a good idea because the information would be half-cooked).

This is pretty accurate. I know some EAP people have been very willing to help out with DX12 stuff around here, but generally speaking I'd assume that a lot of the people who are in the EAP or who got DX12 access through other means are sort of in a grey area when it comes to giving out information now the API is in this weird "available to the public, but not really" state; I feel that this is true for me at least, can't speak for anyone else.

Once it's released and once the people under NDA get a green light for speaking about it more openly you'll see a lot more info appear.

I gets all your texture budgets!

Here are the first public D3D12 samples (PSO cache sample included): https://github.com/Microsoft/DirectX-Graphics-Samples

The MSDN documentation is still not fully updated, but looks they are working on it too.

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

Now that the flood gates are being opened, I can answer.

The source code provided by the post above pretty much covers it. A couple of notes:

  1. You still need to fill all the values from the D3D12_GRAPHICS_PIPELINE_STATE_DESC, not just the blob pointer. The DX API is likely unable to read the blob, only the driver, thus it needs you to still fill this data.
  2. The cache is unique to a driver & GPU model.
  3. Because of the above, you have to check whether PSO creation out of cache succeeded. It can fail if the user updated his drivers or changed his GPU. You can see that the source code provided by MS is doing exactly this.
  4. Most of the time is spent compiling HLSL shaders to D3D bytecode ASM, which is an intermediary representation. You should cache this (which is GPU/driver agnostic) and that has been possible since DX11. PSOs go one step further by allowing you to cache the D3D bytecode -> ISA translation, which is usually fast, but still a nice bonus.

Note also that debug VS release build should also invalided the PSO cache, at least the due the Root Layout which should be different...

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

This topic is closed to new replies.

Advertisement