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

Fix OOM in Vulkan FetchShaderFeedback for descriptor binding's which use VariableDescriptorCount feature #3105

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

Zorro666
Copy link
Collaborator

Description

Previously the descriptorCount was being computed from the create parameters. This did not account for descriptor bindings which used the variable size feature and could lead to feedbackStorageSize being estimated to be too large and triggering OOM.

Added a test which has a descriptor binding set to UINT32_MAX at create time and then uses a variable count of 10,000.

The test fails before the code fix and the test succeed after the code fix.

Copy link
Owner

@baldurk baldurk left a comment

Choose a reason for hiding this comment

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

This looks good to me but I've made one note about how the test could more directly test what we want here.

VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT,
};
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT};
Copy link
Owner

Choose a reason for hiding this comment

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

Not required but if you add a , here after the last entry it formats the array a bit better with the closing brace on a new line.

@@ -64,6 +64,7 @@ def check_capture(self):
0: { 'dynamicallyUsedCount': 1, 'used': [15] },
1: { 'dynamicallyUsedCount': 6, 'used': [4, 19, 20, 21, 49, 59] },
2: { 'dynamicallyUsedCount': 2, 'used': [381, 386] },
3: { 'dynamicallyUsedCount': 0, 'used': [] },
Copy link
Owner

Choose a reason for hiding this comment

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

I think for this test to be robust we should ensure that one of the samplers in this descriptor set less than the count is actually used. Otherwise in future this test may not cover what we want it to e.g. if we statically determine that the shader doesn't use the descriptor set at all so we skip processing of it.

New Binding 3
Initial size is UINT32_MAX
Updated to be sized DESC_ARRAY3_SIZE
Used in the shader to ensure the binding is referenced

Stress tests the FetchShaderFeedback code when it computes the maximum size of feedbackStorageSize.
For variable sized descriptor sets compute feedbackStorageSize using the active descriptor set layout instead of the creation time data.
@Zorro666 Zorro666 merged commit bbd1fe6 into baldurk:v1.x Nov 1, 2023
16 checks passed
@Zorro666 Zorro666 deleted the small-fixes branch November 1, 2023 14:53
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.

2 participants