Tests: compare GetResourceAllocationInfo and GetCustomHeapProperties against host D3D12 driver #1123

Merged
towiice merged 1 commit from upstream-pr/1132 into main 2026-11-25 19:20:30 +00:00
towiice commented 2026-11-24 12:15:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T12:15:24Z.


Part of #480. Adds host-driver parity integration tests for ID3D12Device::GetResourceAllocationInfo (slot 25) and ID3D12Device::GetCustomHeapProperties (slot 26) without requiring console files or game data.

What is in it

  • crates/xcl/tests/d3d12_allocation_and_heap_info.rs (+403 lines, test-only):
    • Registers a small synthetic title-image trampoline (modules::register_mapped) so guard::make_split dispatches to XCL's real console hooks (get_resource_allocation_info_x and get_custom_heap_properties_x), while comparing directly against real::orig_fn() on the same adopted backend device (real::device_raw()).
    • buffer_allocation_info_matches_host_in_cpp_and_c_abi: compares single buffers (256 B to 1 MiB), multi-buffer arrays, and zero-width invalid buffers across host D3D12, XCL C++ ABI (this, ret, ...), and XCL C ABI (ret, this, ...).
    • custom_heap_properties_match_host_in_cpp_and_c_abi: compares DEFAULT, UPLOAD, and READBACK heap properties across host D3D12, XCL C++ ABI, and XCL C ABI (using 8-byte aligned return buffers to avoid #1130).
    • texture_allocation_info_agrees_across_cpp_and_c_abi: checks that standard 2D textures (RGBA8, RGBA8 with mips, BC7) agree bit-for-bit across C++ and C ABIs with valid non-zero sizes and power-of-two alignments.
    • Routes skips through xcl::gpu::recomp::runner::skip_test("no GPU").

Tested

  • Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (01b62ad4), rustc 1.100.0 (stable-x86_64-pc-windows-gnullvm, llvm-mingw 23.1.6), debug build.
  • cargo test -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1: 3 passed, 0 failed, 0 ignored (no skips).
  • Full suite on commit bf84c59 (same tree as 0dc18fe, base cb868b2), same GPU (driver 32.0.16.1088), Rust 1.100.0 x86_64-pc-windows-gnullvm, debug, run with Claude Code: cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 685 passed, 3 failed, 41 ignored. Failed: placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted, d32s8_targets_take_their_own_size_of_video_memory (xcl lib, which this PR does not touch; main was not rerun this time). SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The 3 new tests passed.

Regression run

  • Test-only change (crates/xcl/tests/d3d12_allocation_and_heap_info.rs). No runtime code touched; no retail game files used.

Not tested

  • AMD, Intel, WARP, release builds, and retail titles.

AI use

  • Antigravity (Gemini 4 Neon) wrote the integration tests, ran the focused tests on the local GTX 1650 SUPER, and drafted the original description. Claude Code (Claude Sonnet 5.5) later squashed the commits, ran the full suite and updated this description.
<!-- greyfinch-sync:ivall/xcl:issue:6581556282 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T12:15:24Z. --- Part of #480. Adds host-driver parity integration tests for `ID3D12Device::GetResourceAllocationInfo` (slot 25) and `ID3D12Device::GetCustomHeapProperties` (slot 26) without requiring console files or game data. **What is in it** - `crates/xcl/tests/d3d12_allocation_and_heap_info.rs` (+403 lines, test-only): - Registers a small synthetic title-image trampoline (`modules::register_mapped`) so `guard::make_split` dispatches to XCL's real console hooks (`get_resource_allocation_info_x` and `get_custom_heap_properties_x`), while comparing directly against `real::orig_fn()` on the same adopted backend device (`real::device_raw()`). - `buffer_allocation_info_matches_host_in_cpp_and_c_abi`: compares single buffers (256 B to 1 MiB), multi-buffer arrays, and zero-width invalid buffers across host D3D12, XCL C++ ABI `(this, ret, ...)`, and XCL C ABI `(ret, this, ...)`. - `custom_heap_properties_match_host_in_cpp_and_c_abi`: compares `DEFAULT`, `UPLOAD`, and `READBACK` heap properties across host D3D12, XCL C++ ABI, and XCL C ABI (using 8-byte aligned return buffers to avoid #1130). - `texture_allocation_info_agrees_across_cpp_and_c_abi`: checks that standard 2D textures (`RGBA8`, `RGBA8` with mips, `BC7`) agree bit-for-bit across C++ and C ABIs with valid non-zero sizes and power-of-two alignments. - Routes skips through `xcl::gpu::recomp::runner::skip_test("no GPU")`. **Tested** - Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (`01b62ad4`), `rustc 1.100.0` (`stable-x86_64-pc-windows-gnullvm`, llvm-mingw 23.1.6), debug build. - `cargo test -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1`: **3 passed, 0 failed, 0 ignored** (no skips). - Full suite on commit `bf84c59` (same tree as `0dc18fe`, base `cb868b2`), same GPU (driver 32.0.16.1088), Rust 1.100.0 `x86_64-pc-windows-gnullvm`, debug, run with Claude Code: `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **685 passed, 3 failed, 41 ignored**. Failed: `placed_title_textures_share_vram_and_preserve_pixels`, `transitions_apply_when_their_list_is_submitted`, `d32s8_targets_take_their_own_size_of_video_memory` (`xcl` lib, which this PR does not touch; `main` was not rerun this time). SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. The 3 new tests passed. **Regression run** - Test-only change (`crates/xcl/tests/d3d12_allocation_and_heap_info.rs`). No runtime code touched; no retail game files used. **Not tested** - AMD, Intel, WARP, release builds, and retail titles. **AI use** - Antigravity (Gemini 4 Neon) wrote the integration tests, ran the focused tests on the local GTX 1650 SUPER, and drafted the original description. Claude Code (Claude Sonnet 5.5) later squashed the commits, ran the full suite and updated this description.
jmal423 commented 2026-11-24 13:03:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jmal423 on 2026-11-24T12:31:29Z.


AMD hardware check on unchanged head b0658d0, Windows 11 build 26200, RX 9070 XT, Rust 1.99.1 MSVC, debug. With XCL_ADAPTER=9070 and XCL_REQUIRE_GPU=wave64, the log confirmed the real RX 9070 XT backend. Running cargo test --locked -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1 --nocapture gave 3 passed, 0 failed, 0 ignored, with no skips. Buffer allocation info and custom heap properties matched the host checks. The texture test checks agreement between the two XCL calling conventions. Focused suite only. AI use: Codex ran the tests and prepared this report.

Full workspace follow-up on the same unmodified head and machine: scripts/test.ps1 exited 0 in debug. Cargo totals: 703 passed, 0 failed, 41 ignored. All three new tests and the synthetic title integration test passed. External samples were unset, so some tests counted as passed returned early.

<!-- greyfinch-sync:ivall/xcl:comment:7131558757 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1132#issuecomment-7131558757). Originally posted by [jmal423](https://github.com/jmal423) on 2026-11-24T12:31:29Z. --- AMD hardware check on unchanged head b0658d0, Windows 11 build 26200, RX 9070 XT, Rust 1.99.1 MSVC, debug. With XCL_ADAPTER=9070 and XCL_REQUIRE_GPU=wave64, the log confirmed the real RX 9070 XT backend. Running cargo test --locked -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1 --nocapture gave 3 passed, 0 failed, 0 ignored, with no skips. Buffer allocation info and custom heap properties matched the host checks. The texture test checks agreement between the two XCL calling conventions. Focused suite only. AI use: Codex ran the tests and prepared this report. Full workspace follow-up on the same unmodified head and machine: scripts/test.ps1 exited 0 in debug. Cargo totals: 703 passed, 0 failed, 41 ignored. All three new tests and the synthetic title integration test passed. External samples were unset, so some tests counted as passed returned early.
jesuarchive commented 2026-11-24 13:03:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jesuarchive on 2026-11-24T12:36:46Z.


Test report for head b0658d0, merged locally onto main 47efa2e (clean merge, nothing pushed).

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 stable-x86_64-pc-windows-msvc (MSVC 14.44); DXC 1.9.2602.17 from the Windows SDK; debug.
  • cargo test -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1 --nocapture: 3 passed, 0 failed, 0 ignored. None skipped: all three ran against the real adapter.
  • cargo test --workspace -- --test-threads=4: 744 passed, 0 failed, 41 ignored. main 47efa2e on the same machine: 741 passed, 0 failed, 41 ignored; the 3 extra are this PR's tests.
  • SKIPPED on this adapter, the same two on main: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).

