mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #475] [CLOSED] SHADER-F64-OMODS: the binary64 VALU ops take clamp and nothing else from their omod #525
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#525
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/475
Author: @fiestorra
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:carry/f64-omod-clamp📝 Commits (3)
9948f1frdna2spirv: the f64 VALU ops keep only clamp, not their omode3a5beadocs+translator: say only clamp applies, as the reviewer askede983b38test_f64_round: cover the omod on the three rounding ops the existing case leaves open📊 Changes
11 files changed (+108 additions, -67 deletions)
View changed files
📝
docs/design.md(+3 -3)📝
runtime/test/shaders/check.py(+1 -1)📝
runtime/test/shaders/cs_f64_add.asm(+2 -1)📝
runtime/test/shaders/ps_f64_mods.asm(+7 -4)📝
scripts/run_gpu_tests.py(+2 -2)📝
tests/semantic/test_f64_round.py(+22 -1)📝
tests/semantic/test_valu_add_f64.py(+10 -8)📝
tests/test_f64_diff.py(+8 -3)📝
tests/test_f64_output_modifiers.py(+21 -22)📝
tests/test_f64_transcendentals.py(+13 -15)📝
tools/rdna2spirv.py(+19 -7)📄 Description
Claimed in the coordination issue as:
SHADER-F64-OMODS(claim comment).What this changes
The VOP3 profiles for the binary64 VALU ops carry both
HasClampandHasOMod(binary64 is a modifier type), so av_add_f64/v_rcp_f64/v_rsq_f64/v_sqrt_f64/v_trunc_f64/v_ceil_f64/v_rndne_f64/v_floor_f64encoding can namemul:2,mul:4ordiv:2in its omod field. On a gfx1036 iGPU those omods do nothing for these ops while binary64 denormals are kept, which is the mode this translator assumes: they only take effect withMODE.IEEEoff and f64 denormals flushed.clampis the one that applies in the mode we model. Measured on the device withruntime/test/shaders/ps_f64_mods.asmandcs_f64_add.asm, written up in the "v_add_f64 output modifiers" row and named in thev_rcp_f64, v_rsq_f64, v_sqrt_f64andv_trunc_f64, v_ceil_f64, v_rndne_f64, v_floor_f64rows ofdocs/design.md.So the translator must not model them.
tools/rdna2spirv.pynow passes only the clamp part of the modifier list toclamp_mods_f64anddst_f64for the binary64 arithmetic and rounding ops ([m for m in mods if m == "clamp"]), with a comment naming the measurement and the row that records it, and a caller whose own row measured an omod still gets its own behaviour. A listing that namesmul:2on av_add_f64now compiles to the same value as the same listing without the omod, instead of a scaled one.About the rebase
This is the content of the branch the private tracker carried as #4371, rebased onto
ece4ba5b3as three commits (9948f1f2f,e3a5bea41,e983b38f6). Both conflicts were in one file,tests/test_f64_output_modifiers.py:mainwrites the VGPR word of the destination directly, and my first version of the test read it through anOpAccessChain-style register load, so I keptmain's side of both hunks. My fourth commit,382366e5d("tests: read the f64 destination write the way a VGPR word is written now"), existed only to adapt that test to the older shape and models nothing, so it is not in this branch: I dropped it withgit rebase --skip. Nothing else was dropped, and the diff overmainis the same 11 files:Evidence on
ece4ba5b3Head
e983b38f6. Tools: CPython 3.13.14,pytest 9.2.0,llvm-mc21.1.8 built byscripts/build_llvm_mc.ps1,spirv-as/spirv-valfrom Vulkan SDK 1.4.363.0, Windows build 26300.LEONIDA_HW_ARCH=gfx1036was set for the device measurement described above, which was made on this machine's gfx1036 iGPU on 2026-11-22 and 2026-11-23 on the previous base; nothing in today's re-measurement needed a GPU.py -3.13 -m pytest tests/test_f64_output_modifiers.py tests/test_f64_diff.py tests/test_f64_transcendentals.py -q— cleanece4ba5b3:35 passed, 591 subtests passed in 2.83s. This branch:35 passed, 591 subtests passed in 2.83s. Nothing that passes today stops passing.py -3.13 -I -m unittest discover -s tests/semantic -p "test_f64_round.py"— cleanece4ba5b3:Ran 6 tests / OK. This branch:Ran 7 tests / OK.test_valu_add_f64.py:Ran 8 tests / OKboth sides.tools/rdna2spirv.pyfromece4ba5b3):py -3.13 -m pytest tests/test_f64_output_modifiers.py tests/test_f64_diff.py tests/test_f64_transcendentals.py -q→9 failed, 34 passed, 583 subtests, includingSUBFAILED(op='v_rsq_f64_e64', mods='clamp div:2')andSUBFAILED(op='v_sqrt_f64_e64', mods='clamp mul:4'), and the semantic files fail astest_f64_roundFAILED (failures=4)andtest_valu_add_f64FAILED (failures=5). So every new assertion fails againstmain's translator and passes with this change.py -3.13 -I scripts/run_semantic_tests.py tests/semantic), withllvm-mconPATHandLLVM_MCunset: cleanece4ba5b3465 files, 6103 tests, 0 files failed in 440 s with 16 jobs. This branch:465 files, 6104 tests, 0 files failed in 458 s with 16 jobs. Same 465 files, nothing red either side, and the one extra test is the added rounding case.Written with an AI assistant.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.