tests: read back s_pack_ll/lh/hh and s_absdiff_i32 on D3D12 WARP and hardware (follow-up to #2512) #2515

Merged
Leyukaka merged 2 commits from upstream-pr/2523 into main 2026-11-25 20:00:37 +00:00
Leyukaka commented 2026-11-25 19:47:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T19:47:28Z.


Follow-up to #2512, which merged before I pushed this. It adds the D3D12 readback @tedin7 asked for in his review of s_pack_ll_b32_b16, s_pack_lh_b32_b16, s_pack_hh_b32_b16 and s_absdiff_i32. Part of #1723.

tests/startup_gfx2hlsl_pack_absdiff_check.py dispatch <dxc> <offscreen_check> <adapter> (the no-argument mode is unchanged):

  • For each op, it builds one cs_6_0 shader with DXC from the lines gfx2hlsl actually emits, and runs it through offscreen_check --raw-uav-dump.
  • The sources are loaded from the UAV fill pattern and XORed, so DXC cannot fold them.
  • D is stored, and SCC too for s_absdiff_i32. Both are compared with the integer references already in the file.
  • The operand region must come back unchanged.
  • The dump size is padded to whole 16-byte rows, as --raw-uav-dump requires.
  • Registered as startup_gfx2hlsl_pack_absdiff_dispatch_warp and _hardware, with SKIP_RETURN_CODE 77, next to the existing test.

Cases (8 absdiff + 3 x 9 pack = 35 per adapter), covering the edges named in the review:

  • absdiff: (0x80000000, 1) and its reverse, (0x7fffffff, 0x80000000) and its reverse, (5, 5), (0, 0), (0xffffffff, 0), (3, 10);
  • packs: 0xffffffff, 0x0000ffff, 0xffff0000, 0x00010000/0x0000ffff, 0x12345678/0x9abcdef0 and 0/0xffffffff, in both orders where they differ, covering << 16 and & 0xffff0000.

Results at this branch's head (main 396e7e2 plus this commit), Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100, debug layer not enabled:

  • python -B tests/startup_gfx2hlsl_pack_absdiff_check.py: ok.
  • ... dispatch <dxc> <offscreen_check> warp: 35/35 cases, Microsoft Basic Render Driver.
  • ... dispatch <dxc> <offscreen_check> hardware: 35/35 cases, NVIDIA GeForce RTX 5080 (driver 32.0.16.2101).

Mutations in tools/startup/gfx2hlsl.py. Each made both dispatch runs fail; the mismatch counts are per adapter:

  • s_absdiff_i32 without asint: 4;
  • s_absdiff_i32 SCC inverted: 8;
  • s_pack_ll shifting by 15: 7;
  • s_pack_lh masking 0x7fff0000: 4;
  • s_pack_hh shifting by 15: 7.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6612406225 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2523). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T19:47:28Z. --- Follow-up to #2512, which merged before I pushed this. It adds the D3D12 readback @tedin7 asked for in [his review](https://github.com/R0Y00/Xbox2Windows/pull/2512#pullrequestreview-6063663472) of `s_pack_ll_b32_b16`, `s_pack_lh_b32_b16`, `s_pack_hh_b32_b16` and `s_absdiff_i32`. Part of #1723. `tests/startup_gfx2hlsl_pack_absdiff_check.py dispatch <dxc> <offscreen_check> <adapter>` (the no-argument mode is unchanged): - For each op, it builds one cs_6_0 shader with DXC from the lines gfx2hlsl actually emits, and runs it through `offscreen_check --raw-uav-dump`. - The sources are loaded from the UAV fill pattern and XORed, so DXC cannot fold them. - D is stored, and SCC too for `s_absdiff_i32`. Both are compared with the integer references already in the file. - The operand region must come back unchanged. - The dump size is padded to whole 16-byte rows, as `--raw-uav-dump` requires. - Registered as `startup_gfx2hlsl_pack_absdiff_dispatch_warp` and `_hardware`, with `SKIP_RETURN_CODE 77`, next to the existing test. Cases (8 absdiff + 3 x 9 pack = 35 per adapter), covering the edges named in the review: - absdiff: `(0x80000000, 1)` and its reverse, `(0x7fffffff, 0x80000000)` and its reverse, `(5, 5)`, `(0, 0)`, `(0xffffffff, 0)`, `(3, 10)`; - packs: `0xffffffff`, `0x0000ffff`, `0xffff0000`, `0x00010000`/`0x0000ffff`, `0x12345678`/`0x9abcdef0` and `0`/`0xffffffff`, in both orders where they differ, covering `<< 16` and `& 0xffff0000`. **Results** at this branch's head (main `396e7e2` plus this commit), Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100, debug layer not enabled: - `python -B tests/startup_gfx2hlsl_pack_absdiff_check.py`: ok. - `... dispatch <dxc> <offscreen_check> warp`: 35/35 cases, Microsoft Basic Render Driver. - `... dispatch <dxc> <offscreen_check> hardware`: 35/35 cases, NVIDIA GeForce RTX 5080 (driver 32.0.16.2101). **Mutations** in `tools/startup/gfx2hlsl.py`. Each made both dispatch runs fail; the mismatch counts are per adapter: - `s_absdiff_i32` without `asint`: 4; - `s_absdiff_i32` SCC inverted: 8; - `s_pack_ll` shifting by 15: 7; - `s_pack_lh` masking `0x7fff0000`: 4; - `s_pack_hh` shifting by 15: 7. AI-assisted.
