Skip to content

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

Closed
Luislariosss wants to merge 1 commit into
xcl-dev:mainfrom
Luislariosss:test/tiling-parity
Closed

Luislariosss wants to merge 1 commit into
xcl-dev:mainfrom
Luislariosss:test/tiling-parity

Conversation

@Luislariosss

Copy link
Copy Markdown

tests: compare reserved-resource tiling with the host driver (issue #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_on_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;
  • queries GetResourceTiling twice on that same resource: once through
    XCL's device vtable slot, once through the original driver entry
    (
    eal::orig_fn + the slot it recorded), and requires identical
    otal_tiles, WidthInTiles, HeightInTiles and TILE_SHAPE. This is what
    catches XCL answering from a formula instead of the driver;
  • pins the numbers measured on this card as regression constants, commented
    with the adapter and driver: 8x8 RGBA8 -> 1 tile (1x1), 256x256 RGBA8 -> 4
    (2x2), BC1 256x256 -> 1 with shape 512x256, D32 8x8 -> 1 with shape 128x128;
  • skips cleanly (
    unner::skip_test) with no GPU, no tiled-resource support,
    or when XCL_VRAM_ARENAS disables page placement, instead of failing.

The oracle split is the one discussed in #480: host driver for what the PC also
executes, console only for what the console alone defines (those stay with
xg_oracle.rs), and the measured RDNA4 numbers as constants so a regression
fails loudly instead of silently following whatever the driver says that day.

Verified on AMD Radeon RX 9060 XT (RDNA4, gfx1200), Adrenalin 26.10.1 /
Windows driver 32.0.32015.7029, Windows 11 26200:

cargo test -p xcl --test tiling_parity   -> ok, 1 passed, 0 failed (0.23s)
cargo clippy -p xcl --all-targets        -> exit 0, no warning in the new file

AI-assisted.

…cl-dev#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_on_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;
- queries GetResourceTiling twice **on that same resource**: once through
  XCL's device vtable slot, once through the original driver entry
  (
eal::orig_fn + the slot it recorded), and requires identical
  	otal_tiles, WidthInTiles, HeightInTiles and TILE_SHAPE. This is what
  catches XCL answering from a formula instead of the driver;
- pins the numbers measured on this card as regression constants, commented
  with the adapter and driver: 8x8 RGBA8 -> 1 tile (1x1), 256x256 RGBA8 -> 4
  (2x2), BC1 256x256 -> 1 with shape 512x256, D32 8x8 -> 1 with shape 128x128;
- skips cleanly (
unner::skip_test) with no GPU, no tiled-resource support,
  or when XCL_VRAM_ARENAS disables page placement, instead of failing.

The oracle split is the one discussed in xcl-dev#480: host driver for what the PC also
executes, console only for what the console alone defines (those stay with
xg_oracle.rs), and the measured RDNA4 numbers as constants so a regression
fails loudly instead of silently following whatever the driver says that day.

Verified on AMD Radeon RX 9060 XT (RDNA4, gfx1200), Adrenalin 26.10.1 /
Windows driver 32.0.32015.7029, Windows 11 26200:

    cargo test -p xcl --test tiling_parity   -> ok, 1 passed, 0 failed (0.23s)
    cargo clippy -p xcl --all-targets        -> exit 0, no warning in the new file

AI-assisted.
@lordon1a

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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:

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

Copy link
Copy Markdown
Contributor

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.

@raylitebull

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants