WebGPU should tell garbage collection / cycle collection that GPUDevices are expensive
Categories
(Core :: Graphics: WebGPU, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox163 | --- | fixed |
People
(Reporter: jimb, Assigned: jimb)
References
Details
Attachments
(1 external file)
WebGPU CTS test runs that create many GPUDevices can run out of memory because cycle collection takes too long to get around to freeing them.
For example, the fix for bug 1870699 caused the webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:* test to start encountering the error:
assert_unreached:
EXCEPTION: OperationError: Not enough memory left.
Reached unreachable code
As explained in this comment, we suspect that this is because 1870699 allowed the test to make progress faster than usual, such that GC/CC did not naturally clean up GPUDevices from prior test variants.
To address this, we should give GC/CC a more accurate assessment of the memory cost of a GPUDevice.
| Assignee | ||
Comment 1•4 days ago
|
||
Preparation for bug 1870899, poll from a thread:
A device's GPU-side resources are freed only when its id is dropped,
which waits for its GPUDevice to be garbage collected, even if content
has already called destroy(). With polling no longer tied to a 100ms
timer, device.lost resolves promptly after destroy(), so tests that
create and destroy many devices run much faster. On Windows,
webgpu:api,validation,capability_checks,limits,maxInterStageShaderVariables:createRenderPipeline,at_over:*
then fails: partway through, requestDevice starts reporting "Not
enough memory left", and soon does so for every remaining subcase. It
seems that destroyed devices accumulate faster than garbage collection
frees them.
Following the precedent of CommandEncoder (bug 1963926), overload
BindingJSObjectMallocBytes for Device to associate 32 MiB with each
GPUDevice wrapper, roughly the size of the shader-visible descriptor
heap that wgpu-hal's D3D12 backend allocates for every device. This makes
the JS engine schedule garbage collection sooner when many devices are
created.
Updated•4 days ago
|
| Assignee | ||
Comment 2•4 days ago
|
||
| Assignee | ||
Updated•4 days ago
|
Comment 5•3 days ago
|
||
| bugherder | ||
Comment 7•3 days ago
|
||
Reverted this because it was causing webgpu failures.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | /_mozilla/webgpu/cts/webgpu/api/validation/image_copy/layout_related/cts.https.html?q=webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:* | :method="CopyT2B";format="rg16sint";dimension="2d" - assert_unreached:
| Assignee | ||
Comment 8•3 days ago
|
||
Widened the expected fails for mac. Per bug 2094973, this failure is likely to jump around.
| Assignee | ||
Comment 9•2 days ago
|
||
Demoting webgpu:api,validation,image_copy,layout_related:required_bytes_in_copy:* to backlog on Mac.
try push
Comment 10•2 days ago
|
||
Comment 11•1 day ago
|
||
| bugherder | ||
Description
•