D3D12.X: per-queue worker dispatch and atomic 64-bit immediate writes (#1488) #1633
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1643"
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 ivall/xcl. Originally posted by slopgobblercobbler on 2026-11-24T18:35:25Z.
Summary
Implements dedicated per-queue worker dispatch and atomic 64-bit immediate writes in
crates/xcl/src/hle/d3d12x/cpu_writes.rsandlist_x.rs(Issue #1488, findingXCL-BT-003):xcl-cpu-writesworker thread handled writes across all command queues.spawn_queue_worker), ensuring independent command queues make forward progress without blocking each other while preserving strict in-queue FIFO ordering.Write::ImmediateU64(usize, u64)and updatedwrite_nowto commit 8-byte aligned word pairs as a single atomicu64viaAtomicU64::store(..., Ordering::Release).list_x.rs, recordsWrite::ImmediateU64directly for 64-bit bottom-of-pipe writes to title memory, preventing 64-bit tearing under concurrent title polling.atomic_64bit_write_ordering: Validates atomicu64store without tearing under high-frequency concurrent polling reader.independent_queues_do_not_head_of_line_block: Validates that an unblocked command queue executes immediately (< 3s) without being head-of-line blocked behind a stalled command queue waiting on an unsignalled fence.Changes
crates/xcl/src/hle/d3d12x/cpu_writes.rs: per-queue worker dispatch channels, atomic 64-bit stores, and regression tests.crates/xcl/src/hle/d3d12x/list_x.rs: emitWrite::ImmediateU64for 64-bit immediate writes.Tested
cargo test -p xcl -- cpu_writes: 5 passed, 0 failed.cargo test -p xcl -- list_x: 27 passed, 0 failed.upstream/main(c160d86), GPL-2.0-only compliant, zero retail game data or keys.Not Tested
AI Use
Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:37:47Z.
Review: COMMENTED
AI-assisted review; I traced the fence-value and channel-enqueue ordering.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:37:47Z.
Code review location:
crates/xcl/src/hle/d3d12x/cpu_writes.rs; line 180The fence value and
Signalare serialized underQUEUES, but the job is sent after that lock is released. Two concurrentafter()calls can therefore signal values 1 then 2 yet enqueue job 2 before job 1. Once the fence reaches 2, the worker can apply the newer payload and then overwrite it with the stale value-1 payload, violating the per-queue FIFO guarantee. Please keep enqueue order serialized with fence-value assignment (or use another ordering mechanism). AI-assisted review; I verified the race from this call sequence.Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T19:33:26Z.
Regression run for this PR: head
7711f4c, based onmainc160d86. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
c160d86:this PR:
No device removals or crashes; 99 % of main's frames, 98 % of its peak commit.
Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies from run to run, so it says little about this PR.
Not tested: the whole suite; whether the title reaches the changed code in these 60 s.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:06:51Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by throny on 2026-11-24T23:07:08Z.
Two contributors checked independently and found that #562 solves the same problem in a different way: #1607, group D63. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T17:00:45Z.
Two contributors checked independently and found that #562 #1819 solves the same problem (for #1488) in a different way: #1607, group D89. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:42:22Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:22:38Z.
Triage (#1607) – head
7711f4c#562 (first, smallest) and #1819 also give each command queue its own
cpu_writesworker. This PR also writes 8-byte-aligned dword pairs as one 64-bit atomic store. #1819 does that only for a 2-dword immediate, and adds write-validity checks and aResetEvent.cpu_writes.rs: main now has
forget_queue(QueueId)(called from present.rs when a queue retires), which removes the queue'sFENCESentry. Renaming it toQUEUESconflicts. On rebase, keep main'sforget_queueso that dropping the entry'stxends that queue's worker. Otherwise there is one thread per queue address for the whole run.list_x.rs:
Write::ImmediateU64does the same aswrite_now's new pairing, so one of the two is enough.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.