[PR #572] [MERGED] rdna2spirv, docs: NVIDIA splits a binary64 Fma only when folding an all-constant one; add cs_div_fmas_f64_rt (FMA64-RT) #617

Closed
opened 2026-11-26 20:18:28 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/572
Author: @DeSunShine
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: fma64-rt


📝 Commits (2)

  • ce75f14 docs/design.md, rdna2spirv: NVIDIA splits a binary64 Fma only when it folds an all-constant one
  • 10b0052 cs_div_fmas_f64_rt: the run-time-operand twin, and name the measured GPUs

📊 Changes

6 files changed (+33 additions, -7 deletions)

View changed files

📝 docs/design.md (+1 -1)
📝 runtime/test/shaders/cs_div_fmas_f64.asm (+2 -1)
➕ runtime/test/shaders/cs_div_fmas_f64_rt.asm (+18 -0)
📝 scripts/run_gpu_tests.py (+8 -3)
📝 tests/semantic/test_fma_khr_f64.py (+2 -1)
📝 tools/rdna2spirv.py (+2 -1)

📄 Description

Claim: FMA64-RT (issue #14). Carries on old upstream #8750, which was closed unmerged shortly before the original repository went private.

What changes

The binary64 Fma note added with the f64 FMA fix said NVIDIA's driver rounds GLSL Fma on doubles twice. That is too broad. Turing, Ampere and Ada split only an all-constant Fma that the driver folds while compiling the pipeline. The same operands read at run time are fused. Blackwell fuses both.

  • Wording in tools/rdna2spirv.py, docs/design.md, runtime/test/shaders/cs_div_fmas_f64.asm, scripts/run_gpu_tests.py and tests/semantic/test_fma_khr_f64.py now says this.
  • New fixture runtime/test/shaders/cs_div_fmas_f64_rt.asm: the same fma(a, a, c) cancellation probe (a = 1 + 2^-30, c = -(1 + 2^-29)) with its operands in s4..s7, seeded through VKC_SGPRS. The runner handles both fixtures in one branch.

Tested

RTX 4090, driver 621.24, Windows 11, default --fma glsl:

PASS  cs_div_fmas_f64       0x0 0x0 (split: ... when folding the constants; --fma khr fixes it)
PASS  cs_div_fmas_f64_rt    0x0 0x3c300000

The second result is fused (2^-60). The run-time result was also measured fused on an RTX 3070 (621.01) and an RTX 5060 Laptop, and on an RTX 4070 by the author of old #4536. tests/semantic/test_fma_khr_f64.py passes 5/5.

Synthetic fixtures only. No game files.

🤖 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/572 **Author:** [@DeSunShine](https://github.com/DeSunShine) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `fma64-rt` --- ### 📝 Commits (2) - [`ce75f14`](https://github.com/ubiquitarianism/leonida/commit/ce75f144c729d22f4b9cae8c310a3bc814a6c56d) docs/design.md, rdna2spirv: NVIDIA splits a binary64 Fma only when it folds an all-constant one - [`10b0052`](https://github.com/ubiquitarianism/leonida/commit/10b0052e570cc6786681bbcf36b61d85b20fc5a8) cs_div_fmas_f64_rt: the run-time-operand twin, and name the measured GPUs ### 📊 Changes **6 files changed** (+33 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -1) 📝 `runtime/test/shaders/cs_div_fmas_f64.asm` (+2 -1) ➕ `runtime/test/shaders/cs_div_fmas_f64_rt.asm` (+18 -0) 📝 `scripts/run_gpu_tests.py` (+8 -3) 📝 `tests/semantic/test_fma_khr_f64.py` (+2 -1) 📝 `tools/rdna2spirv.py` (+2 -1) </details> ### 📄 Description Claim: FMA64-RT (issue #14). Carries on old upstream #8750, which was closed unmerged shortly before the original repository went private. ## What changes The binary64 `Fma` note added with the f64 FMA fix said NVIDIA's driver rounds GLSL `Fma` on doubles twice. That is too broad. Turing, Ampere and Ada split only an **all-constant** `Fma` that the driver folds while compiling the pipeline. The same operands read at run time are fused. Blackwell fuses both. - Wording in `tools/rdna2spirv.py`, `docs/design.md`, `runtime/test/shaders/cs_div_fmas_f64.asm`, `scripts/run_gpu_tests.py` and `tests/semantic/test_fma_khr_f64.py` now says this. - New fixture `runtime/test/shaders/cs_div_fmas_f64_rt.asm`: the same `fma(a, a, c)` cancellation probe (a = 1 + 2^-30, c = -(1 + 2^-29)) with its operands in s4..s7, seeded through `VKC_SGPRS`. The runner handles both fixtures in one branch. ## Tested RTX 4090, driver 621.24, Windows 11, default `--fma glsl`: ``` PASS cs_div_fmas_f64 0x0 0x0 (split: ... when folding the constants; --fma khr fixes it) PASS cs_div_fmas_f64_rt 0x0 0x3c300000 ``` The second result is fused (2^-60). The run-time result was also measured fused on an RTX 3070 (621.01) and an RTX 5060 Laptop, and on an RTX 4070 by the author of old #4536. `tests/semantic/test_fma_khr_f64.py` passes 5/5. Synthetic fixtures only. No game files. 🤖 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>
4ld0 2026-11-26 20:18:28 +01:00
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#617
No description provided.