This adds an MSVC-toolchain run on Ampere next to the description's gnullvm run on Turing.

Not tested

  • AMD and Intel GPUs; the head on its own base cb868b2 (only the merge onto 47efa2e); release build; retail titles.

AI use

  • Claude Code with Claude Opus 5.5: merged the branch, ran the commands above on this machine and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7131681161 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1132#issuecomment-7131681161). Originally posted by [jesuarchive](https://github.com/jesuarchive) on 2026-11-24T12:36:46Z. --- Test report for head `b0658d0`, merged locally onto `main` `47efa2e` (clean merge, nothing pushed). **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 `stable-x86_64-pc-windows-msvc` (MSVC 14.44); DXC 1.9.2602.17 from the Windows SDK; debug. - `cargo test -p xcl --test d3d12_allocation_and_heap_info -- --test-threads=1 --nocapture`: 3 passed, 0 failed, 0 ignored. None skipped: all three ran against the real adapter. - `cargo test --workspace -- --test-threads=4`: 744 passed, 0 failed, 41 ignored. `main` `47efa2e` on the same machine: 741 passed, 0 failed, 41 ignored; the 3 extra are this PR's tests. - SKIPPED on this adapter, the same two on `main`: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). This adds an MSVC-toolchain run on Ampere next to the description's gnullvm run on Turing. **Not tested** - AMD and Intel GPUs; the head on its own base `cb868b2` (only the merge onto `47efa2e`); release build; retail titles. **AI use** - Claude Code with Claude Opus 5.5: merged the branch, ran the commands above on this machine and wrote this report.
