Repository navigation
Conversation
A deferred non-aperture Write64BitValue store runs on a CPU worker while the consumer-visible sync-cell fence advances in GPU submission order, so a consumer can be released onto memory the worker never stored; values for one cell produced on two queues also retire through independent workers with no shared ordering, letting an older store overwrite a newer one in memory. Classify registered sync-cell MARKER_OUT writes at the real interception path, retain them until the producer fence completes, and publish only what the stored watermark confirms: staleness decision, store, watermark update and publication are serialized in one critical section per cell, stale stores are suppressed, and late consumers backfill/retry. Queue release cancels strict jobs with a bounded grace; abandoned jobs never store or publish. Watchdog rescue policy unchanged. Measured on an RTX 3050 Laptop (real D3D12): 14/14 focused hardware tests pass in consecutive serialized runs; module regression delta exactly +14/0 against a pristine same-SHA baseline. Assisted-by: Devin CLI (SWE-2.1 Ultrafast Max)
|
FAILS on the Wine/vkd3d lane: 2 of the 11 new The two have different signatures:
Other nine
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge. — Devin |
bmjask
left a comment
There was a problem hiding this comment.
P1: deferred same-batch self-waits are still silently skipped. For a deferred registered sync-cell write then later wait, try_gpu_wait takes CycleSkip because list_writes contains the producer; execute_with_waits treats that as handled. But SyncU64 CPU store occurs only after the submission completes, so post-wait GPU commands run before the marker exists. The new deferred-aware check misses this self-wait branch. Split/submit at the wait or use another ordered mechanism; queue.Wait is not a simple fix because it would deadlock the worker. Add this exact regression.
|
Follow-up on the two Wine-lane reds from my earlier comment: re-tested this PR's Still So #2499's fix (watchdog not missing a wake armed during its check) does not cover these two. The shape that stays red on wine-11.0 / vkd3d-proton 3.1 is: a bridged Wait64 whose producer store is made on the CPU side never takes the memory-release path here, and the consumer-observation assertion at |
|
Thank you all for testing and reviewing this so quickly. Conversation comments and review summaries can't be threaded, so each section below links the item it answers. The PR stays a draft while these are open. @SlopTart: Wine/vkd3d report (comment)Thank you for the deterministic reproduction, and in particular for keeping the two signatures apart; that separation is what makes this actionable. Both are real findings, and nine passing tests do not offset them.
I will investigate these as two separate items: what released the consumer and what the copy read in the first, and why producer-side completion and the bridged wait do not progress on vkd3d-proton in the second. Both line numbers land on assertions inside the named tests at the PR head, which is why I read them as above. If your merged tree numbered them differently, the panic strings from the logs you already have would settle it; no rerun needed. @DavidM1911: RTX 3060 Ti run (comment)Thank you for the independent run on a second NVIDIA card. Acknowledged: This PR changes only One detail to pin down the tested tree: the message you quote ( @bmjask: P1 review (review)Thank you. This is a control-flow case the PR misses, and your description of it is exact. I traced it at head
That is a correctness gap against what this PR claims. The branch itself is inherited from main, but the deferred-aware check added here should have covered it. Agreed that I will write the exact regression first (deferred write, same-list wait, GPU work after it, through the production record and wait path), then look at an ordered split/submit at the wait or another mechanism that keeps queue order and cannot deadlock. So far this is traced by reading, not reproduced. The review stays open until a test shows the behaviour before and after. @SlopTart: follow-up with #2499 (comment)Thank you for the extra combined-tree run; it rules out something I would otherwise have had to guess at. Acknowledged: with this head, current main and #2499's armed-wake fix merged, the same two tests stay red with the same timings, so #2499 does not address them. I will keep two things apart. One is the watchdog missing a wake armed during its check, which is what #2499 fixes. The other is what you describe here: on wine-11.0 / vkd3d-proton 3.1, a bridged Wait64 whose producer store is made on the CPU side does not take the memory-release path, and the consumer-observation assertion fails outright rather than by timeout. Both stay on the list as separate items. AI use: written with Devin (Claude Fable 5.2 High) under human direction. Nothing in this comment is a new test result; the code reading above is of the PR head |
Review of the store-before-publication change (bmjask on xcl-dev#2439) found the control-flow gap: when a Wait64 on a sync cell is recorded after this list's own CPU-deferred Write64 of the awaited value and the record-time split cannot move the wait to a segment of its own (no wrapper, bundle, no allocator, segment budget), try_gpu_wait takes the same-batch CycleSkip and the wait is silently dropped - work ordered behind it executes before the deferred store exists in memory. Hoisting the wait before the list is no answer either: the strict store needs this list's own completion, so a GPU wait ahead of it deadlocks. The wait is now neither skipped nor hoisted: the list is submitted alone and the wait is enforced on the submission thread behind it, before anything after it. The producer retires independently, so the wait is bounded by the producer's completion (with the usual timeout fallback), not a deadlock. Waits recorded before their producing write keep the existing skip: no ordering can satisfy those and none is promised. Regression evidence on RTX 3050: without the fix the new d19_deferred_self_wait_is_not_dropped_for_following_work fails 3/3 runs with the CycleSkip log line and the copy behind the wait reading 0; with the fix both new tests pass 5/5 runs, d11 11/11 twice, d13 3/3, d3d12x module 260 passed / 1 failed (the pre-existing execute_indirect_reads failure, unchanged). The second test drives the same shape through a real title_list wrapper - the record-time split path - and proves the work recorded after the wait there is held by the bridged wait until the store publishes; it passes before and after, pinning the intended behavior of the main path. KickoffX shares the defect shape but no regression test drives that path yet; left as-is and reported. Assisted-by: Devin (SWE-2.1 Max) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@bmjask — follow-up on your P1 review (posted as a conversation comment because the review has no inline thread to reply under). Thank you again for identifying the same-batch self-wait case — the reproduction confirmed you were right that the ordering was silently lost, and commit Where the reviewed shape does not arise. Every title-created command list is wrapped ( Where it was genuinely broken, reproduced as you described. When the split cannot happen (no wrapper, bundle, unknown allocator, segment budget, The fix ( What is explicitly not solved, so you can judge scope honestly:
Does this resolve the P1 scenario you reported to your satisfaction, and are the two documented residual limitations acceptable for this PR's scope? I have not marked anything resolved — the thread is yours. Evidence detail is in the updated PR description (sections "Same-batch deferred self-wait" and "Known remaining limitations"). AI use as disclosed there: Devin CLI, SWE-2.1 Max. |
|
Wine/NVIDIA follow-through on
Both Platform: Wine11.0, RTX4060Laptop8GiB, NVIDIA590.48.1, DXVK3.1.1, diagnostic relaxed vkd3d-proton3.2.0 |
Open for design review — draft. The integration relationship with the existing deferred-Write64 work (#850, #562/#1643/#1819) is an open maintainer design question; coordination comment: #1607 (comment) — please read it before reviewing shape rather than detail.
What and why
On console,
Write64BitValue*progress values are written by the GPU itself in execution order, so a consumer that observes a fence value can rely on the memory content being present. XCL defers non-aperture writes to CPU worker threads, and for writes to registered sync cells two ordering defects result:0x0); with this change it reads the written value.The invariant this change implements: a deferred sync-cell value must not be published to consumers before the corresponding CPU store has actually completed.
What is in it
list_x.rs(+175 production, first commit): classify registered sync-cell MARKER_OUT writes at the realwrite64_bottom_xinterception path;stored_max/cpu_signaled_maxwatermark separation on the sync cell;sync_cell_deferred_storeserializing staleness decision + memory store + watermark update + publication in one critical section per cell; publication gating so the consumer-visible fence never leads confirmed stored memory; stale-store suppression; consumer publication retry and fence backfill for late consumers; signal suppression in the GPU path; cycle-break participation in the stored watermark.cpu_writes.rs(+144/−30): per-queue workers;Write::SyncU64carrying the cell generation; strict producer-fence completion for classified writes; confirmed-store contracts; queue-release cancellation with a bounded grace — abandoned jobs never store and never publish; bounded device-gone exit of the strict wait.list_x.rs(+30 production, second commit336c6c2): the same-batch deferred self-wait resolution — see below.Same-batch deferred self-wait (second commit
336c6c2, in response to review)bmjask's review found that a deferred sync-cell write followed by a wait on the same cell in the same command list can take
try_gpu_wait's same-batchCycleSkip— treated as handled — while the deferred CPU store only happens after submission, so work ordered behind the wait executes before the marker exists.Investigation refined the picture:
device_x.rswraps every title-created command list) and the record-time split moves such a wait into its own PC segment; the write and the wait never share a submission. This path already orders correctly — pinned byd19_title_list_self_wait_orders_the_work_recorded_after_it, which records write → wait → copy in ONE title list through a realtitle_listwrapper and proves the copy is held until the store publishes. It passes before and after the second commit.XCL_SPLIT_MIDLIST_WAIT=0) were the real defect: the wait stayed on the same list andCycleSkipsilently discarded it. Reproduced through the production chain —write64_bottom_x/wait64_x/execute_with_waits_on/signal_write64_fences/cpu_writes_after— ind19_deferred_self_wait_is_not_dropped_for_following_work.What
336c6c2does in the residual case: the wait is neither hoisted (a GPU wait before the list would deadlock — the strict store needs this list's own completion) nor skipped. The list is submitted alone, then the deferred self-wait is enforced on the submission thread — bounded by the existing 2 s wait timeout with a warning — before anything after it is submitted. Waits recorded before their producing write keep the existing skip: no ordering can satisfy those and none is promised. Submission granularity already varies in this path (batches are split around waits), so the solo submit is not a behavior change in kind.Known remaining limitations (not resolved cases)
wait_all_onbefore a single exec). It is deliberately unmodified: no production-path regression test currently proves the defect there, and this PR only fixes what is reproduced. It is a separate unclosed investigation.Wine/vkd3d reports (SlopTart) — investigated, not resolved
Two deterministic failures on Wine/vkd3d-proton 3.1, reproduced solo at
--test-threads=1and unchanged when combined with #2499:d11_consumer_cannot_observe_deferred_value_before_the_cpu_store— the dependent copy executes early and reads0x0(~0.42 s, no watchdog involvement).d11_publication_not_memory_releases_the_consumer— the store itself never lands within 5 s; the armed-wait watchdog releases at ~5.1 s as a symptom.Source-level analysis (no Wine lane was available for verification): both shapes are consistent with one backend divergence — on vkd3d-proton, device-side
queue.Waitnot observing host-sideID3D12Fence::Signalthe way native D3D12 does. This design depends on that behavior inherently: a CPU-side store can only ever be published by a CPU-side signal, and the only correct release path is host-side publication after the store. This is a hypothesis, not a proven universal cause — pinning it needs a Wine lane with vkd3d debug logging. The failures are not fixed; the tests are not weakened or skipped; on native Windows both pass deterministically (11/11 twice).RTX 3060 Ti recompiler report (DavidM1911) — exact-parent control negative
gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrierwas reported failing on RTX 3060 Ti. This PR touches onlycpu_writes.rs/list_x.rs. Control run on RTX 3050,cargo test -p xcl --lib gpu::recomp::lower_dxil -- --test-threads=1:2898511af1c038a2ef809719e9b6f89e5675c422→ 21 passed / 0 failedCurrent evidence does not attribute the failure to this patch. One provenance question remains open: the reported panic line (
lower_dxil.rs:1155, pre-c828d8cassertion text) does not match any tree this PR or its base could produce, so the reporter's exact tested SHA is unresolved and the hardware difference (3060 Ti vs 3050) cannot be excluded.Tested
Hardware: RTX 3050 Laptop, real D3D12, Windows. Base commit
2898511af1c038a2ef809719e9b6f89e5675c422(upstream main at branch creation). Test categories below are deliberately kept separate — they are not interchangeable evidence.Production-path regression tests, real hardware, at head
336c6c2eeafbef907e3d47c72624158a3c52f2d0(--test-threads=1throughout, deliberate: several tests share global injection slots):cargo test -p xcl --lib d19_→ 2/2, 5/5 consecutive runs; the same tests fail 3/3 runs on the same tree with only the enforcement logic reverted (fail-before proof: the copy behind the dropped wait reads0x0, with the exactskipped to avoid same-batch self-deadlocklog line)cargo test -p xcl --lib d13_→ 3/3cargo test -p xcl --lib d11_→ 11/11, two consecutive runscargo test -p xcl --lib hle::d3d12x(module regression) → 260 passed / 1 failed / 2 ignored — the one failure (bind::execute_indirect_reads_the_arguments_written_before_itatbind.rs:1225:13) is byte-identical on pristine upstream in a path this patch does not touchExact-parent controls:
gpu::recomp::lower_dxilmodule: base2898511a21/21 = head 21/21 (above)3f2777019544c0ada2cd294aa792d3c378ff0df8: module regression 258/1/2 vs pristine same-SHA baseline 244/1/2 — delta exactly the 14 added tests, zero collateralBackend-specific evidence (reporter's lane, not reproduced locally): Wine/vkd3d-proton 3.1 — two deterministic failures analyzed above, unresolved.
Injected-seam tests (clearly labeled
cfg(test)): device-removal worker exit and publication-failure injection are test-only seams at the decision boundary — not physical GPU removal, not production behavior.Not tested
scripts/smoke.ps1regression blocks not yet run (merge prerequisite; will produce them if this moves toward merge readiness).AI use
Implementation, tests, verification and this description prepared with Devin CLI, SWE-2.1 Max under human direction; all test counts are real executions on the hardware named. Multi-phase independent review of the invariants (line-cited), evidence-gap closure, and repeated forward-port verification preceded this PR.