[webkit-changes] [WebKit/WebKit] 1ab394: [WebGPU] Buffer synchronization is implemented inc...

mwyrzykowski noreply at github.com
Fri Nov 3 12:14:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1ab3947e3854e90ab6b5b114ab1138b2d7804bad
      https://github.com/WebKit/WebKit/commit/1ab3947e3854e90ab6b5b114ab1138b2d7804bad
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2023-11-03 (Fri, 03 Nov 2023)

  Changed paths:
    M Source/WebGPU/WebGPU/Buffer.mm
    M Source/WebGPU/WebGPU/Queue.h
    M Source/WebGPU/WebGPU/Queue.mm

  Log Message:
  -----------
  [WebGPU] Buffer synchronization is implemented incorrectly leading to data races between the CPU and GPU
https://bugs.webkit.org/show_bug.cgi?id=264111
<radar://117869389>

Reviewed by Tadeu Zagallo.

Some of the CTS tests write to a buffer via copyBufferToBuffer or
similar methods which uses an MTLBlitCommandEncoder and then they
immedietly map the buffer contents with GPUBuffer.getMappedRange
which returns buffer.contents.

However it is not safe to access buffer.contents prior to the command
buffers being completed, so wait for these to complete prior to returning
from getMappedRange.

* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::Buffer::getMappedRange):
* Source/WebGPU/WebGPU/Queue.h:
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::Queue):
(WebGPU::Queue::commitMTLCommandBuffer):
(WebGPU::Queue::waitUntilIdle):

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




More information about the webkit-changes mailing list