Skip to content

gpu: verify translated compute writes to two mips of one texture - #2882

Open
RonLogic wants to merge 1 commit into
R0Y00:mainfrom
RonLogic:test/translated-compute-two-mips
Open

RonLogic wants to merge 1 commit into
R0Y00:mainfrom
RonLogic:test/translated-compute-two-mips

Conversation

@RonLogic

Copy link
Copy Markdown
Contributor

Change

Refs #2490. This source-built fixture creates a single RGBA16_FLOAT texture with 32×8 and 16×4 mips. One translated slot-67 Dispatch writes distinct patterns through two slot-19 UAVs bound at separate table entries. After the fence the test compares all 1,280 half values, including the untouched regions in both mips. Before translation both mips retain their sentinels. Reversing the views reverses which pattern lands in which mip and changes exactly 64 half values. Failures identify the mip, coordinates, channel and the two bit patterns.

The texture runner retains the existing FP32 and D16 array-layer fixtures. #2710 is on main, and the denied, occupied and copied UAV controls remain in place.

Verification

Windows 26300.10075, MSVC x64 Release, SDK DXC 1.9.2602.17, tested commit 6005e991 on b505c32b.

cmake --build --preset release --target startup_stream_consumer d3d12_xs_shim
$env:XBOX2WINDOWS_ADAPTER = 'RTX 4070'
ctest --preset release --no-tests=error -j 1 -R '^startup_(compute_dispatch|compute_live_retry|pixel_uav|slot67_indirect_dispatch)' -V

24/24 passed without skips, including the FP32 and D16 array fixtures. Both two-mip runs matched 1,280/1,280 on in-box WARP (10.0.26100.10068) and physical RTX 4070 (32.0.16.2124), with the D3D12 debug layer enabled and no error messages. git diff --check passed and the branch merges cleanly into current main.

I used Codex to prepare the change and ran the verification locally.

@thepatrickworld

Copy link
Copy Markdown
Contributor

Independent RDNA 4 result on 6005e991 — the compute/texture family, three runs plus one mutant

Not a code change; measurements only.

Environment

  • ver prints 10.0.26200.9974 (Windows 11 25H2); MSVC banner 19.44.35230, VCToolsVersion 14.44.35207; SDK DXC 1.9.2602.17
  • AMD Radeon RX 9070 XT, driver 32.0.32029.2010 (2026-11-18), as reported by the renderer; WARP 10.0.26100.9818 in the same log
  • preset dev (a Debug build; the body used the Release release preset), head 6005e991c4353d85c55237727f049639f40241a2, git status --porcelain --untracked-files=no empty
  • D3D12 debug layer absent; the fixture prints debug layer: unavailable

Commands

cmake --preset dev -DINTAKE_PYTHON=C:/Users/walde/Downloads/x2w-pr641/out/pe-env/Scripts/python.exe
cmake --build --preset dev --target startup_stream_consumer d3d12_xs_shim
set "XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT"
ctest --preset dev --no-tests=error -V -R "^startup_(compute_dispatch|compute_live_retry|pixel_uav|slot67_indirect_dispatch)"

three consecutive runs, exit 0 each.

Observed

24 of 24 entries passed in every run, no skip, 85.1 / 85.9 / 85.5 s. -V prints the adapter per entry, so both backends sit in the same file:

1280: adapter=Microsoft Basic Render Driver driver=10.0.26100.9818
1280: two mip outputs: 1280 halves match; swapping views changes 64 halves; debug layer: unavailable
1280: startup_compute_dispatch_texture: PASS on warp
1291: adapter=AMD Radeon RX 9070 XT driver=32.0.32029.2010
1291: two mip outputs: 1280 halves match; swapping views changes 64 halves; debug layer: unavailable
1291: startup_compute_dispatch_texture: PASS on hardware

Identical in all three runs, each run printing one WARP block (entry 1280) and one hardware block (entry 1291). The array entries (startup_compute_dispatch_array_* and ..._array_d16_*, 2414-2417) are among the 24 and passed.

A mutant both backends kill

Both UAV views take their MipSlice from swapped (467, 489); the descriptors stay written at heap bytes 64 and 128 (469, 490). Making the swap a no-op — swapped ? 1 : 0 -> 0 and swapped ? 0 : 1 -> 1, count(old) == 1 asserted on each, sha256 of the working-tree tests/startup_stream_consumer.cpp (CRLF checkout) 72c5a6291606569b710af6193735c0081a71059d77712e7d4c0f809b84396aa1 -> e5982357e06433bafdd53487e1e44c695358fb0492611c12a890523a454a9e97, M tests/startup_stream_consumer.cpp in git status during the run — then rebuilding startup_stream_consumer:

1291: AssertionError: swapped views: mip=0 x=0 y=0 channel=0 expected=bc00 actual=3c00   ***Failed
1280: AssertionError: swapped views: mip=0 x=0 y=0 channel=0 expected=bc00 actual=3c00   ***Failed

0xbc00 is -1.0 and 0x3c00 +1.0: the swapped leg expected the colour-1 pattern in mip 0, the mutant's readback holds the colour-0 pattern; at that first half the two differ only in the sign bit, and the next half is 0x4400 expected against 0xc000 read. The ordered leg runs in the mutant too and still passes, so what throws is the swapped comparison. After git checkout -- and a rebuild both entries pass again and the tracked tree is clean.

Scope: the mutant pins both views at once, so what it shows is that a total no-op swap is caught, at the first half of mip 0. It does not show that a one-sided swap would be, nor that mip 1 contributes to the discrimination.

What the printed numbers rest on

check_mips compares all 1,280 halves of the two mips against a CPU reference, sentinels outside the written 8x2 region included (mip_reference, 163-175). The changed == 64 at 225 is computed between two readbacks of the same runtime (the ordered run and the swapped run), so on its own it proves a difference, not a correctness; the correctness comes from the two check_mips calls against the reference. The manifest is asserted to read uav 0 … table 1 64 and uav 1 … table 1 128 (198-201).

Where these entries run

startup_compute_dispatch_two_mips_${adapter} is registered at CMakeLists.txt:4640 with TIMEOUT 120 and SKIP_RETURN_CODE 77. The dev job's test step (.github/workflows/windows.yml:476-496) has no if:, but it branches on the event: on a pull request it runs cmake --build --preset pr and ctest --preset pr (489), whose include list names no startup_compute_dispatch* entry and whose target list does not build startup_stream_consumer, so neither leg can run there; on any other event it runs ctest --preset dev -E '_hardware$' (494), so the _warp leg runs and the _hardware leg does not.

Limits

  • One adapter, one driver, one OS build, one family, a Debug preset rather than the Release one the body used.
  • Debug layer absent, so the sev=0/1 scan in clean() (66-67) had nothing to inspect: what passes here is the half-readback path, not API validation.
  • One mutant, with the scope note above. In store() the pre-translation refusal is asserted at 90 and the no-Dispatch leg at 102; in store_two_mips() the pre-translation refusal is asserted at 210-211 and that entry has no no-Dispatch leg. None of these legs was mutated.
  • The two views sit 64 and 128 bytes into one descriptor heap; no third binding and no reordered root.

AI-assisted.

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.

2 participants