Skip to content

GPU fixtures: masked SAD, v_swaprel and s_movrels - #4615

Open
YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:feat/fixtures-batch2
Open

YaBulochka wants to merge 1 commit into
ItsNotRexed:mainfrom
YaBulochka:feat/fixtures-batch2

Conversation

@YaBulochka

Copy link
Copy Markdown
Contributor

Three GPU fixtures for rows that had no hardware check: masked byte SAD (v_msad_u8, v_mqsad_u32_u8), v_swaprel_b32, and relative SGPR reads (s_movrels_b32, s_movrels_b64).

  • cs_msad_mqsad.asm covers the masked-byte semantics (a zero S1 byte skips that byte), the wrapping 32-bit accumulator, the four sliding windows of v_mqsad_u32_u8, and UMax - UMin on one byte.
  • cs_swaprel.asm swaps VGPR[D + M0[25:16]] with VGPR[S0 + M0[9:0]], with the M0 bits outside the fields ignored and a self-swap case, and checks that untouched registers survive.
  • cs_movrels.asm moves s[D + M0] / s[D + M0 : D + M0 + 1] from a relative source, including an overlapping destination that reads the next register and an s_cselect proving SCC is not disturbed.

All three are registered in check.py and scripts/run_gpu_tests.py (dumps, wave32 list, wave64 exclusions), with semantic fixture disassembly and CPU tests that pin the words against the model. The four docs/design.md rows now name the fixtures and the measured result instead of "Not GPU-verified".

Measured on the RDNA2 iGPU (gfx1036, RADV RAPHAEL_MENDOCINO, Mesa 27.0.0-devel), exact:

cs_msad_mqsad   48 4294967284 4294967290 7 2147483654 305419900 3735928559 255
cs_swaprel      11 22 55 44 77 55 66 88
cs_movrels      170 204 187 204 187 187 1 238

No translator change was needed: all three matched the derived words on the first run.

pytest for the new semantic tests, the runner tests and the shader checks: 129 passed. build.py: 3/3 translated and spirv-val clean; regen_fixtures.py --check clean; docs tests pass. A full semantic discovery in this worktree reports 7 failures + 2 errors in unrelated files (test_loop_ballot_barrier, test_cmp_class_f64, test_mutations), untouched by this change and present in the base tree.

cs_msad_mqsad covers v_msad_u8 and v_mqsad_u32_u8: masked bytes, the
sliding 64-bit windows, and 32-bit accumulator wraps.
cs_swaprel covers both M0 fields, ignored M0 bits and a self-swap;
cs_movrels covers s_movrels_b32/b64, an overlapping destination and
an unchanged SCC. All three are wave32 dumps registered with check.py
and scripts/run_gpu_tests.py, with CPU fixtures in tests/semantic.

Measured on the RDNA2 iGPU (gfx1036, RADV, Mesa 27.0.0-devel):
all three match their headers bit-for-bit.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at a6f69651 on Windows 11, RTX 5070 Ti.

  • Semantic tests (the repo's no--I invocation, since these import support): test_msad_mqsad_fixture.py 4 tests, OK, test_rel_addressing_fixture.py 6 tests, OK; git diff --check clean.
  • GPU fixtures, built through the runner's translator:
    • --filter msad -> PASS cs_msad_mqsad 48 4294967284 4294967290 7 2147483654 305419900 3735928559 255 (1/1)
    • --filter swaprel -> PASS cs_swaprel 11 22 55 44 77 55 66 88 (1/1)
    • --filter movrels -> PASS cs_movrels 170 204 187 204 187 187 1 238 and PASS cs_movrelsd_2 11 33 33 55 1717 77 1515 1717 (2/2)

All three fixtures translate and spirv-val clean, and the words match check.py's table on hardware. No blocking issue.

@whattheflop whattheflop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested a6f69651 on Windows Radeon iGPU with the AMD 25.10.30.02 proprietary driver. All three validated stock fixtures passed at native subgroup 32, 24/24 readback words matched, and zero Khronos validation errors or warnings were reported. Details in #166. AI-assisted.

@Bushyon

Bushyon commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested a6f6965 on AMD Radeon RX 7800 XT (RDNA3), RADV Mesa 26.2.6 (ACO), Vulkan 1.4.354, subgroup 32..64, Fedora 44; llvm-mc 22.1.8, GCC 16.2.1: pass.

@theswiss24

Copy link
Copy Markdown

Tested a6f69651 (contains main d0835dd9) on two GPUs, test programs built from main d0835dd9 (this PR changes no C++), Linux Mint 22.3, llvm-mc 20.1.2, LEONIDA_W64_EMULATE=1: pass. The three new fixtures pass on both, and every other test has the same result as main:

GPU driver run_gpu_tests.py new
Intel UHD 630 (Gen9.5, subgroup 8..32) Mesa ANV 25.2.8 184/213 passed, 27 skipped (main: 181/210, the same 2 known Intel failures) cs_movrels, cs_msad_mqsad, cs_swaprel PASS
NVIDIA MX150 (Pascal) 580.178.04 188/213 passed, 25 skipped, 0 failed (main: 185/210) cs_movrels, cs_msad_mqsad, cs_swaprel PASS

No game files.

Tested and written by Claude (Claude Code), posting from @theswiss24's account.

@Atomic258

Copy link
Copy Markdown

Tested head a6f69651 — Windows, CPython 3.15.2, CPU only, synthetic fixtures, no game files: pass (Python side).

  • python -m unittest discover -s tests/semantic -p "test_msad_mqsad_fixture.py" -> 4/4 OK.
  • python -m unittest discover -s tests/semantic -p "test_rel_addressing_fixture.py" -> 6/6 OK.
  • Control (main's tree + the PR's test files and .s disasm fixtures): test_msad_mqsad_fixture.py 2 failures + 1 error, test_rel_addressing_fixture.py 4 failures — the expected translation differs on main, as intended.
  • git diff --check and scripts/check_no_game_data.py clean.
  • Not exercised: the new .asm GPU fixtures under runtime/test/shaders/ (they run through run_gpu_tests.py; a GPU pass would cover them separately).

AI-assisted (Devin).

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.

6 participants