D3D12.X: newer-layout console list and allocator slot fixes (#126/#127, #148) #3727
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3727"
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 Kalmarv on 2026-12-02T20:30:19Z.
Consolidates #3234 and #3235 into one clean, rebased PR (
gpu:both: platform-independent D3D12.X command-list slot routing and x64 ABI). Both #3234 and #3235 previously receivedverdict: safe to mergefrom @Foniass (#3234#issuecomment-7257709751, #3235#issuecomment-7257708546) and will be closed once this replacement PR is open.What is in it
RSSetShadingRate(#126) andRSSetShadingRateImage(#127) (crates/xcl/src/hle/d3d12x/real.rs):main(real.rs:1494-1497) already remaps older console#124 -> PC #77(RSSetShadingRate) and#125 -> PC #78(RSSetShadingRateImage), andreal.rs:11660-11663documents newer#126/#127as those two methods ahead of#129DispatchMesh, butNEWER_LIST_SLOTSomitted(126, 124)and(127, 125). Without them, newer#126fell into the console-extension stub and newer#127fell through into older#127(bind::dispatch_mesh).(126, 124)and(127, 125)toNEWER_LIST_SLOTS, resolve targets vianewer_list_target(checkingconsole_slotsthenconsole_remap -> pc[1 + p]), and extendnewer_layout_maps_dispatch_mesh_to_slot_129_not_128to assert#126,#127, and#129target resolution.#126(and#124in #1944, plusrestore_bindings) but do not cover#127(RSSetShadingRateImage). This PR provides the minimal direct PC#77/#78remap for both newer#126and#127(matchingmain's existing older-layout remap and stopping#127from misrouting intoDispatchMesh) without addingOPTIONS6gating, rate clamping, or state restoration across splits; maintainers can take this minimal remap directly or layer a capability-gated#124/#126handler on top while keeping(127, 125).UINTx64 ABI (crates/xcl/src/hle/d3d12x/bind.rs,console_list.rs,real.rs):HANDOFF.md(:396-397,:410,:423,:436) names command-list slot#148AllocateUploadMemory(size, alignment) -> CPU pointer(used byXboxBvhBuilder.dlland other console middleware).u32sizeandaligninbind::allocate_from_command_allocator_xandconsole_list::cl_allocate_upload_memory(widening tousizeinside the body) is defensive x64UINTregister hygiene so non-zero upper 32 bits inrdx/r8cannot turn a small allocation into a multi-GB failure.allocate_from_command_allocator_ignores_upper_32_register_bitscovering both the default command-list hook (bind) and theconsole_listhook with poisoned upper register bits (0xDEAD_BEEF_0000_0040,0xCAFE_BABE_0000_0020).Tested
rustc 1.99.0 (b940084d7 2026-09-28), DXC1.9.2609.5(XCL_DXC_DIRfor builds/tests; Windows SDK DXC forscripts/smoke.ps1).cargo build --release -p xcl):origin/main(5ad98adbc) = 39 warnings; PR head (7d99466f5) = 39 warnings (0 new warnings)..\scripts\test.ps1— runscargo build --workspace,cargo bench -p xcl --bench '*' -- --test, andcargo test --workspace -- --test-threads=4): 44 targets, 3006 passed, 0 failed, 52 ignored, 24 SKIPPED (22 no wave64 on RTX 5070 Ti, 2 no heap windows). Both new/updated unit tests ran and passed:hle::d3d12x::real::queue_tests::newer_layout_maps_dispatch_mesh_to_slot_129_not_128 ... okhle::d3d12x::console_list::tests::allocate_from_command_allocator_ignores_upper_32_register_bits ... okscripts/smoke.ps1(title: ea3b5e4d, release):origin/main(5ad98adbc) logged[STUB] d3d12_xs.dll!ID3D12GraphicsCommandList10::#126 (not on PC); PR head (7d99466f5) logged 0#126stub warnings and ran cleanly (exit: 0x0, 0 device removals, 0 crashes).Regression run
main (
5ad98adbc360225ac8a57ad9661e16fe8df9d8dd):PR head (
7d99466f5ec5feaa94843440e111c096e9c170fd):Not tested
main's existing#124/#125direct remap).RSSetShadingRateX(#128) and live#127(RSSetShadingRateImage) /#148(AllocateUploadMemory) calls in a retail title (ea3b5e4dcalled#126, not#127or#148, during the 60 s smoke).XCL_SAMPLE_*tests (unset on this run) and the 24 skipped GPU tests (22 wave64, 2 heap windows).AI use
origin/main(5ad98adbc), ran release warning parity checks, full.\scripts\test.ps1, paired 60 sscripts/smoke.ps1runs,scripts/pr_check.py --local, and drafted this PR description.Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-12-03T00:50:34Z.
Review: APPROVED
Implements
AllocateFromCommandAllocatorXwith the Windows x64 ABI.Size and alignment are
UINTarguments. Read each asu32beforewidening to
usize, because the upper 32 register bits are unspecified.AI: OpenAI Codex (GPT-6, specific revision unavailable) review.
Imported from ivall/xcl. Originally posted by jsalzy on 2026-12-03T01:18:19Z.
merge-check claim
head:
7d99466f5eImported from ivall/xcl. Originally posted by jsalzy on 2026-12-03T01:24:13Z.
merge-check
base:
078358a058head:
7d99466f5emerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3007 passed, 0 failed, 52 ignored (44 test binaries); SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: none. The PR's new test allocate_from_command_allocator_ignores_upper_32_register_bits and the extended newer_layout_maps_dispatch_mesh_to_slot_129_not_128 ran and passed. git diff --check clean; 39 compiler warnings, the same as main.
title run: not run
review: (1) The 32-bit width of #148's size and alignment isn't sourced: as the PR itself notes, no public SDK header gives them. If they were 64-bit, a request of 4 GiB or more would be truncated (unlikely for upload memory, but unverified). (2) Newer-layout #126/#127 now go straight to the PC's RSSetShadingRate / RSSetShadingRateImage (#77 / #78), with no OPTIONS6 (VRS tier) check. That's the same as main's existing older-layout remap of #124/#125, and open #824 / #1944 add a check for #126; on a GPU without VRS these calls are invalid either way. (3) The #126/#127 test checks the slot table (newer_list_target), not a call through a real newer-layout command list. Checked and fine: newer_list_target (real.rs) uses the console handler if there is one, else console_remap -> pc[1 + p], where pc is class_for's copy of the vtable taken before any remap; the lookup is bounds-checked with get(). Newer #129 still resolves to DispatchMesh, and #127 no longer lands there. Only the two vtable entries for #148 (real.rs:1701, console_list.rs:708) take the u32 ABI; the internal callers of allocate_upload_memory (bind.rs:4113, list_x.rs:5955) call the Rust function directly. The new test calls both #148 hooks through a u64 signature with junk in the upper halves and gets aligned memory back. Duplicates: this PR combines the author's closed #3234 (its real.rs change exactly) and closed #3235 (#148). #3234 was in #1607 group D187 with open #824 and #1944, which handle newer #126 differently (a VRS-checked handler and a sanitizing handler); neither covers #127 or #148. Not the same change, so this belongs in D187 in #3234's place.
performance: none (reasoned): it only changes which function sits at newer-layout slots #126/#127 and the argument width at #148.
verdict: safe to merge: small and correct as read, the suite passes, and it carries over closed #3234 and #3235. Open #824 / #1944 (D187) handle #126 another way.
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-03T02:15:00Z.
Review: COMMENTED
Review of
7d99466f(code reading and the tests named below, not a merge-check) · no findings, 1 questionIn short: the two new pairs give a newer-layout title PC
RSSetShadingRate/RSSetShadingRateImageat #126 / #127, resolved from the same vtable copy (pc, taken after the overrides and before the splits) that the older layout's #124 / #125 already use. An older-layout title and the PC side keep what they had at those slots, because the split'soldertarget is the entry that was there. None of the 23 existing pairs changes: each of their older slots has a console handler, so the new remap fallback is not reached for them. #148 has two vtable entries and both take the 32-bit arguments; the internal callers use the Rust function directly.Result: no blockers found. From the code, nothing stands in the way of a merge. This is a review, not a merge-check: the suite and a title run are not covered here.
Measured (RTX 3080, merge of this head onto
main078358a0, debug)cargo test -p xcl --lib -- newer_layout_maps_dispatch_mesh allocate_from_command_allocator_ignores: 2 passed, 0 failed.usizeagain (one at a time), the new test fails ("bind #148 must ignore upper 32 bits…", "console_list #148 must ignore upper 32 bits…").Question
mainshows 1161 frames and 91 / 91 / 118 presents per 2 s at the end, this head 1078 frames and 60 / 61 / 63. That is inside the 80 % rule, but this title is the one that calls #126, so on this head its shading-rate calls reach the driver for the first time, and the run got slower, not faster. Is that run-to-run variance (another loading phase at second 60), or does the title's rate now take effect in a way that costs frames? A second pair of runs would tell.Note, not blocking
newer_layout_maps_dispatch_mesh_to_slot_129_not_128checks the table andnewer_list_targeton a made-up vector. It would also pass ifclass_forhanded it&v(where #77 / #78 are already splits) or swapped the split's targets; the code does neither, the test just does not pin it. Read, not measured.Not checked: the whole suite and a title run on this head (see the merge check); a live #126 / #127 / #148 call (the title on this machine was not run); adapters without variable-rate shading, which the description lists itself; the width of #148's arguments on the console, which the merge check already raised.
Review by Claude Code (Claude Fable 5.2), with an independent second read by a subagent (Claude Fable 5.2) whose points were checked before use, posted without a human check of each point. An automated PR review workflow is running at the request of the user.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-03T02:27:04Z.
Thanks for the review, @vasanex!
Re: Question 1 (smoke
presents per 2 s91 91 118vs60 61 63): ontitle: ea3b5e4d, earlier splash/loading phases present uncapped (~90–120 presents per 2 s) and the start screen caps at 30 fps (~60 presents per 2 s). So60 61 63at second 60 on7d99466f5is the normal capped menu rate rather than a slowdown from#126, while themainrun was still in an uncapped loading/splash phase at second 60. (Noted: we did not run a second A/B pair on7d99466f5to confirm statistically.)Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T05:27:48Z.
merge-check
base:
078358a058head:
7d99466f5emerge: clean
build: ok
tests: 3007 passed, 0 failed, 52 ignored; 28 skipped, the same as on main
review: 3 medium, 1 nit (below)
performance: 60 s smoke run: 1669 → 1672 frames (100 % of main), peak commit 17577 → 17866 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 230 s there, 0 device removals, 0 crashes, 2.9 presents/s; run with
XCL_SKIP_CS=95cc13288a27a96e(the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)verdict: safe to merge: no blocking finding (the points below are medium or nits), the suite passes and the smoke run is clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
In short: Maps the newer-layout command-list slots #126/#127 to PC RSSetShadingRate/RSSetShadingRateImage, so #127 no longer runs DispatchMesh. It also reads the #148 AllocateUploadMemory size and alignment as 32-bit. The code is correct, both tests would fail without the change, and nothing blocks it; it replaces the closed #3234 and #3235, which both had safe-to-merge checks.
Medium
Nit
Checked and fine
How this was tested
078358a0, thencargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4.scripts/smoke.ps1: 60 s of a retail title on main078358a0and on this merge; presents per 2 s at the end: 60 60 61.XCL_RUN_SECONDS=300and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.