tests: compare reserved-resource tiling with the host driver (#480) #707

Closed
Luislariosss wants to merge 1 commit from upstream-pr/712 into main
Luislariosss commented 2026-11-24 03:59:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-24T03:59:33Z.


Part of #480.

There is no test that checks XCL's D3D12 answers against the PC driver on the same machine, and for the part of the API plain D3D12 also implements the driver is ground truth: if the tiling XCL reports differs from what the driver would say, the title sees a difference no console-file test would catch.

New integration test crates/xcl/tests/tiling_parity.rs, no game data and no console DLL:

  • creates each texture through XCL's page-placement path (d3d12x::vram::place_pages, which rewrites the layout to D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE and calls the real CreateReservedResource), obtaining the adopted console ID3D12Device from d3d12x::D3D12XboxCreateDevice after checking the backend is Real;
  • on that same resource, requires XCL's device vtable slot and the driver's original GetResourceTiling entry to return identical answers;
  • requires the placed resource to still report the 64 KiB swizzle layout back (GetDesc), which the page binding depends on;
  • checks the invariants every D3D12 driver must satisfy, not one vendor's numbers: the standard-tile grid plus the packed-mip tiles add up to the reported total, the tiles fit inside it, a mip is standard or packed, and the tile shape is the format's standard one (128x128x1 for 4-byte texel formats, 512x256x1 for BC1/BC4/BC5). The first round pinned the numbers measured on RDNA4 and failed on NVIDIA (a small texture is a 1x1 standard tile on AMD, a packed 0x0 grid on NVIDIA, per the test reports upthread); the driver-dependent grid is not pinned now, its accounting is, so the test holds on any vendor while still failing loudly on a broken layout rewrite or format mapping;
  • skips cleanly (runner::skip_test) with no GPU, no tiled-resource support, no tier 2 heaps, or when XCL_VRAM_ARENAS disables page placement.

What is in it

  • crates/xcl/tests/tiling_parity.rs (new): the reserved_resource_tiling_matches_host_driver test described above.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), Windows driver 32.0.32029.2010; Ryzen 5 9600X; Windows 11 build 26200; Rust 1.99.0 stable-x86_64-pc-windows-msvc; debug build.
  • cargo test -p xcl --test tiling_parity: ok, 1 passed, 0 failed, backend real.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1316 passed, 2 failed, 27 ignored. The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3 (a CPU/GPU result mismatch in the DXIL fuzzer): library tests this PR does not touch, and they fail the same way on main on this adapter.

Not tested

  • NVIDIA and Intel GPUs: the test asserts only cross-vendor invariants now, but no run of mine was made on them.
  • The retail title.

