Skip to content

User-configurable gpuav indices_count#11581

Merged
spencer-lunarg merged 2 commits intoKhronosGroup:mainfrom
MennoVink:main
Feb 5, 2026
Merged

User-configurable gpuav indices_count#11581
spencer-lunarg merged 2 commits intoKhronosGroup:mainfrom
MennoVink:main

Conversation

@MennoVink
Copy link
Copy Markdown
Contributor

This can be used by apps using large amounts of draw commands to not run into the internal limit.
I have a test app that happens to end up using 8194 draw commands. The validation layers output an error because it's running into the internal invalid_index_command limit of 8191.

What else would be needed to get something like this through if at all?
I'm assuming documentation if this should be a public setting.
What do you think about the order in layer_options, i've added it as last, but now it's with DEBUG options, i'm not sure what the naming convention is here and how they should be grouped.

@MennoVink MennoVink requested a review from a team as a code owner January 29, 2026 14:16
@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

@spencer-lunarg
Copy link
Copy Markdown
Contributor

What else would be needed to get something like this through if at all?

I'm not against this, I need to look into this first more, I know we have a

const int kActionId_Mask = 0xFFFF << kActionId_Shift; // 64k slot

so 64k is an actual hard limit without more thinking

We have something similar with DebugPrintf where we give a warning and how to up the limit

message << "[WARNING] Debug Printf message was truncated due to the buffer size ("
        << gpuav.gpuav_settings.debug_printf_buffer_size << ") being too small for the messages consuming "
        << output_buffer_dwords_counts
        << " bytes.\nThis can be adjusted setting env var VK_LAYER_PRINTF_BUFFER_SIZE=" << output_buffer_dwords_counts
        << " or in vkconfig";

I'll leave comments, but one thing we will 100% need is a test that does over 8k draws and sets this new setting to ensure it is working (see NegativeGpuAVDescriptorClassGeneralBuffer, GPLWriteSelectPipeline as an example of how we can set settings per-test)

Comment thread layers/gpuav/core/gpuav_settings.h Outdated
Comment thread layers/gpuav/core/gpuav_settings.cpp Outdated
Comment thread layers/gpuav/instrumentation/gpuav_shader_instrumentor.cpp Outdated
Comment thread layers/layer_options.cpp Outdated
const char *VK_LAYER_GPUAV_DEBUG_DUMP_INSTRUMENTED_SHADERS = "gpuav_debug_dump_instrumented_shaders";
const char *VK_LAYER_GPUAV_DEBUG_MAX_INSTRUMENTATIONS_COUNT = "gpuav_debug_max_instrumentations_count";
const char *VK_LAYER_GPUAV_DEBUG_PRINT_INSTRUMENTATION_INFO = "gpuav_debug_print_instrumentation_info";
const char *VK_LAYER_GPUAV_INDICES_COUNT = "gpuav_indices_count";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const char *VK_LAYER_GPUAV_INDICES_COUNT = "gpuav_indices_count";
const char *VK_LAYER_GPUAV_MAX_INDICES_COUNT = "gpuav_max_indices_count";

lets go with max_ here now we are making it public facing

also move it above, away from, the DEBUG_ settings

Comment thread layers/layer_options.cpp Outdated
gpuav_settings.debug_print_instrumentation_info);
}

if (vkuHasLayerSetting(layer_setting_set, VK_LAYER_GPUAV_INDICES_COUNT)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

100% not obvious, but this is all generated/handled by having it in the VkLayer_khronos_validation.json.in file, so will need to add it there

then run python3 scripts/generate_settings.py to generate the logic needded

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you sure? I'm running that script and layer_options.cpp doesn't change. Also the only occurances of "vkuHasLayerSetting" are in this file, i would expect it to be present as string somewhere in the generation scripts.

@spencer-lunarg
Copy link
Copy Markdown
Contributor

@MennoVink also feel free to reach out to me via the Khronos Discord/Slack (or email) if you want to discuss this more offline

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 637900.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 22337 running.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 22337 passed.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

Comment thread layers/VkLayer_khronos_validation.json.in Outdated
@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@MennoVink
Copy link
Copy Markdown
Contributor Author

I've added the new setting to VkLayer_khronos_validation.json.in. I gave it the range minimum of 0 to turn it into an unsigned integer. Giving it a max of 65535 is not how i'm supposed to limit against kActionId_Mask i'm assuming? I dont see a bounds check appearing when i build vvl_codegen.
Also please look if i've added the setting in the right location. It's now in validation_control.settings->gpuav_enable.settings->gpuav_shader_instrumentation.settings but also affects maximum draw/dispatch calls so might not belong in the shader instrumentation group but in the gpuav_enable group directly?

I've added test NegativeGpuAVDescriptorIndexing::MaxDispatchCount, but i need some help here. Most importantly with solving it still failing intermittently. I dont quite understand yet how the layer's queue system works, but my hunch is that i have to wait for queue retirements? These overflow errors are generated asynchronously so might not have fired yet. A thread sleep doesn't seem to help though so maybe it's another issue.
Another point of interest is why i'm getting the overflow error twice or never. I'd like to get it one time.

MennoVink and others added 2 commits February 5, 2026 14:10
This can be used by apps using large amounts of draw commands
to not run into the internal limit.
@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

Author MennoVink not on autobuild list. Waiting for curator authorization before starting CI build.

@spencer-lunarg
Copy link
Copy Markdown
Contributor

@MennoVink so first off, thanks again for this PR

I made some tweaks and pushed up a new commit on your branch, but this looks good to go!

Giving it a max of 65535 is not how i'm supposed to limit against kActionId_Mask i'm assuming?

yes, 100% no obvious, added a warning/check/test for that

so might not belong in the shader instrumentation group but in the gpuav_enable group directly?

yep agree, removed that requirement from the json

I've added test

So we actually have a few tests already that are checking when the limit is hit (they are done in a way to not bring down the CI machine when we inject invalid behavior by using the Robustness checks)

what I wanted (and I just modified it) was I wrote a test where it we set gpuav_max_indices_count to above 8k and now can confirm the validation works there


Also I realize how non-obvious if you set the max to 16000 that the limit is really still 15999 because we use the last value as the "this is invalid" ... so I flipped it around, so the default is 8191 ... classic off-by-1 stuff lol

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 641245.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 22373 running.

@ci-tester-lunarg
Copy link
Copy Markdown
Collaborator

CI Vulkan-ValidationLayers build # 22373 passed.

@spencer-lunarg spencer-lunarg merged commit 9e65c05 into KhronosGroup:main Feb 5, 2026
22 checks passed
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.

4 participants