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

Mark querypool slots as ENDED in vkCmdWriteAccelerationStructuresPropertiesKHR #2439

Merged
merged 2 commits into from
Dec 31, 2020

Conversation

MarijnS95
Copy link
Contributor

@MarijnS95 MarijnS95 commented Dec 30, 2020

vkCmdWriteAccelerationStructuresPropertiesKHR did not have the affected querypool slots marked as QUERYSTATE_ENDED, resulting in the following validation layer error when copying results out:

Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidQuery ] Object 0: handle = 0x7f54ecc529b8, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x46ab3a6e | vkCmdCopyQueryPoolResults(): Requesting a copy from query to buffer on VkQueryPool 0xff00000000ff[] query 0: waiting on a query that has been reset and not issued yet

This is simply fixed by marking the slots as containing valid data (QUERYSTATE_ENDED) in the PostCall handler.

Similarly it does not check whether every affected slot is in reset state like vkCmdWriteTimestamp, which has been added in PreCall.

EDIT: Are there any conventions regarding function sorting/ordering in cpp files and headers?


This issue was not previously noticed in our framework because we were not resetting the querypool prior to querying acceleration structure properties. Playing around with these calls uncovered a second issue: copying results from an uninitialized and un-reset (I think this is QUERYSTATE_UNKNOWN) querypool does not trigger validation layer errors. On NVidia that blocks indefinitely in the driver; afaik there should at least be a warning for that. After all the validation layer seems to check if this querypool slot can be made available by any command buffer submitted thus far, if I read the code correctly.

@CLAassistant
Copy link

CLAassistant commented Dec 30, 2020

CLA assistant check
All committers have signed the CLA.

@MarijnS95
Copy link
Contributor Author

Yikes, the CI also enforces 72-char limits in code blocks within commit messages (indended with 4 spaces)...

vkCmdWriteAccelerationStructuresPropertiesKHR did not have the affected
querypool slots marked as QUERYSTATE_ENDED, resulting in the following
validation layer error when copying results out:

    Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidQuery
    ] Object 0: handle = 0x7f54ecc529b8, type =
    VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x46ab3a6e |
    vkCmdCopyQueryPoolResults(): Requesting a copy from query to buffer
    on VkQueryPool 0xff00000000ff[] query 0: waiting on a query that has
    been reset and not issued yet

This is simply fixed by marking the slots as containing valid data
(QUERYSTATE_ENDED) in the PostCall handler.
Copy link
Contributor

@ncesario-lunarg ncesario-lunarg left a comment

Choose a reason for hiding this comment

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

Thanks @MarijnS95! Just one minor nit from me. I'll add @mark-lunarg as I'd like someone with more experience to have a look.

Internal CI running

if (!do_validate) return false;
bool skip = false;
for (uint32_t i = 0; i < accelerationStructureCount; i++) {
QueryObject query = QueryObject(QueryObject(queryPool, firstQuery + i), perfPass);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like

QueryObject query = {{queryPool, firstQuery + i}, perfPass};

Would be a bit more consistent with the rest of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was copied verbatim from ValidationStateTracker::SetQueryStateMulti. Looks like both methods are mixed in state_tracker as well as core_validation.

Changed this particular instance, but will leave it up to the maintainers to unify the other occurences :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@MarijnS95, yes, thanks for understanding, and thanks for the PR -- this is great!

As discovered and fixed in the previous commit
vkCmdWriteAccelerationStructuresPropertiesKHR did not set queries to
QUERYSTATE_ENDED. Likewise this function was also not checking whether
querypool slots have been reset first. Do so in PreCall.
@mark-lunarg
Copy link
Contributor

Thanks @ncesario-lunarg!

@mark-lunarg mark-lunarg merged commit 42519d4 into KhronosGroup:master Dec 31, 2020
@MarijnS95 MarijnS95 deleted the query-as-props branch December 31, 2020 15:20
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