AI use

  • Claude Code (Claude Sonnet 5.5) wrote the test, ran the commands above on the hardware named, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5465814493 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/712). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-11-24T03:59:33Z. --- Part of #480. There is no test that checks XCL's D3D12 answers against the PC driver on the same machine, and for the part of the API plain D3D12 also implements the driver is ground truth: if the tiling XCL reports differs from what the driver would say, the title sees a difference no console-file test would catch. New integration test `crates/xcl/tests/tiling_parity.rs`, no game data and no console DLL: - creates each texture through XCL's page-placement path (`d3d12x::vram::place_pages`, which rewrites the layout to `D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE` and calls the real `CreateReservedResource`), obtaining the adopted console `ID3D12Device` from `d3d12x::D3D12XboxCreateDevice` after checking the backend is Real; - on that same resource, requires XCL's device vtable slot and the driver's original `GetResourceTiling` entry to return identical answers; - requires the placed resource to still report the 64 KiB swizzle layout back (`GetDesc`), which the page binding depends on; - checks the invariants every D3D12 driver must satisfy, not one vendor's numbers: the standard-tile grid plus the packed-mip tiles add up to the reported total, the tiles fit inside it, a mip is standard or packed, and the tile shape is the format's standard one (128x128x1 for 4-byte texel formats, 512x256x1 for BC1/BC4/BC5). The first round pinned the numbers measured on RDNA4 and failed on NVIDIA (a small texture is a 1x1 standard tile on AMD, a packed 0x0 grid on NVIDIA, per the test reports upthread); the driver-dependent grid is not pinned now, its accounting is, so the test holds on any vendor while still failing loudly on a broken layout rewrite or format mapping; - skips cleanly (`runner::skip_test`) with no GPU, no tiled-resource support, no tier 2 heaps, or when `XCL_VRAM_ARENAS` disables page placement. **What is in it** - `crates/xcl/tests/tiling_parity.rs` (new): the `reserved_resource_tiling_matches_host_driver` test described above. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), Windows driver 32.0.32029.2010; Ryzen 5 9600X; Windows 11 build 26200; Rust 1.99.0 `stable-x86_64-pc-windows-msvc`; debug build. - `cargo test -p xcl --test tiling_parity`: ok, 1 passed, 0 failed, backend `real`. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1316 passed, 2 failed, 27 ignored. The 2 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `fuzz_validate_and_gpu_3` (a CPU/GPU result mismatch in the DXIL fuzzer): library tests this PR does not touch, and they fail the same way on `main` on this adapter. **Not tested** - NVIDIA and Intel GPUs: the test asserts only cross-vendor invariants now, but no run of mine was made on them. - The retail title. **AI use** - Claude Code (Claude Sonnet 5.5) wrote the test, ran the commands above on the hardware named, and drafted this description.
lordon1a commented 2026-11-24 07:06:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lordon1a on 2026-11-24T04:07:43Z.


Independent GPU test report on 0d2337f — FAILS on NVIDIA Ampere (RTX 3070 Ti):

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build
  • Command: cargo test -p xcl --test tiling_parity -- --nocapture
  • Result: 0 passed, 1 failed, 0 ignored in 0.64s:
    thread 'reserved_resource_tiling_matches_host_driver' panicked at crates\xcl\tests\tiling_parity.rs:270:13:
    assertion `left == right` failed: R8G8B8A8_UNORM 8x8: tiling (Tiling { total_tiles: 1, width_in_tiles: 0, height_in_tiles: 0, tile_shape: (128, 128, 1) }) != pinned RDNA4 constant (Tiling { total_tiles: 1, width_in_tiles: 1, height_in_tiles: 1, tile_shape: (128, 128, 1) })
    

On NVIDIA's D3D12 driver, an 8×8 R8G8B8A8_UNORM reserved resource is packed into the mip tail (width_in_tiles: 0, height_in_tiles: 0, total_tiles: 1), so asserting equality against the pinned RDNA4 constant fails on NVIDIA adapters.

Not tested

  • AMD / Intel GPU, retail title

AI use

  • Antigravity (Google DeepMind agent) — fetched 0d2337f in a detached worktree, audited the diff, ran tiling_parity, and posted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7121732112 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/712#issuecomment-7121732112). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T04:07:43Z. --- Independent GPU test report on `0d2337f` — **FAILS on NVIDIA Ampere (RTX 3070 Ti)**: **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build - Command: `cargo test -p xcl --test tiling_parity -- --nocapture` - Result: **0 passed, 1 failed, 0 ignored** in `0.64s`: ``` thread 'reserved_resource_tiling_matches_host_driver' panicked at crates\xcl\tests\tiling_parity.rs:270:13: assertion `left == right` failed: R8G8B8A8_UNORM 8x8: tiling (Tiling { total_tiles: 1, width_in_tiles: 0, height_in_tiles: 0, tile_shape: (128, 128, 1) }) != pinned RDNA4 constant (Tiling { total_tiles: 1, width_in_tiles: 1, height_in_tiles: 1, tile_shape: (128, 128, 1) }) ``` On NVIDIA's D3D12 driver, an 8×8 `R8G8B8A8_UNORM` reserved resource is packed into the mip tail (`width_in_tiles: 0, height_in_tiles: 0, total_tiles: 1`), so asserting equality against the pinned RDNA4 constant fails on NVIDIA adapters. **Not tested** - AMD / Intel GPU, retail title **AI use** - Antigravity (Google DeepMind agent) — fetched `0d2337f` in a detached worktree, audited the diff, ran `tiling_parity`, and posted this report.
