D3D12.X: fix RegisterPagePoolX 64-bit HANDLE write and CreateCommandQueueX (#48) desc layout #3260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3260"
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-11-29T02:08:33Z.
Fix two D3D12.X device API ABI bugs: write all 64 bits of the output
HANDLEinRegisterPagePoolX(#74) and translate the Xbox-specificD3D12XBOX_COMMAND_QUEUE_DESClayout inCreateCommandQueueX(#48).Previously:
register_page_pool_xwrote only a 32-bitu32throughout: *mut u32, leaving the upper 32 bits of a caller's uninitialized 64-bitHANDLEuntouched. Passing that handle back toUnregisterPagePoolX(#75) failed to match the registered pool.#48(CreateCommandQueueX) reusedcreate_command_queue_x(standard PCD3D12_COMMAND_QUEUE_DESC:{ Type, Priority, Flags, NodeMask }). BecauseD3D12XBOX_COMMAND_QUEUE_DESClays out{ Type, Flags, EngineOrPipeIndex, QueueIndex }, Xbox queue flags were misread as PCPriority, oddEngineOrPipeIndexvalues falsely setD3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT, and non-zeroQueueIndexvalues leaked into PCNodeMask.What is in it
crates/xcl/src/hle/d3d12x/device_x.rs:pc_queue_desc_xboxandcreate_command_queue_xbox(sharingcreate_command_queue_innerwithcreate_command_queue_x) to translate{ Type, Flags, EngineOrPipeIndex, QueueIndex }into a PCD3D12_COMMAND_QUEUE_DESC: mapsFlags[27:24]Xbox priority (3/5/7-> high100, others -> normal0),Flags & 1->DISABLE_GPU_TIMEOUT, andNodeMask = 0.register_page_pool_x(#74) to takeout: *mut u64and write the full 64-bit handle without.write_unaligned(i as u64).page_pools_register_once_and_unregisterto pre-fill dirty upper 32 bits (0xDEAD_BEEF_FFFF_FFFF) and add child-process-isolated WARP testcreate_command_queue_xbox_desc_translates_fields_and_runs_on_warp.crates/xcl/src/hle/d3d12x/real.rs:#48(CreateCommandQueueX) tox::create_command_queue_xbox.tests/testtitle/src/gpu.rs:RegisterPagePoolXtest caller to pass a 64-bitHANDLE*(*mut u64) initialized with dirty upper bits.Tested
rustc 1.99.0 (b940084d7 2026-09-28), DXC 1.9 (XCL_DXC_DIR), debug for tests and release forxcl-smoke.cargo test -p xcl --lib -- page_pools_register_once_and_unregister create_command_queue_xbox_desc_translates_fields_and_runs_on_warp console_types_and_descs_become_pc_ones --nocapture): 3 passed, 0 failed (0 skips; verifiedRegisterPagePoolXzeroes dirty upper 32 bits andUnregisterPagePoolXmatches, andCreateCommandQueueXtranslatesFlags/EngineOrPipeIndex/QueueIndexaccurately on unit + WARP).cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::): 2600 passed, 0 failed, 49 ignored (includinge2edebug-layerxcl-testtitletests).SKIPPEDGPU tests on this wave32 adapter (26 total across--nocaptureworkspace baseline): 21no wave64(RTX 5070 Ti is wave32), 3 wave32 per-lane#1426f16/cvt-f16 refusals, 2no heap windows(opt-inXCL_HEAP_WINDOWS=1).ea3b5e4d) 150 s regression run below (0device removals,0crashes,1673frames vs1695onmain,32569 MBpeak commit vs31546 MBonmain).Regression run
Not tested
NodeMaskcanonicalization verified against WARP and unit assertions;ea3b5e4dsmoke is a regression check).uma_driver::tests::(skipped locally due to pre-existing0x7C10003exit on NVIDIA) andtest_title_runs_and_game_folder_is_untouched.AI use
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:29:48Z.
merge-check
base:
d0832e614fhead:
0d348b62e4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (device_x.rs +104/-10, real.rs, tests/testtitle/src/gpu.rs). Every #48 call gets the new desc translation and every #74 call now writes 8 bytes instead of 4. Findings: (1) two unrelated fixes (RegisterPagePoolX and CreateCommandQueueX) in one PR. (2) Nothing shown supports the queue desc layout in
pc_queue_desc_xbox(~79-94): the field names (EngineOrPipeIndex,QueueIndex) and the priority codes in Flags[27:24] (3/5/7/8/10/13) can't be read off a title's calls, so please say where they came from. The description overstates main's bug: main already reduces NodeMask to 0/1 (~76) and maps unknown priorities to HIGH, so the WARP test'sNodeMask <= 1check passes on main too; the only difference it shows is DISABLE_GPU_TIMEOUT set by an odd pipe index. (3) The 8-byte write inregister_page_pool_x(~645, ~655) is right only if the argument is aHANDLE*; if it's a 4-byte index, the extra 4 bytes overwrite the caller's memory, where main wrote 4. A title log or call site showing the width would settle it. (4) AI use names no exact model; the PR's suite run skippedtest_title_runs_and_game_folder_is_untouchedanduma_driver::tests::. Fine: both slots share one inner function, so queue tracking is unchanged, the WARP test runs in a child process, and the page-pool test fills the upper bits with junk.performance: 60 s smoke of a retail title, main
d0832e61vs this merge (b6811979): 1516 -> 1666 frames shown (109 %; last presents per 2 s: 60 61 60), peak commit 18133 -> 18260 MB, 0 device removals, 0 crashes.verdict: not yet: nothing shows the RegisterPagePoolX argument is a HANDLE* (an 8-byte write where main wrote 4), the queue-desc layout has no stated source, and the two fixes should be split
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T08:02:11Z.
Independent test-reporting finding on the current PR head
0d348b62.The WARP child test captures its stderr with
Command::output(). When WARP is unavailable,skip_testwrites aSKIPPED ...line and returns successfully; the parent checks the successful exit and returns without forwarding the captured stderr. The test can therefore pass without showing that the WARP portion was skipped.A local synthetic Rust subprocess/libtest reproduction showed zero visible skip notices with the current capture-and-return pattern, and exactly one after forwarding only stderr lines beginning
SKIPPED. This verifies the reporting behavior, not XCL's WARP path or GPU execution. Please add a deterministic child-process regression that confirms the parent surfaces the skip line while suppressing unrelated child diagnostics.Candidate correction
AI use: OpenAI Codex (GPT-6.2 Sol) checked the source and drafted this finding; a GPT-6.2 Sol subagent ran the synthetic reproduction.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T20:01:51Z.
Code review location:
crates/xcl/src/hle/d3d12x/device_x.rs; line 655The handle is the Vec index, so the first pool registered in the process gets HANDLE 0 (NULL) with S_OK. Now that the title sees all 64 bits,
if (!hPool)checks read that success as a failure, and a title using NULL to mean "no pool" never unregisters it. Offsetting by 1 would mean 0 is never a valid handle. The testtitle checkpool != u32::MAX as u64doesn't catch this.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T20:01:51Z.
Code review location:
crates/xcl/src/hle/d3d12x/device_x.rs; line 84Priority nibble values outside the listed set (1, 2, 4, 6, 9, 11, 12, 14, 15) now map to NORMAL, and nothing is logged because bits 27:24 are inside the 0x0F00_0001 mask. The old #48 path sent unknown values to HIGH (100), so this silently lowers queue priority.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T20:01:51Z.
Review: COMMENTED
Review of
0d348b62: 3 finding(s). 2 are inline. These are on lines outside the diff:crates/xcl/src/hle/d3d12x/device_x.rs:650: Registering the same (va, pages) twice returns the same handle with no reference count, so the firstUnregisterPagePoolX(H)removes the pool for both callers, and the second gets E_FAIL while the pool is still in use. The test asserts this behavior (i == j, then the second unregister fails).These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T19:38:38Z.
Closing: bundles two unsourced ABI changes with review bugs (NULL handle 0 with
S_OK, silent priority remapping).Pull request closed