Skip to content

Check fused results against the shader's recorded FMA mode - #5134

Closed
reviewbd wants to merge 1 commit into
ItsNotRexed:mainfrom
reviewbd:fix/fma-check-build-mode
Closed

reviewbd wants to merge 1 commit into
ItsNotRexed:mainfrom
reviewbd:fix/fma-check-build-mode

Conversation

@reviewbd

Copy link
Copy Markdown

Claimed in the coordination issue as TEST-1147.

What and why

A fresh shell could accept a split multiply-add result for a shader built with --fma exact. Record the selected FMA mode in the shader index and use it in both test runners. Older indexes still use the Vulkan feature flag or the environment.

Tested

On Windows with Python 3.13.15, the fresh-shell regression failed before the fix. All 80 tests in tests/test_shader_checks.py passed after it. A synthetic translation produced the expected index value in each of the three FMA modes. CPU tests only. No GPU, driver or retail shader corpus was used.

AI-assisted: yes

Checklist

  • No game data, keys or decryption.
  • Translator rule documentation is inapplicable. This change records the existing translation mode.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested c53013b on Windows 11 with CPython 3.14.7. The fused multiply-add check passes in all supported modes.

GPU Driver exact glsl khr
NVIDIA GeForce RTX 4090 32.0.16.2101 Pass Pass Pass
AMD Radeon(TM) Graphics 32.0.21043.5001 Pass Pass Skip

The AMD driver reports that it lacks the required shaderFmaFloat32 feature.

I built cs_fma_fused once per mode with the head's runtime/test/shaders/build.py. All three modules pass spirv-val. Each index records the selected mode. In a fresh shell with LEONIDA_FMA unset, I ran the head's fma_fused_test with an existing vk_compute_test executable. VK_DRIVER_FILES selected one adapter per run.

py -3.14 -I tests/test_shader_checks.py passes all 80 tests. With the head's test file on merge base 3faac55, FmaFusedChecks.test_recorded_fma_mode_in_a_fresh_shell fails. The old checker accepts a split result for exact mode.

This hardware check covers the fused fixture only. AI-assisted.

@Atomic258

Copy link
Copy Markdown
Contributor

Independent check — pass (CPU only, no game files).

Environment: Windows 11, CPython 3.15.2.

  • The PR's test: 80/80; parent check.py fails 2+1 (fused FMA mismatches unchecked)

AI-assisted (Devin).

@theswiss24

Copy link
Copy Markdown

GPU run of c53013b5, to add to the CPU checks above: Linux Mint 22.3, NVIDIA GeForce MX150 (580.178.04) and Intel UHD Graphics 630 (Mesa ANV 25.2.8). Full scripts/run_gpu_tests.py with LEONIDA_W64_EMULATE=1, PR merged onto main 3faac557, compared with main at the same commit and test programs built from it.

Result: pass, with no change against main.

GPU main PR
MX150 191/217 passed, 26 skipped 191/217 passed, 26 skipped
UHD 630 (Mesa) 184/217 passed, 31 skipped 184/217 passed, 31 skipped

The pass/skip/fail list is identical test by test. On these two drivers, checking fused results against the recorded FMA mode turns no passing fixture into a failure.

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

@kotekompotek

Copy link
Copy Markdown

Independent Windows CPU verification on c53013b5:

  • python -m pytest tests/test_shader_checks.py --basetemp D:\temp\pytest_tmp -q: 84 passed in 3.15s

@reviewbd

Copy link
Copy Markdown
Author

Closing this duplicate of #5094, which claimed TEST-1147 first. The generator-specific metadata fix continues in #5269 on top of #5094.

@reviewbd reviewbd closed this Nov 23, 2026
@Atomic258

Copy link
Copy Markdown
Contributor

Tested c53013b on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_shader_checks.py -> Ran 80 tests, OK
  • Negative control (tool file swapped to upstream/main): also OK, control does not differentiate on this suite
  • Only the Python part tested; scripts/run_gpu_tests.py change not run (no GPU).

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. 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.

5 participants