ItsMrDubey commented 2026-11-24 07:06:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ItsMrDubey on 2026-11-24T04:57:35Z.


Test report for 0d2337f7b4412b99e91a507f86760f330765f651 (this PR's head)

Tested

  • NVIDIA GeForce RTX 4070 Ti 12 GB (Ada), driver 617.14; Intel Core i9-10900K, 32 GB RAM; Windows 11 Pro build 26300
  • Rust 1.88.0 (stable-x86_64-pc-windows-msvc), debug; DXC 1.9.2602.17 from Windows SDK 10.0.26100
cargo build --workspace
cargo test --workspace --no-fail-fast -- --test-threads=4

17 test binaries: 675 passed, 2 failed, 41 ignored. Same machine, main 64b3f3559: 700 passed, 1 failed, 41 ignored.

This PR's tests:

  • reserved_resource_tiling_matches_host_driver: FAILED

The new test fails on NVIDIA. For R8G8B8A8_UNORM 8x8 the host driver reports Tiling { total_tiles: 1, width_in_tiles: 0, height_in_tiles: 0, tile_shape: (128, 128, 1) }, while the pinned RDNA4 constant is width_in_tiles: 1, height_in_tiles: 1 (crates/xcl/tests/tiling_parity.rs:270). NVIDIA puts this texture entirely in the packed mips, so its standard-tile grid is 0x0. The comparison with the pinned RDNA4 values only holds on AMD; on other vendors it needs to skip, or to compare only what the console layout depends on.

Failures:

  • hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory fails on this machine on every run, on this PR's head and on main 64b3f3559 alike (5 of 5 reruns on main), so it is not from this PR. #650 fixes it here.

SKIPPED (no wave64 on this GPU): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

AI use: Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.

<!-- greyfinch-sync:ivall/xcl:comment:7122493504 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/712#issuecomment-7122493504). Originally posted by [ItsMrDubey](https://github.com/ItsMrDubey) on 2026-11-24T04:57:35Z. --- Test report for `0d2337f7b4412b99e91a507f86760f330765f651` (this PR's head) **Tested** - NVIDIA GeForce RTX 4070 Ti 12 GB (Ada), driver 617.14; Intel Core i9-10900K, 32 GB RAM; Windows 11 Pro build 26300 - Rust 1.88.0 (`stable-x86_64-pc-windows-msvc`), debug; DXC 1.9.2602.17 from Windows SDK 10.0.26100 ``` cargo build --workspace cargo test --workspace --no-fail-fast -- --test-threads=4 ``` 17 test binaries: **675 passed, 2 failed, 41 ignored**. Same machine, `main` `64b3f3559`: 700 passed, 1 failed, 41 ignored. This PR's tests: - `reserved_resource_tiling_matches_host_driver`: FAILED **The new test fails on NVIDIA.** For `R8G8B8A8_UNORM` 8x8 the host driver reports `Tiling { total_tiles: 1, width_in_tiles: 0, height_in_tiles: 0, tile_shape: (128, 128, 1) }`, while the pinned RDNA4 constant is `width_in_tiles: 1, height_in_tiles: 1` (`crates/xcl/tests/tiling_parity.rs:270`). NVIDIA puts this texture entirely in the packed mips, so its standard-tile grid is 0x0. The comparison with the pinned RDNA4 values only holds on AMD; on other vendors it needs to skip, or to compare only what the console layout depends on. Failures: - `hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory` fails on this machine on every run, on this PR's head and on `main` `64b3f3559` alike (5 of 5 reruns on `main`), so it is not from this PR. #650 fixes it here. SKIPPED (no wave64 on this GPU): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. AI use: Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.
luckyteagirl commented 2026-11-24 07:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-24T05:59:26Z.


Reserved-resource tiling check on AMD RDNA2

  • Tested clean PR head 0d2337f7b4412b99e91a507f86760f330765f651, debug build, Rust 1.99.0 MSVC, Windows 11 Home build 26200.
  • Radeon RX 6800M, display driver 30.0.13002.13003, Ryzen 9 5980HX. XCL logged the real RX 6800M D3D12 backend with XCL_ADAPTER=6800M.
cargo test --locked -p xcl --test tiling_parity -- --test-threads=1 --nocapture

1 passed, 0 failed, 0 ignored, 0 runtime skips. All four cases matched the original D3D12 driver and the pinned values, including the 1×1 subresource tile count on the 8×8 RGBA8 case that differs in the NVIDIA reports upthread.

Not tested

Full workspace suite on this PR head, release build, other adapters, and retail sample data.

AI use

OpenAI Codex (GPT-6 family, exact model variant unavailable) ran the test and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7123465621 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/712#issuecomment-7123465621). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-24T05:59:26Z. --- **Reserved-resource tiling check on AMD RDNA2** - Tested clean PR head `0d2337f7b4412b99e91a507f86760f330765f651`, debug build, Rust `1.99.0` MSVC, Windows 11 Home build 26200. - Radeon RX 6800M, display driver `30.0.13002.13003`, Ryzen 9 5980HX. XCL logged the real RX 6800M D3D12 backend with `XCL_ADAPTER=6800M`. ```powershell cargo test --locked -p xcl --test tiling_parity -- --test-threads=1 --nocapture ``` **1 passed, 0 failed, 0 ignored, 0 runtime skips.** All four cases matched the original D3D12 driver and the pinned values, including the `1×1` subresource tile count on the 8×8 RGBA8 case that differs in the NVIDIA reports upthread. **Not tested** Full workspace suite on this PR head, release build, other adapters, and retail sample data. **AI use** OpenAI Codex (GPT-6 family, exact model variant unavailable) ran the test and drafted this report.
upstream-sync closed this pull request 2026-11-24 11:04:57 +00:00
raylitebull commented 2026-11-24 11:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:43:44Z.


Closing because it fails the required PR description check (missing required template / AI-use sections per CONTRIBUTING.md) and fails on NVIDIA hardware as reported in the thread. Feel free to reopen a fixed PR matching the template.

<!-- greyfinch-sync:ivall/xcl:comment:7129165204 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/712#issuecomment-7129165204). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:43:44Z. --- Closing because it fails the required `PR description` check (missing required template / AI-use sections per `CONTRIBUTING.md`) and fails on NVIDIA hardware as reported in the thread. Feel free to reopen a fixed PR matching the template.
Luislariosss commented 2026-11-26 21:41:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-26T21:41:46Z.


Superseded by #2889 after the rework. The test no longer pins the RDNA4 numbers (they failed on NVIDIA, per the reports above): it compares XCL and the driver on the same resource and asserts invariants that hold on any vendor - the 64 KiB swizzle layout stuck, standard grid + packed-mip tiles add up to the total, and the format's standard tile shape. The branch was force-pushed for the rebase onto main, so GitHub cannot reopen this PR; #2889 is the same test, fixed and rebased.

<!-- greyfinch-sync:ivall/xcl:comment:7203972731 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/712#issuecomment-7203972731). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-11-26T21:41:46Z. --- Superseded by #2889 after the rework. The test no longer pins the RDNA4 numbers (they failed on NVIDIA, per the reports above): it compares XCL and the driver on the same resource and asserts invariants that hold on any vendor - the 64 KiB swizzle layout stuck, standard grid + packed-mip tiles add up to the total, and the format's standard tile shape. The branch was force-pushed for the rebase onto main, so GitHub cannot reopen this PR; #2889 is the same test, fixed and rebased.

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!707
No description provided.