[PR #1374] rdna2spirv: v_mul/fma/min/max_f64 and the f64 <-> f32/int conversions… #1404

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

📋 Pull Request Information

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

Base: main ← Head: shader-f64-valu-ops


📝 Commits (3)

  • 2e6fc3c rdna2spirv: v_mul/fma/min/max_f64 and the f64 <-> f32/int conversions (SHADER-F64-VALU-OPS)
  • a44423b rdna2spirv: the f64 results of SHADER-F64-VALU-OPS ignore the omod, as measured for the other f64 results
  • 1b0442f Merge main into shader-f64-valu-ops

📊 Changes

7 files changed (+425 additions, -44 deletions)

View changed files

📝 docs/design.md (+2 -1)
📝 tests/semantic/spirv_mini_interp.py (+7 -0)
📝 tests/semantic/test_valu_cvt_int_f64.py (+80 -28)
➕ tests/semantic/test_valu_f64_ops.py (+220 -0)
📝 tools/f64_diff.py (+1 -1)
📝 tools/rdna2spirv.py (+113 -13)
📝 tools/shader_ir.py (+2 -1)

📄 Description

… (SHADER-F64-VALU-OPS)

The translator refused seven binary64 VALU ops by name. Gen.f64_valu now lowers them:

  • v_mul_f64: OpFMul; v_fma_f64: one rounding through Gen.emit_fma64
  • v_min_f64/v_max_f64: NMin/NMax with S0 selected when S1 is a NaN, the rule measured for the f32/f16 forms (one NaN gives the other operand, two give S0)
  • v_cvt_f64_f32: exact OpFConvert; an f32 denormal source reads as a signed zero under the game's MODE, as the measured v_floor/ceil/fract_f32 do
  • v_cvt_i32_f64/v_cvt_u32_f64: truncate, saturate (infinities included), NaN -> 0, per the RDNA2 ISA, as the f32 forms do

Source abs/neg apply; f64 results take clamp/omod through clamp_mods_f64 as v_add_f64 does; integer results take no output modifier. v_mul/v_fma_f64 are refused under a directed MODE.FP_ROUND, which only v_add_f64 models.

shader_ir flags their hex literal sources as f64 literals (bits 63:32); spirv_mini_interp gets OpFConvert; docs/design.md gets a contract row. tests/semantic/test_valu_f64_ops.py is new, and test_valu_cvt_int_f64.py, which asserted the integer conversions are refused until implemented, now runs them through the translator. CPU interpreter and spirv-val only; not GPU-checked.

AI-assisted.

Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

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.

🔄 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/1374 **Author:** [@vsking2000](https://github.com/vsking2000) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `shader-f64-valu-ops` --- ### 📝 Commits (3) - [`2e6fc3c`](https://github.com/ubiquitarianism/leonida/commit/2e6fc3c642f10afed83b5c350093ad4f5ee0f685) rdna2spirv: v_mul/fma/min/max_f64 and the f64 <-> f32/int conversions (SHADER-F64-VALU-OPS) - [`a44423b`](https://github.com/ubiquitarianism/leonida/commit/a44423b894a0d4f579d77dc7a211368785fb3d54) rdna2spirv: the f64 results of SHADER-F64-VALU-OPS ignore the omod, as measured for the other f64 results - [`1b0442f`](https://github.com/ubiquitarianism/leonida/commit/1b0442fcf72d66ad244ad0709904dae06303f961) Merge main into shader-f64-valu-ops ### 📊 Changes **7 files changed** (+425 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+2 -1) 📝 `tests/semantic/spirv_mini_interp.py` (+7 -0) 📝 `tests/semantic/test_valu_cvt_int_f64.py` (+80 -28) ➕ `tests/semantic/test_valu_f64_ops.py` (+220 -0) 📝 `tools/f64_diff.py` (+1 -1) 📝 `tools/rdna2spirv.py` (+113 -13) 📝 `tools/shader_ir.py` (+2 -1) </details> ### 📄 Description … (SHADER-F64-VALU-OPS) The translator refused seven binary64 VALU ops by name. Gen.f64_valu now lowers them: - v_mul_f64: OpFMul; v_fma_f64: one rounding through Gen.emit_fma64 - v_min_f64/v_max_f64: NMin/NMax with S0 selected when S1 is a NaN, the rule measured for the f32/f16 forms (one NaN gives the other operand, two give S0) - v_cvt_f64_f32: exact OpFConvert; an f32 denormal source reads as a signed zero under the game's MODE, as the measured v_floor/ceil/fract_f32 do - v_cvt_i32_f64/v_cvt_u32_f64: truncate, saturate (infinities included), NaN -> 0, per the RDNA2 ISA, as the f32 forms do Source abs/neg apply; f64 results take clamp/omod through clamp_mods_f64 as v_add_f64 does; integer results take no output modifier. v_mul/v_fma_f64 are refused under a directed MODE.FP_ROUND, which only v_add_f64 models. shader_ir flags their hex literal sources as f64 literals (bits 63:32); spirv_mini_interp gets OpFConvert; docs/design.md gets a contract row. tests/semantic/test_valu_f64_ops.py is new, and test_valu_cvt_int_f64.py, which asserted the integer conversions are refused until implemented, now runs them through the translator. CPU interpreter and spirv-val only; not GPU-checked. AI-assisted. Claude-Session: https://claude.ai/code/session_01Y7fbZYVY7EtLknWBZUfSLf Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### 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. --- <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#1404
No description provided.