d3d12: hold a label wait for a write that is still to run #398
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/398"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by MathiewMay on 2026-11-28T13:29:06Z.
Summary
A queue held on a fence label is released after five seconds (
STALLinruntime/d3d12/src/commands/memory_wait.rs), for the case where the work that should have written the label was dropped. The release did not look at what the title was doing, and a title can submit the list that waits on a label well before the list that writes it.ProjectScarlett does: in each frame it records the lists that write a set of labels, submits compute lists that wait on those labels, and submits the writing lists with the rest of the frame. When a frame takes longer than five seconds, the compute lists are released and run before the work they wait for. On
a880dfdits first frame that traces rays released four compute queues this way, while the stall report said "no submitted or rejected list writes it": the lists that write those labels were recorded and not submitted yet.A wait that old now holds while a write that satisfies it is still to run:
What the waiting queue itself was given does not count: it has run already, or it is behind the wait and cannot run before the wait ends. A list that is reset, rejected or destroyed holds no queue, and neither do the lists of a batch its queue rejects or drops. A wait nothing is going to satisfy is released after five seconds, as before.
The record is
commands/memory_wait/recorded_writes.rs: each label write a list records, with its value, kept while the list's recording is alive and then until the batch it was submitted in has run. It is consulted only once a wait is five seconds old, and then every 100 ms.This does not use the in-flight writes that wait elision keeps (
has_in_flight_write). Those hold ranges without values, any dispatch or draw makes a batch count as writing everything, and the waiting batch is itself in flight until its wait ends, so a wait would hold for itself.A title that records a write and never submits or resets that list now holds the waiting queue for good, where it was released after five seconds. A console holds it for good too.
Tested
Lanes scenario
cross-queue-late: the direct queue records a label write, the compute queue submits a list that waits for it, and the direct list is submitted 6.5 s later. The compute queue must not have run by then. Againstmain's provider it fails ("the compute queue ran before the direct queue wrote the label it waits on"). It adds 6.5 s to the Lanes run.Unit tests in
runtime/d3d12/src/tests/commands/recorded_writes.rscover the record: a recorded write holds until its list is gone, a submitted one until its batch has run, a write given to the waiting queue itself does not hold, and what has run or is gone is dropped.In ProjectScarlett, on
6f89916together with other changes of mine: over six minutes of frames that took 12 to 30 s each, at least 32 waits were held past five seconds, each ended when its write ran, and none was released. That run ended after ten minutes on an assertion in the title's resource loading, which I have not traced to a cause yet; the device was not lost.GPU, driver and backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, Linux 7.3, GE-Proton11-14 (
--backend proton).Commands run and their results:
The regression controls ran outside their Bubblewrap/
xvfb-runsandbox, which stalls on this machine (it has no Xvfb).Checks
No evidence JSON changes.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-28T14:19:42Z.
An NVIDIA data point for this PR. ProjectScarlett on an RTX 5090 (620.70.10, GE-Proton11-14), with this PR's commit cherry-picked into our integration build. Same caches and settings as our earlier runs.
CS_Prop_BatchCulldispatch until the device was lost.The run still ended in a GPU timeout (Xid 109), but somewhere else: inside a single mesh
ExecuteIndirecton the graphics queue, with group count (1,1,1). We're following that up on #232.