mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #1724] tests: cs_fma_fused takes its f16 operands at run time, like its f32 ones (TEST-FMA-FUSED-F16-RUNTIME) #1736
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1736
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1724
Author: @hugo0024
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:test-fma-fused-f16-runtime📝 Commits (3)
e2634e4tests: cs_fma_fused takes its f16 operands at run time, like its f32 ones (TEST-FMA-FUSED-F16-RUNTIME)ebb0b0bdocs: cs_fma_fused reads 0x7352 in its f16 word on KosmicKrisp at run time51439f9ci: cs_fma_fused is no longer an expected failure of the macOS job📊 Changes
5 files changed (+112 additions, -7 deletions)
View changed files
📝
.github/workflows/runtime.yml(+1 -3)📝
docs/testing.md(+2 -1)📝
runtime/test/shaders/cs_fma_fused.asm(+9 -3)📝
tests/semantic/README.md(+4 -0)➕
tests/semantic/test_fma_fused_fixture.py(+96 -0)📄 Description
Claimed in the coordination issue as: TEST-FMA-FUSED-F16-RUNTIME (claim)
Depends on: #860
It does not build on #860; the two conflict. Both edit neighbouring Known problems rows of
docs/testing.md, so whichever merges second needs a rebase that keeps both rows.What and why
cs_fma_fusedfails on a Mac with MoltenVK 1.4.2 in word 7, thev_fma_f16:docs/testing.mdhas a Known problems row for it and the macOS job lists it inEXPECTED_FAILURES. On an Apple M5 the word reads0x0000, want0x7351.The translation is not what is wrong. The fixture reads the operands of its f32 multiply-adds from
s4..s7"so a driver cannot fold the multiply-adds at compile time", but the three operands of the f16 one were literals, so that whole multiply-add was a compile-time constant, and MoltenVK 1.4.2 gets that constant wrong. Measured on the M5 with the fixture otherwise unchanged:main)0x00000x73510x73510x7351runtime/test/shaders/cs_fma_fused.asm: the f16 triple is thes4word XOR a literal each (0x3f800800 ^ 0x3f8064e1 = 0x6ce1, and so on), so it is the same triple at run time, and the header says why.tests/semantic/test_fma_fused_fixture.py: the translated fixture gives the eight words of its header in the interpreter, and every register one of its multiply-adds reads comes froms4..s7, so a literal operand cannot come back unnoticed.docs/testing.md: the Known problems row now says what is left, an f16 multiply-add whose three operands are all constants, and that the fixture no longer has one.tests/semantic/README.mdlists the new test.The translator,
check.pyandrun_gpu_tests.pyare not changed: the expected words are the same..github/workflows/runtime.ymlstill listscs_fma_fusedin the macOS job'sEXPECTED_FAILURES. I left it: that runner's Metal device is not an M5, and an expected failure that passes only gets a notice there. If this pull request's macOS run shows that notice, the entry can go.Tested
Apple M5, MoltenVK 1.4.2, llvm-mc 23.1.6, SPIRV-Tools v2026.4. Before is
main626d1281a, after is this branch on3de22a190(the fixture, the translator and the two runners are the same at both), with the test programs built from626d1281a.run_gpu_tests.py --filter cs_fma_fused, 5 runsword 7 (f16): got 0x00000000, want 0x000073518/8 fused exact (GLSL Fma)LEONIDA_FMA=exact, 5 runsLEONIDA_W64_EMULATE=1build.py <out> cs_fma_fused, thencheck.pyword 7 (f16): got 0x00000000, want 0x00007351okrun_gpu_tests.py, all testscs_fma_fused,cs_imgatomic_extcs_imgatomic_ext,ps_imgatomiccs_fma_fused(fail to pass) andps_imgatomic(pass to fail). The second is the intermittent #543, not this change: its module is byte-identical in both runs, and run alone six times it passes five and fails one in each tree.cs_imgatomic_extis red onmainand claimed by someone else (GPU-IMG-ATOMIC-EXT-VOLUME-TAG).273 shaders: 272 translated, 272 pass spirv-valin both, and 1 of the 275 modules in the work folder changes:cs_fma_fused.LEONIDA_FMA=exactpassed before is the same effect, not a fix: it changes only how the f32 multiply-adds around the f16 one are translated; the f16 one does not useFmain either mode (Gen.fma_f16_odd).tests/semantic/test_fma_fused_fixture.py: 3 tests pass; againstmain's fixture the run-time check fails (['v15', 'v16', 'v17'] != []). With one operand word changed by one bit the eight-word check fails, so it does compare.python3 -I scripts/run_semantic_tests.py tests/semantic: 487 files, 6,279 tests, 0 failed before; 488 files, 6,282 tests, 0 failed after.tests/test_translate.pyoncs_dpp_cmp.asm, #1375's subject;cs_fma_fused.asmassembles and validates there as before).main; none is touched here (#1412, #1561 and #1657 are open for them).tests/test_docs_*.pypass;python3 -I scripts/check_no_game_data.pyis clean on the new test and the fixture.Not tested: any GPU other than the M5, and the macOS runner's device. On a driver that evaluated the constant correctly the only change is that the f16 word is computed at run time.
GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.