[PR #1112] rdna2spirv: the binary64 VALU ops take clamp and nothing else from their omod (SHADER-F64-OMODS-CARRY) #1147

Open
opened 2026-11-26 20:20:14 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1112
Author: @klikso
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: carry/shader-f64-omods


📝 Commits (4)

  • 8f498be rdna2spirv: the f64 VALU ops keep only clamp, not their omod
  • 74b275a docs+translator: say only clamp applies, as the reviewer asked
  • 4a678d0 test_f64_round: cover the omod on the three rounding ops the existing case leaves open
  • 1a3a65e test_f64_round: a subnormal's result takes clamp and no omod

📊 Changes

11 files changed (+116 additions, -71 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 (+27 -3)
📝 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 (+22 -9)

📄 Description

Claimed in the coordination issue as: SHADER-F64-OMODS-CARRY

What and why

This carries #475 by @fiestorra onto current main: its three commits (9948f1f2f, e3a5bea41, e983b38f6), cherry-picked in order with their author kept and no change of mine. #475 was verified by @Len1k (tests guard the change) and by @moffington on an RTX 3060, reproduced by the author on a Radeon 780M (gfx1036), and then closed by its author on 24 November when he left the project. main still models the omods, and no open pull request carries the change.

The binary64 VALU ops (v_add_f64, v_rcp_f64, v_rsq_f64, v_sqrt_f64, v_trunc_f64, v_ceil_f64, v_rndne_f64, v_floor_f64) can name mul:2, mul:4 or div:2 in their omod field. The author measured on gfx1036 hardware that those omods do nothing for these ops in the mode the translator assumes (binary64 denormals kept); only clamp applies. The translator now passes only the clamp part of the modifier list for these ops, and the fixtures, tests and the docs/design.md rows say so.

@fiestorra: this is your work. If you want it back, say so and I will close this.

Tested

Windows 11 26200.9974, Python 3.13.14 (pytest 9.2.0), llvm-mc 23.1.6 (conda-forge, AMDGPU target), SPIRV-Tools v2026.4. Runtime test programs built from main 3aa975421 with MSVC 19.44; this change does not touch runtime/src or the shims.

The five changed test files, run against main's translator and against this branch's:

main translator this branch
tests/semantic/test_f64_round.py 4 fail pass
tests/semantic/test_valu_add_f64.py 5 fail pass
tests/test_f64_diff.py 1 fail pass
tests/test_f64_output_modifiers.py 5 fail pass
tests/test_f64_transcendentals.py 3 fail pass

run_gpu_tests.py --filter f64, each tree judged by its own check.py, native and with LEONIDA_W64_EMULATE=1 (the two modes give the same words):

Fixture main this branch
cs_f64_add (high word of the mul:2 result) 0x40040000 (2.5) 0x3ff40000 (1.25)
ps_f64_mods 4096/4096 pixels exact 4096/4096 pixels exact, against the new expectations
ps_f64_round, cs_div_fmas_f64, cs_div_fmas_f64_rt pass pass, same words
Total 5/5 passed 5/5 passed

The cs_f64_add pair is the one @moffington reported on the RTX 3060 (1.25 with the change, 2.5 on the merge base). Note what this does and does not show: an NVIDIA device runs the translated SPIR-V, so it confirms the translator emits what the new rule says; the rule itself rests on the author's gfx1036 measurement.

  • python -I scripts/check_no_game_data.py on the eleven changed files: no hits. git diff --check: clean. python -I tests/test_text_write_line_endings.py: pass.

GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Vulkan 1.4.357, Windows 11 26200

AI-assisted: yes (Claude Code; run and measured on the machine above)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed: the commits update the three f64 rows there, confirmed by the author's GPU measurement on gfx1036.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1112 **Author:** [@klikso](https://github.com/klikso) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/shader-f64-omods` --- ### 📝 Commits (4) - [`8f498be`](https://github.com/ubiquitarianism/leonida/commit/8f498bed96771e2051b0e0b35523583d6ecb52a5) rdna2spirv: the f64 VALU ops keep only clamp, not their omod - [`74b275a`](https://github.com/ubiquitarianism/leonida/commit/74b275a9b016b292b759d0712fe354b5e9870733) docs+translator: say only clamp applies, as the reviewer asked - [`4a678d0`](https://github.com/ubiquitarianism/leonida/commit/4a678d0b907381a012f6a98d56ea4bbc0f310157) test_f64_round: cover the omod on the three rounding ops the existing case leaves open - [`1a3a65e`](https://github.com/ubiquitarianism/leonida/commit/1a3a65e0d39f1dbe4ccc9d13c85d07e83b02b7e1) test_f64_round: a subnormal's result takes clamp and no omod ### 📊 Changes **11 files changed** (+116 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `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` (+27 -3) 📝 `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` (+22 -9) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-F64-OMODS-CARRY ### What and why This carries #475 by @fiestorra onto current `main`: its three commits (`9948f1f2f`, `e3a5bea41`, `e983b38f6`), cherry-picked in order with their author kept and no change of mine. #475 was verified by @Len1k (tests guard the change) and by @moffington on an RTX 3060, reproduced by the author on a Radeon 780M (gfx1036), and then closed by its author on 24 November when he left the project. `main` still models the omods, and no open pull request carries the change. The binary64 VALU ops (`v_add_f64`, `v_rcp_f64`, `v_rsq_f64`, `v_sqrt_f64`, `v_trunc_f64`, `v_ceil_f64`, `v_rndne_f64`, `v_floor_f64`) can name `mul:2`, `mul:4` or `div:2` in their omod field. The author measured on gfx1036 hardware that those omods do nothing for these ops in the mode the translator assumes (binary64 denormals kept); only `clamp` applies. The translator now passes only the clamp part of the modifier list for these ops, and the fixtures, tests and the `docs/design.md` rows say so. @fiestorra: this is your work. If you want it back, say so and I will close this. ### Tested Windows 11 26200.9974, Python 3.13.14 (pytest 9.2.0), `llvm-mc` 23.1.6 (conda-forge, AMDGPU target), SPIRV-Tools v2026.4. Runtime test programs built from `main` `3aa975421` with MSVC 19.44; this change does not touch `runtime/src` or the shims. The five changed test files, run against `main`'s translator and against this branch's: | | `main` translator | this branch | |---|---|---| | `tests/semantic/test_f64_round.py` | 4 fail | pass | | `tests/semantic/test_valu_add_f64.py` | 5 fail | pass | | `tests/test_f64_diff.py` | 1 fail | pass | | `tests/test_f64_output_modifiers.py` | 5 fail | pass | | `tests/test_f64_transcendentals.py` | 3 fail | pass | `run_gpu_tests.py --filter f64`, each tree judged by its own `check.py`, native and with `LEONIDA_W64_EMULATE=1` (the two modes give the same words): | Fixture | `main` | this branch | |---|---|---| | `cs_f64_add` (high word of the `mul:2` result) | `0x40040000` (2.5) | `0x3ff40000` (1.25) | | `ps_f64_mods` | 4096/4096 pixels exact | 4096/4096 pixels exact, against the new expectations | | `ps_f64_round`, `cs_div_fmas_f64`, `cs_div_fmas_f64_rt` | pass | pass, same words | | Total | 5/5 passed | 5/5 passed | The `cs_f64_add` pair is the one @moffington reported on the RTX 3060 (1.25 with the change, 2.5 on the merge base). Note what this does and does not show: an NVIDIA device runs the translated SPIR-V, so it confirms the translator emits what the new rule says; the rule itself rests on the author's gfx1036 measurement. - `python -I scripts/check_no_game_data.py` on the eleven changed files: no hits. `git diff --check`: clean. `python -I tests/test_text_write_line_endings.py`: pass. GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Vulkan 1.4.357, Windows 11 26200 AI-assisted: yes (Claude Code; run and measured on the machine above) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed: the commits update the three f64 rows there, confirmed by the author's GPU measurement on gfx1036. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1147
No description provided.