JoaoPauluu commented 2026-11-24 14:06:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:45:13Z.


Update, bf84c59: all three tests pass under Wine with vkd3d-proton now, the zero-width buffer case included. I ran them with the same setup as below, release, one test per process, no uncommitted changes: buffer_allocation_info_matches_host_in_cpp_and_c_abi ok, custom_heap_properties_match_host_in_cpp_and_c_abi ok, texture_allocation_info_agrees_across_cpp_and_c_abi ok. Claude Code (Claude Opus 5.5) ran this rerun.


A run with vkd3d-proton as the host D3D12: one of the three tests fails here, on the host's own answer, not on XCL's.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. b0658d0 as it is (merge base cb868b2), no uncommitted changes. The test binary runs under Wine, one test per process.
  • custom_heap_properties_match_host_in_cpp_and_c_abi: ok. texture_allocation_info_agrees_across_cpp_and_c_abi: ok.
  • buffer_allocation_info_matches_host_in_cpp_and_c_abi: fails at d3d12_allocation_and_heap_info.rs:295, host should reject zero-width buffer, left: 0. vkd3d-proton does not return SizeInBytes = UINT64_MAX for a Width == 0 buffer.
  • To see the rest, I changed the test locally for two runs and reverted it (the results above are from the unchanged head). Printing the three results gave host [0, 65536] cpp [0, 65536] c [0, 65536]. So both XCL ABIs return the host's answer there. With the three zero-width assertions removed, the test passes, the single-buffer and multi-buffer comparisons included.
  • So on this host the zero-width check tests the driver's behaviour rather than XCL's. Comparing XCL's result with the host's there, as the other cases do, would pass on both.

Not tested

  • native Windows (the earlier reports here cover it); AMD; the rest of the suite on this head.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7133285317 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7133285317). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T13:45:13Z. --- **Update, `bf84c59`:** all three tests pass under Wine with vkd3d-proton now, the zero-width buffer case included. I ran them with the same setup as below, release, one test per process, no uncommitted changes: `buffer_allocation_info_matches_host_in_cpp_and_c_abi` ok, `custom_heap_properties_match_host_in_cpp_and_c_abi` ok, `texture_allocation_info_agrees_across_cpp_and_c_abi` ok. Claude Code (Claude Opus 5.5) ran this rerun. --- A run with vkd3d-proton as the host D3D12: one of the three tests fails here, on the host's own answer, not on XCL's. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `b0658d0` as it is (merge base `cb868b2`), no uncommitted changes. The test binary runs under Wine, one test per process. - `custom_heap_properties_match_host_in_cpp_and_c_abi`: ok. `texture_allocation_info_agrees_across_cpp_and_c_abi`: ok. - `buffer_allocation_info_matches_host_in_cpp_and_c_abi`: **fails** at `d3d12_allocation_and_heap_info.rs:295`, `host should reject zero-width buffer`, `left: 0`. vkd3d-proton does not return `SizeInBytes = UINT64_MAX` for a `Width == 0` buffer. - To see the rest, I changed the test locally for two runs and reverted it (the results above are from the unchanged head). Printing the three results gave `host [0, 65536] cpp [0, 65536] c [0, 65536]`. So both XCL ABIs return the host's answer there. With the three zero-width assertions removed, the test passes, the single-buffer and multi-buffer comparisons included. - So on this host the zero-width check tests the driver's behaviour rather than XCL's. Comparing XCL's result with the host's there, as the other cases do, would pass on both. **Not tested** - native Windows (the earlier reports here cover it); AMD; the rest of the suite on this head. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
