D3D12.X: keep an argument-ordering buffer per device #3685
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3685"
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 KDenKC on 2026-12-02T09:57:30Z.
fresh_indirect_argumentskeeps one buffer of XCL's own for reordering ExecuteIndirect arguments. It was a single (device, buffer) slot. A list of another device (two devices in one process, or a device made again) replaced it, and so dropped a buffer that lists already recorded on the first device may still use. Each device now keeps its own buffer, and the entry holds a reference to its device, so no other device can be made at the address it is keyed by while the entry exists.bmjask found this while reviewing #3317, whose indirect scaling-pipeline cache had the same kind of bug. It was a commit of #3317 until Foniass asked for the split (CONTRIBUTING: one logical change per PR).
Related: #3317.
What is in it (
hle/d3d12x/bind.rs)D3D12.X: keep an argument-ordering buffer per device(01de8f39):ARGUMENT_ORDERbecomes a map from the device's address to (device, buffer);argument_order_bufferlooks up and inserts by device.argument_order_buffers_are_kept_per_device. The hardware device and WARP each get their own buffer, and the first device's buffer is still its own after the second one asked. It fails with the single slot.Tested
01de8f39:cargo test --workspace --no-fail-fast -- --test-threads=4: 2902 passed, 5 failed, 51 ignored. The 5 fail onmain1c8b5514too:title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3stream_recheck_*tests, and e2etest_title_runs_and_game_folder_is_untouched.uma_drivercoherent-window remake tests, as on every run on this machine.-- argument_order_buffers_are_kept_per_device: 1 passed (as part of #3317's head444aa227, the same code).Regression run
Smoke arm: the #3685 head vs the REUSED gate-batch-t main block (main
1c8b5514): 600 s each, JIT (XCL_PREPARE=0), seed copy of main-full-d8bd + the r18-terms data seed (2026-12-02 03:17, RTX 5090)main: 1724 frames, removals 0, peak commit 47581 MB
01de8f39e9: 1994 frames, removals 0, peak commit 48132 MB (main: 1724 frames, removals 0, peak commit 47581 MB)) -Not tested
AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T10:00:06Z.
Review (head
01de8f39, diff read, not a merge-check; draft, checks red):No problems found in the diff. This is
444aa227from #3317 split out (only the commit message differs):ARGUMENT_ORDER(bind.rs~3956) is now one buffer per device keyed by its address, with the entry holding a reference to the device so the key cannot be reused while the entry exists, and a list of another device no longer replaces a buffer the first device's recorded lists may use.argument_order_buffers_are_kept_per_devicechecks it with the hardware device and WARP (it fails with the single slot). Note the test leaves both devices in the process-wide map for the rest of the test run. Thexcl-smokeblocks are owed (the reasonPR descriptionis red).AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-02T12:13:02Z.
merge-check
base:
df0cfef638head:
01de8f39e9merge: clean (local trial merge 19b1b0fa296c83131b26029927309edd9a35dd12);
git diff --check origin/main..HEADcleanbuild:
cargo build --workspace-> ok;cargo build --release -p xcl-> ok on both clean treestests:
cargo test --workspace --no-fail-fast -- --test-threads=4-> 2,912 passed, 0 failed, 51 ignored across 43 test targets; 24SKIPPEDnotices (22 no wave64, 2 heap windows not enabled). The newargument_order_buffers_are_kept_per_devicetest passed on the NVIDIA device and WARP.review: Read the whole merged diff (one file, +41/-4). The cache now retains the first buffer for each device and a strong reference to that device, so another device cannot replace a buffer already used by recorded lists or reuse its address as a cache key. #3317 has split this change out. No blocking correctness issue found. The map retains one entry per device for process lifetime; repeated device creation and AMD/Intel execution were not tested here.
performance: Matched 60 s release smoke: 1,674 -> 1,678 frames (+0.24%); peak commit 16,944 -> 17,617 MB (+673 MB, +3.97%); both exited 0 with zero device removals and crashes, and the last three 2 s present counts were 60 60 60. The cache change adds a lookup on the argument-buffer path and retains one buffer per device; the short smoke cannot isolate its memory cost from run variation.
verdict: safe to merge: the current-main merge is clean, the complete suite has no failures, the two-device regression passes, and the matched smoke meets the repository's frame and memory thresholds. No unresolved critical finding in the diff.
hardware / tool and model: NVIDIA GeForce RTX 3080 Ti (driver 621.40), AMD Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC / OpenAI Codex (GPT-6 Sol)
Generated smoke blocks from
scripts/smoke.ps1with the same title label and settings:Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T14:15:11Z.
merge-check
base:
5eaadb54c1head:
01de8f39e9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2975 passed, 0 failed, 52 ignored (base: 2974 passed, 0 failed, 52 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none
review: read the whole diff (1 file, +41 -4). No problem found.
argument_order_buffers_are_kept_per_devicealone: 30 of 30, on the RTX 3060 and WARP, not skipped. With the old single-slot behaviour put back it fails ("the first device's buffer was not replaced").bind::testsmodule at 8 threads flakes with and without this PR. Not this PR:later_queue_completion_during_sleep_reclaims_before_wait_deadline, 3 failures in two other buffer-reclaim tests;performance: a map lookup under the lock that was already taken, once per ordered ExecuteIndirect. Not measured here; the author's smoke pair and thehollowedone's are within the limits.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T19:45:57Z.
Review: COMMENTED
AI-assisted review: GPT-6 helped inspect the cache; I checked the retention path in the current diff.
Imported from ivall/xcl. Originally posted by gut0to on 2026-12-02T19:45:57Z.
Code review location:
crates/xcl/src/hle/d3d12x/bind.rs; line 4060Medium: This process-global map retains a strong
ID3D12Deviceand its argument-ordering buffer for every device pointer, but the PR adds no removal path. If a title recreates its D3D12 device, each old device and buffer remains referenced; repeated recreations accumulate them for the process lifetime. Could entries be retired once no recorded command list can reference the buffer? AI-assisted review: GPT-6 helped inspect the cache; I checked the retention path in the current diff.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.