Skip to content

GPU test for packed half FMA literal selection and fused rounding - #6153

Open
kacper-serewis wants to merge 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:test/packed-half-literal-gpu
Open

kacper-serewis wants to merge 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:test/packed-half-literal-gpu

Conversation

@kacper-serewis

Copy link
Copy Markdown
Contributor

Coordination claim on #6089. Based directly on main, independent of #6048, #5412 and #5665.

Run four hand-written packed FMAs through both GPU test entry points. A finite two-half literal and an inline float occupy the same source slot under the same selectors. The fixture header derives the expected words from exact fractions. All inputs are synthetic.

AI-assisted. On Windows, NVIDIA GeForce RTX 5070, driver 616.56, the normal runner with --filter ps_pk_fma_literal --require-pass translated and passed spirv-val, then matched 4096/4096 pixels exactly. Flipping the first high-result literal selector produced 0x3c208c00 instead of 0x40008c00. Splitting the first FMA into packed multiply and add produced 0x40000000. Both mutations passed spirv-val and each failed all 4096 pixels.

@theswiss24

Copy link
Copy Markdown

Tested 6c9259438 on four GPUs, Linux. Full scripts/run_gpu_tests.py with LEONIDA_W64_EMULATE=1, PR merged onto main 561b65a83, compared with main at the same commit and test programs built from it.

Result: pass. ps_pk_fma_literal passes on all four GPUs, and every other test has the same result as on main.

GPU main PR
GTX 1650 (595.99.02, Ubuntu 24.04) 214/232 passed, 17 skipped 215/233 passed, 17 skipped
UHD 630 (Mesa ANV 25.2.8, Ubuntu 24.04) 197/232 passed, 33 skipped 198/233 passed, 33 skipped
MX150 (580.178.04, Linux Mint 22.3) 204/232 passed, 28 skipped 205/233 passed, 28 skipped
UHD 630 (Mesa ANV 25.2.8, Linux Mint 22.3) 197/232 passed, 33 skipped 198/233 passed, 33 skipped

Tested and written by Claude (Claude Code).

@FIocker

FIocker commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent Windows 11 / RTX 5080 (NVIDIA 621.01) check of 6c925943. The normal run_gpu_tests.py --filter ps_pk_fma_literal --require-pass run translated the fixture, passed SPIR-V validation and matched all 4,096 pixels. The same shader also passed check.py's pixel_test entry point. As an extra check I ran spirv-opt -O, validated that output for Vulkan 1.3, and repeated the same GPU readback. All four packed words still matched on every pixel. Synthetic shaders only. AI-assisted.

@Jadiac5

Jadiac5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 6c92594 on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010 (subgroup 32..64): pass

  • python -I scripts/run_gpu_tests.py --build <build> --filter ps_pk_fma_literal --require-pass with Python 3.12 and llvm-mc from ROCm 7.1: 1 shader translated, 1 passes spirv-val, 4096/4096 pixels exact, exit 0. Same result with LEONIDA_VK_VALIDATION=1.
  • runtime/test/shaders/check.py on a full build.py output: ps_pk_fma_literal ok, 201 of 204 pass, 3 skipped, exit 0. The two entry points agree on the expected words in PIXEL_BITS and const_wants.
  • The PR changes no production file, so no negative control. I did not repeat the author's two mutations.
  • Not done: no mutation run on this GPU.

AI-assisted (Claude Code).

@kacper-serewis

Copy link
Copy Markdown
Contributor Author

Merged main at 1cc6e3c12 into the existing branch at e2148f4af. Both runners retain the upstream color-mask check and the packed-FMA check.

AI-assisted verification on Windows with synthetic inputs only. LLVM 21 assembled the original fixture and both negative controls. The production --filter ps_pk_fma_literal --require-pass selection picked just this case with wave64 emulation both off and on. All six translations passed spirv-val for Vulkan 1.2. I executed each fragment with the CPU interpreter and supplied its output as a constant frame to both production pixel checkers. Both accepted the original and rejected the selector flip and split multiply/add in each mode.

The old and new fragment modules produce identical fixture output on CPU, but their SPIR-V differs. The RTX 5070 result in the description applies to the previous head. This merge has CPU and validator coverage only.

@kacper-serewis

Copy link
Copy Markdown
Contributor Author

Hardware acceptance passed at e2148f4af33eb57eb7d1e487642db4755336d7ac on Windows, NVIDIA RTX 5070, driver 616.56. I ran scripts/run_gpu_tests.py --filter ps_pk_fma_literal --require-pass with LEONIDA_W64_EMULATE=0 and =1, using LLVM 21.1.8 and synthetic inputs. All six translations passed spirv-val.

In each configuration, all 4,096 pixels read 40008c00 42008c00 4200bc00 4400bc00 (hex). Flipping the first high-result literal selector changed red to 3c208c00. Splitting the first FMA into packed multiply and add changed red to 40000000. Each control failed all 4,096 pixels, exited 1, and preserved green, blue and alpha across the full readback. AI-assisted.

@Mortify7612

Copy link
Copy Markdown

Tested e2148f4a merged onto main 1cc6e3c1 (clean) on AMD Radeon RX 9060 XT (RDNA4, GFX1200, subgroup 32..64), RADV Mesa 25.0.7, Debian 12 Linux, llvm-mc 23.1.6: pass. I ran run_gpu_tests.py --filter <fixture> for the fixture(s) this PR adds or changes, not the full suite:

PASS ps_pk_fma_literal 4096/4096 pixels exact

AI-assisted (Claude Code).

@LukeOsland1

Copy link
Copy Markdown

Tested e2148f4af3 on Windows 11 build 26300, NVIDIA RTX 4070 Ti SUPER, driver 610.88. I used the PR’s GPU runner with LLVM 23.1.6 and the MSVC-built harness from the tested sources. The Vulkan loader was restricted to the NVIDIA ICD.

  • ps_pk_fma_literal — 4096/4096 pixels exact.

Xbox 1.0.2.1 coverage: 47 of 26,503 local shaders.rpf listings contain at least one of the following mnemonics. Static instruction counts (combining e32/e64 spellings): v_pk_fma_f16 480. The counts describe opcode presence. The GPU readback above uses the hand-written fixture. AI-assisted with Codex.

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