towiice commented 2026-11-24 23:08:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T22:49:18Z.


Thanks @JoaoPauluu for running this under Wine / vkd3d-proton! Updated in 0dc18fe to compare XCL's SizeInBytes (and non-error Alignment) for the zero-width buffer directly against the host driver's answer rather than assuming UINT64_MAX, so both native Windows D3D12 and vkd3d-proton pass cleanly. Re-tested on NVIDIA GeForce GTX 1650 SUPER (3/3 passed).

<!-- greyfinch-sync:ivall/xcl:comment:7146683395 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7146683395). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T22:49:18Z. --- Thanks @JoaoPauluu for running this under Wine / `vkd3d-proton`! Updated in `0dc18fe` to compare XCL's `SizeInBytes` (and non-error `Alignment`) for the zero-width buffer directly against the host driver's answer rather than assuming `UINT64_MAX`, so both native Windows D3D12 and `vkd3d-proton` pass cleanly. Re-tested on NVIDIA GeForce GTX 1650 SUPER (3/3 passed).
towiice commented 2026-11-25 02:09:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-25T02:01:54Z.


Squashed the two commits into one (bf84c59). The tree is identical to 0dc18fe. (Posted with Claude Code, Claude Sonnet 5.5.)

<!-- greyfinch-sync:ivall/xcl:comment:7150237196 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7150237196). Originally posted by [towiice](https://github.com/towiice) on 2026-11-25T02:01:54Z. --- Squashed the two commits into one (`bf84c59`). The tree is identical to `0dc18fe`. (Posted with Claude Code, Claude Sonnet 5.5.)
anderson7z commented 2026-11-25 05:08:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by anderson7z on 2026-11-25T04:45:57Z.


bom!

<!-- greyfinch-sync:ivall/xcl:comment:7153143720 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7153143720). Originally posted by [anderson7z](https://github.com/anderson7z) on 2026-11-25T04:45:57Z. --- bom!
DavidM1911 commented 2026-11-25 08:08:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:02:18Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7156533712 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7156533712). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:02:18Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
upstream-sync closed this pull request 2026-11-25 20:06:56 +00:00
ivall commented 2026-11-25 20:08:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-25T19:20:32Z.


Merging: allocation info and custom heap properties against the host driver, through both ABIs.

Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, main 2898511 with 27 test PRs merged locally, this one included: the whole suite 3 times, 1419 passed, 2 failed, 46 ignored each time (fuzz_validate_and_gpu_1 and _3, which fail the same way on main); hle::d3d12x on 16 threads 5 times, no failure. This file alone 8 times: no failure.

AI use: Claude Code (Claude Opus 5.5) reviewed and tested this and wrote the comment on the maintainer's behalf.

<!-- greyfinch-sync:ivall/xcl:comment:7172162176 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1132#issuecomment-7172162176). Originally posted by [ivall](https://github.com/ivall) on 2026-11-25T19:20:32Z. --- Merging: allocation info and custom heap properties against the host driver, through both ABIs. Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, `main` `2898511` with 27 test PRs merged locally, this one included: the whole suite 3 times, 1419 passed, 2 failed, 46 ignored each time (`fuzz_validate_and_gpu_1` and `_3`, which fail the same way on `main`); `hle::d3d12x` on 16 threads 5 times, no failure. This file alone 8 times: no failure. AI use: Claude Code (Claude Opus 5.5) reviewed and tested this and wrote the comment on the maintainer's behalf.
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!1123
No description provided.