D3D12.X: fix AllocateFromCommandAllocatorX (#148) 32-bit UINT x64 ABI #3235

Closed
Kalmarv wants to merge 1 commit from upstream-pr/3235 into main
Kalmarv commented 2026-11-28 23:37:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T23:37:36Z.


Fix ID3D12GraphicsCommandList::AllocateFromCommandAllocatorX (#148) x64 ABI to take 32-bit u32 sizeBytes and alignmentBytes instead of usize so upper 32 register bits are ignored.

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs, real.rs, console_list.rs: change allocate_from_command_allocator_x and cl_allocate_upload_memory parameter types from usize to u32 (widening inside the body), and add unit test allocate_from_command_allocator_ignores_upper_32_register_bits with poisoned upper register bits (0xDEAD_BEEF_0000_0040, 0xCAFE_BABE_0000_0020).

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074), AMD Ryzen 9 9950X, Windows 11 Pro (build 26200), rustc 1.99.0, DXC 1.9 (XCL_DXC_DIR), debug for unit tests and release for xcl-smoke.
  • Targeted unit test: cargo test -p xcl --lib allocate_from_command_allocator -- --nocapture: 1 passed, 0 failed, 0 ignored.
  • Live steady-world run (BISECT1, RTX 5070 Ti, XCL_DIRECT_DXIL=all): exit 0x0, 1.69 fps (matching baseline), 0 removals, 0 crashes.

Regression run
main (f0e8fdd5c3942ddd399d5ee11384c8595c5aacff):

xcl-smoke v1
commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1695 (PresentX 1695)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31546 MB

PR head (8a40c0df06fdec1570c70d418991cf56d87ebe38):

xcl-smoke v1
commit: 8a40c0df06fdec1570c70d418991cf56d87ebe38
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1586 (PresentX 1586)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 32435 MB

Not tested

  • AMD RDNA / Intel GPUs.

AI use

  • Antigravity (Gemini) assisted with implementation, unit test, and xcl-smoke regression run.
<!-- greyfinch-sync:ivall/xcl:issue:5545688363 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3235). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-28T23:37:36Z. --- Fix `ID3D12GraphicsCommandList::AllocateFromCommandAllocatorX` (`#148`) x64 ABI to take 32-bit `u32` `sizeBytes` and `alignmentBytes` instead of `usize` so upper 32 register bits are ignored. **What is in it** - `crates/xcl/src/hle/d3d12x/bind.rs`, `real.rs`, `console_list.rs`: change `allocate_from_command_allocator_x` and `cl_allocate_upload_memory` parameter types from `usize` to `u32` (widening inside the body), and add unit test `allocate_from_command_allocator_ignores_upper_32_register_bits` with poisoned upper register bits (`0xDEAD_BEEF_0000_0040`, `0xCAFE_BABE_0000_0020`). **Tested** - Hardware / toolchain: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074), AMD Ryzen 9 9950X, Windows 11 Pro (build 26200), `rustc 1.99.0`, DXC 1.9 (`XCL_DXC_DIR`), debug for unit tests and release for `xcl-smoke`. - Targeted unit test: `cargo test -p xcl --lib allocate_from_command_allocator -- --nocapture`: 1 passed, 0 failed, 0 ignored. - Live steady-world run (`BISECT1`, RTX 5070 Ti, `XCL_DIRECT_DXIL=all`): `exit 0x0`, `1.69 fps` (matching baseline), `0` removals, `0` crashes. **Regression run** main (`f0e8fdd5c3942ddd399d5ee11384c8595c5aacff`): ``` xcl-smoke v1 commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 150 exit: 0x0 frames shown: 1695 (PresentX 1695) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 31546 MB ``` PR head (`8a40c0df06fdec1570c70d418991cf56d87ebe38`): ``` xcl-smoke v1 commit: 8a40c0df06fdec1570c70d418991cf56d87ebe38 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 150 exit: 0x0 frames shown: 1586 (PresentX 1586) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 32435 MB ``` **Not tested** - AMD RDNA / Intel GPUs. **AI use** - Antigravity (Gemini) assisted with implementation, unit test, and `xcl-smoke` regression run.
Foniass commented 2026-11-29 14:57:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:57:34Z.


merge-check
base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0
head: 8a40c0df06fdec1570c70d418991cf56d87ebe38
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2615 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine)
review: no bug found. Nothing sources the u32 signature (HANDOFF calls the slot AllocateUploadMemory). The PR text reports only one targeted test and no model.
performance: 60 s smoke: 1678 frames (100.4 %), peak commit 17245 MB (96.1 %)
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above, the full suite, and a 60 s scripts/smoke.ps1 run of a retail title against main on the same machine. The 4 fuzz_validate_and_gpu_* failures happen on main on this machine too.

<!-- greyfinch-sync:ivall/xcl:comment:7257708546 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3235#issuecomment-7257708546). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T14:57:34Z. --- ```text merge-check base: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 head: 8a40c0df06fdec1570c70d418991cf56d87ebe38 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2615 passed, 4 failed, 49 ignored; SKIPPED: 44; failing: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (driver E_OUTOFMEMORY, same on base on this machine) review: no bug found. Nothing sources the u32 signature (HANDOFF calls the slot AllocateUploadMemory). The PR text reports only one targeted test and no model. performance: 60 s smoke: 1678 frames (100.4 %), peak commit 17245 MB (96.1 %) verdict: safe to merge hardware / tool and model: RTX 5070 Ti (driver 32.0.16.2114), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 ``` Merge-check run and written with Claude Code (Claude Opus 5.5): a test merge onto the base above, the full suite, and a 60 s `scripts/smoke.ps1` run of a retail title against main on the same machine. The 4 `fuzz_validate_and_gpu_*` failures happen on main on this machine too.
Kalmarv commented 2026-12-02 20:30:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T20:30:41Z.


Closing: consolidated with #3234 into #3727 (rebased onto main 5ad98adbc, full scripts/test.ps1 + paired 60 s scripts/smoke.ps1 verified, and addressing the HANDOFF.md naming / ABI provenance note from review).

<!-- greyfinch-sync:ivall/xcl:comment:7357849451 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3235#issuecomment-7357849451). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T20:30:41Z. --- Closing: consolidated with #3234 into #3727 (rebased onto `main` `5ad98adbc`, full `scripts/test.ps1` + paired 60 s `scripts/smoke.ps1` verified, and addressing the `HANDOFF.md` naming / ABI provenance note from review).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3235
No description provided.