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

True coherent memory on DX12 #3432

Closed
kvark opened this issue Oct 23, 2020 · 2 comments
Closed

True coherent memory on DX12 #3432

kvark opened this issue Oct 23, 2020 · 2 comments

Comments

@kvark
Copy link
Member

kvark commented Oct 23, 2020

Currently, we expose all CPU-visible memory types in DX12 as coherent.
However, it's documented in D3D12's Map() and Unmap() that they may (or need) to be used to invalidate/flush the memory regions, and that they can be nested. Judging by that, I think this is closer to our non-coherent memory than coherent one.

We may need to strip the coherency property from all the memory types we expose in D3D12 (Note: we already do this for D3D11). Alternatively, the command buffers would track the buffer transitions to and from HOST, and we could flush/invalidate the relevant resources at Submit() time.

In any way, what we have today appears incorrect. I'm just surprised we haven't seen any issues associated with this.,, I discovered this when looking at gfx-rs/wgpu#1002 but in the end it was a red herring.

@kvark
Copy link
Member Author

kvark commented Oct 31, 2020

Got an interesting clarification from Microsoft that this documentation is outdated, and memory is truly coherent. No Map/Unmap required.

@kvark kvark closed this as completed Oct 31, 2020
@ghost
Copy link

ghost commented Aug 24, 2021

@kvark https://software.intel.com/content/www/us/en/develop/articles/tutorial-migrating-your-apps-to-directx-12-part-3.html

3.4.4 Readback of GPU Data
We don’t want to encourage persistent map of readback (write-back) memory. You can keep it mapped, but before reading data that was written by the GPU, you should do another Map() with a range to ensure the cache is coherent. This is free on systems which don’t need it, but ensures correctness on systems which do.

JFYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant