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

Validate invalidation of submitted command buffers #3716

Merged
merged 3 commits into from
May 22, 2024
Merged

Conversation

toji
Copy link
Member

@toji toji commented Apr 26, 2024

Adds validation to ensure that submit invalidates command buffers. I'm surprised this didn't exist before, but I'm unable to find any tests that attempt that specifically. Also makes a small utility for creating command buffers to make these tests a bit more terse and easy to write.

Last two checks in this test assume that we change the spec for submit() as proposed in gpuweb/gpuweb#4608 and discussed in gpuweb/gpuweb#4599.


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

Copy link
Collaborator

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

lgtm % standardization, one request

mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 21, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by NOBODY (OOPS!).

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):
@toji
Copy link
Member Author

toji commented May 21, 2024

Rebased and split the tests as requested. Spec change was approved and landed in the last WG call, so this is ready to land now once reviewed.

webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 21, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):

Canonical link: https://commits.webkit.org/279084@main

// Submit should fail because on of the command buffers is invalid
t.expectValidationError(() => {
t.device.queue.submit([cb, cb_invalid]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm... any way we could verify that cb doesn't execute? Maybe a new test as a follow-up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, though I am inclined to do that as a follow up.

src/webgpu/api/validation/queue/submit.spec.ts Outdated Show resolved Hide resolved
@toji toji enabled auto-merge (squash) May 22, 2024 16:39
@toji toji merged commit 9af84b8 into main May 22, 2024
1 check passed
@toji toji deleted the submit-validation branch May 22, 2024 16:41
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 22, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 22, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):
webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 23, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):

Canonical link: https://commits.webkit.org/279177@main
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 23, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):
webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 23, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):

Canonical link: https://commits.webkit.org/279235@main
webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 23, 2024
…he submit call succeeds

https://bugs.webkit.org/show_bug.cgi?id=274244>
<radar://128177642>

Reviewed by Dan Glastonbury.

Invalidate all command buffers passed to GPUQueue.submit, regardless
of whether or not they get committed.

Fixes the test being added in gpuweb/cts#3716

Reland with regression fixed and test enabled.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::invalidateCommandBuffers):
(WebGPU::Queue::submit):

Canonical link: https://commits.webkit.org/279243@main
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.

None yet

2 participants