upstream-sync closed this pull request 2026-11-25 20:04:38 +00:00
tedin7 commented 2026-11-25 20:04:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:51:36Z.

Review: COMMENTED


Review of head 0aa09869 (comment only).

Checked:

  • The new dispatch mode builds a cs_6_0 shader from the lines gfx2hlsl really emits, XORs the loaded sources so DXC cannot fold them, and compares D (and SCC for s_absdiff_i32) with the integer references already in the file. The operand region is checked unchanged. Real D3D12 readback, not a string check.
  • Edge cases from the #2512 review are covered (INT_MIN, 0x7fffffff/0x80000000 both orders, equal, zero, 0xffff0000/0x0000ffff masks, both orders for packs).
  • Dump size is padded to 16-byte rows as --raw-uav-dump requires. Exit 77 maps to SKIP in CMake for both adapters. Sibling check is registered next to the existing test.
  • No other open or merged PR covers this readback slice (searched s_absdiff_i32 / pack).

Commands run (Linux, worktree of the exact head):

  • python3 -B tests/startup_gfx2hlsl_pack_absdiff_check.py: ok
  • python3 tests/docs_links_check.py: ok
  • python3 tests/bidi_controls_check.py: ok
  • git diff --check origin/main...HEAD: clean

Not run here: the dispatch test needs DXC and D3D12, so it is verified in the Win2025 WARP run that follows.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6064017380 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2523#pullrequestreview-6064017380). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T19:51:36Z. **Review:** COMMENTED --- Review of head 0aa09869 (comment only). Checked: - The new `dispatch` mode builds a cs_6_0 shader from the lines gfx2hlsl really emits, XORs the loaded sources so DXC cannot fold them, and compares D (and SCC for `s_absdiff_i32`) with the integer references already in the file. The operand region is checked unchanged. Real D3D12 readback, not a string check. - Edge cases from the #2512 review are covered (INT_MIN, 0x7fffffff/0x80000000 both orders, equal, zero, 0xffff0000/0x0000ffff masks, both orders for packs). - Dump size is padded to 16-byte rows as `--raw-uav-dump` requires. Exit 77 maps to SKIP in CMake for both adapters. Sibling check is registered next to the existing test. - No other open or merged PR covers this readback slice (searched s_absdiff_i32 / pack). Commands run (Linux, worktree of the exact head): - `python3 -B tests/startup_gfx2hlsl_pack_absdiff_check.py`: ok - `python3 tests/docs_links_check.py`: ok - `python3 tests/bidi_controls_check.py`: ok - `git diff --check origin/main...HEAD`: clean Not run here: the dispatch test needs DXC and D3D12, so it is verified in the Win2025 WARP run that follows. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 20:04:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:00:24Z.


Win2025 WARP receipt for head 18f3d720 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 18f3d720de85565ff8f02c7d1368131a8e840354:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 163.64s (configure 2.82s)
    • Test (ctest --preset dev -R 'startup_gfx2hlsl_pack_absdiff' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (3.00s: startup_gfx2hlsl_pack_absdiff_dispatch_warp 0.57s, startup_gfx2hlsl_pack_absdiff_dispatch_hardware 0.56s, startup_gfx2hlsl_pack_absdiff 2.88s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 86.72s (configure 2.01s)
    • Test (ctest --preset release -R 'startup_gfx2hlsl_pack_absdiff' --parallel 2 --no-tests=error --output-on-failure): 3/3 passed (4.03s: startup_gfx2hlsl_pack_absdiff_dispatch_warp 1.09s, startup_gfx2hlsl_pack_absdiff_dispatch_hardware 0.72s, startup_gfx2hlsl_pack_absdiff 3.81s)
  • Windows Python checks: tests/startup_gfx2hlsl_pack_absdiff_check.py ok (4.2s)
  • sccache hits/wall omitted

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7173054508 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2523#issuecomment-7173054508). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:00:24Z. --- Win2025 WARP receipt for head 18f3d720 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `18f3d720de85565ff8f02c7d1368131a8e840354`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `163.64s` (configure `2.82s`) - Test (`ctest --preset dev -R 'startup_gfx2hlsl_pack_absdiff' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`3.00s`: `startup_gfx2hlsl_pack_absdiff_dispatch_warp` `0.57s`, `startup_gfx2hlsl_pack_absdiff_dispatch_hardware` `0.56s`, `startup_gfx2hlsl_pack_absdiff` `2.88s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `86.72s` (configure `2.01s`) - Test (`ctest --preset release -R 'startup_gfx2hlsl_pack_absdiff' --parallel 2 --no-tests=error --output-on-failure`): **3/3 passed** (`4.03s`: `startup_gfx2hlsl_pack_absdiff_dispatch_warp` `1.09s`, `startup_gfx2hlsl_pack_absdiff_dispatch_hardware` `0.72s`, `startup_gfx2hlsl_pack_absdiff` `3.81s`) - **Windows Python checks**: `tests/startup_gfx2hlsl_pack_absdiff_check.py` ok (`4.2s`) - `sccache` hits/wall omitted AI-assisted; commands listed were executed locally.
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
R0Y00/Xbox2Windows!2515
No description provided.