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 a workaround for typed buffer view memory explosion #349

Merged
merged 18 commits into from Nov 4, 2020

Conversation

HansKristian-Work
Copy link
Owner

@HansKristian-Work HansKristian-Work commented Oct 30, 2020

The overall idea is to bind typed views at aligned offsets and ranges, and rely on the offset buffer framework to make this work. This way we guarantee a reasonable upper bound for number of unique views that might exist per ID3D12Resource.

Fix #345.

Fixes this OOM condition on HZD and Death Stranding (and possibly others) on NVIDIA based on basic testing. There is no logging about ~1k views being created, where it would create at least 150k views before after a few minutes.

@doitsujin
Copy link
Collaborator

We need to check for VKD3D_TYPED_OFFSET_BUFFER in d3d12_descriptor_heap_init_data_buffer as well, or otherwise we won't create the offset buffer on AMD cards which currently leads to crashes.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This will lead to a crash if it goes too far.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
We will use it for typed buffers as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
It is used for typed as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
@HansKristian-Work
Copy link
Owner Author

@doitsujin Fixed on AMD. Tested AMD/NV test suite, RE2, HZD, DS. Renders fine.

Copy link
Collaborator

@doitsujin doitsujin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits, looks good otherwise.

libs/vkd3d/command.c Outdated Show resolved Hide resolved
libs/vkd3d/resource.c Outdated Show resolved Hide resolved
libs/vkd3d-shader/spirv.c Show resolved Hide resolved
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Offset buffer state might be the only relevant difference between two
descriptors. We won't need to copy descriptors, but the offsets must be.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Verifies that can we can spam unique typed views without problems ...

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
@HansKristian-Work HansKristian-Work merged commit f37254e into master Nov 4, 2020
@HansKristian-Work HansKristian-Work deleted the typed-buffer-offset branch November 4, 2020 18:05
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

Successfully merging this pull request may close these issues.

Workaround typed SRV/UAV buffer memory exhaustion when using VkBufferView
2 participants