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

-[MTLCommandBuffer commit] may be called while encoding is still in progress #28680

Conversation

mwyrzykowski
Copy link
Contributor

@mwyrzykowski mwyrzykowski commented May 16, 2024

03357c1

-[MTLCommandBuffer commit] may be called while encoding is still in progress
https://bugs.webkit.org/show_bug.cgi?id=274275
<radar://128201828>

Reviewed by Dan Glastonbury.

Ensure we don't leave encoders open or commit command buffers
before encoding has ended.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274275-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274275.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::endEncoding):
(WebGPU::CommandEncoder::runClearEncoder):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.mm:
* Source/WebGPU/WebGPU/Queue.h:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::~Queue):
(WebGPU::Queue::ensureBlitCommandEncoder):
(WebGPU::Queue::finalizeBlitCommandEncoder):
(WebGPU::Queue::endEncoding const):
(WebGPU::Queue::setEncoderForBuffer):
Centralize endEncoding calls.

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

e5bb4b0

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2 βœ… πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl ❌ πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
  πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-cairo
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress ❌ πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ›  jsc-armv7
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-armv7-tests

@mwyrzykowski mwyrzykowski self-assigned this May 16, 2024
@mwyrzykowski mwyrzykowski added the WebGPU For bugs in WebGPU label May 16, 2024
@mwyrzykowski mwyrzykowski force-pushed the eng/-MTLCommandBuffer-commit-may-be-called-while-encoding-is-still-in-progress branch from e6abd5f to 383923a Compare May 16, 2024 21:53
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 17, 2024
…rogress

WebKit#28680
<radar://128202303>

Reviewed by NOBODY (OOPS!).

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 17, 2024
https://bugs.webkit.org/show_bug.cgi?id=274289
<radar://128202303>

Reviewed by NOBODY (OOPS!).

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):
@mwyrzykowski mwyrzykowski requested a review from djg May 17, 2024 23:19
Copy link
Contributor

@djg djg left a comment

Choose a reason for hiding this comment

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

:shipit:

{
id<MTLCommandEncoder> currentEncoder = encoderForBuffer(commandBuffer);
if (currentEncoder != commandEncoder)
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it an error to try close the non-current encoder? Should it be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not currently because we automatically stop encoding when the website attempts to leave more than 64 open encoders.

It would seem we should never reach this if we remove that logic dependent on the outcome of gpuweb/gpuweb#4622

@mwyrzykowski mwyrzykowski force-pushed the eng/-MTLCommandBuffer-commit-may-be-called-while-encoding-is-still-in-progress branch from 383923a to e5bb4b0 Compare May 20, 2024 17:21
@mwyrzykowski mwyrzykowski added the merge-queue Applied to send a pull request to merge-queue label May 20, 2024
@webkit-commit-queue webkit-commit-queue force-pushed the eng/-MTLCommandBuffer-commit-may-be-called-while-encoding-is-still-in-progress branch from e5bb4b0 to 6860782 Compare May 20, 2024 19:55
…rogress

https://bugs.webkit.org/show_bug.cgi?id=274275
<radar://128201828>

Reviewed by Dan Glastonbury.

Ensure we don't leave encoders open or commit command buffers
before encoding has ended.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274275-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274275.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::endEncoding):
(WebGPU::CommandEncoder::runClearEncoder):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.mm:
* Source/WebGPU/WebGPU/Queue.h:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::~Queue):
(WebGPU::Queue::ensureBlitCommandEncoder):
(WebGPU::Queue::finalizeBlitCommandEncoder):
(WebGPU::Queue::endEncoding const):
(WebGPU::Queue::setEncoderForBuffer):
Centralize endEncoding calls.

Canonical link: https://commits.webkit.org/279008@main
@webkit-commit-queue
Copy link
Collaborator

Committed 279008@main (03357c1): https://commits.webkit.org/279008@main

Reviewed commits have been landed. Closing PR #28680 and removing active labels.

@webkit-commit-queue webkit-commit-queue force-pushed the eng/-MTLCommandBuffer-commit-may-be-called-while-encoding-is-still-in-progress branch from 6860782 to 03357c1 Compare May 20, 2024 19:56
@webkit-commit-queue webkit-commit-queue merged commit 03357c1 into WebKit:main May 20, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 20, 2024
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 20, 2024
https://bugs.webkit.org/show_bug.cgi?id=274289
<radar://128202303>

Reviewed by NOBODY (OOPS!).

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):
mwyrzykowski added a commit to mwyrzykowski/WebKit that referenced this pull request May 20, 2024
https://bugs.webkit.org/show_bug.cgi?id=274289
<radar://128202303>

Reviewed by NOBODY (OOPS!).

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):
webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 21, 2024
https://bugs.webkit.org/show_bug.cgi?id=274289
<radar://128202303>

Reviewed by Dan Glastonbury.

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):

Canonical link: https://commits.webkit.org/279018@main
webkit-commit-queue pushed a commit to mwyrzykowski/WebKit that referenced this pull request May 21, 2024
https://bugs.webkit.org/show_bug.cgi?id=274289
<radar://128202303>

Reviewed by Dan Glastonbury.

ensureBlitCommandEncoder needs to ensure the encoding hasn't
ended otherwise a new blit command encoder needs to be created.

Depends on WebKit#28680 for the test
to pass.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/fuzz-274289-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-274289.html: Added.
Add regression test.

* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::ensureBlitCommandEncoder):

Canonical link: https://commits.webkit.org/279026@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebGPU For bugs in WebGPU
Projects
None yet
4 participants