[PR #1163] rdna2spirv: support directed MODE.FP_ROUND[3:2] (+inf/-inf) and dynamic s_setreg_b32 (OLD-9982) #1196

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

📋 Pull Request Information

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

Base: main ← Head: carry/old-9982-mode-fp-round-directed


📝 Commits (2)

  • 0fc211a rdna2spirv: support directed MODE.FP_ROUND[3:2] (+inf/-inf) and dynamic s_setreg_b32
  • bc80aea docs/design.md: add MODE.FP_ROUND[3:2] contract row (OLD-9982)

📊 Changes

4 files changed (+522 additions, -49 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/test_mode_fp_round_directed.py (+386 -0)
📝 tests/semantic/test_scalar_noop_waitcnt.py (+4 -5)
📝 tools/rdna2spirv.py (+131 -44)

📄 Description

Claimed in the coordination issue as: OLD-9982 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141822512)

What and why

Carries forward old-pr/9982 (draft #247, original commit author Lewandox preserved; indexed in #17), rebased cleanly onto current main.

Extends MODE.FP_ROUND[3:2] support in tools/rdna2spirv.py to all four IEEE 754 rounding modes (RN, +inf, -inf, RTZ) and dynamic s_setreg_b32:

  • Adds directed rounding (+inf / -inf) for f16 conversions, f16 arithmetic/OMOD overflow, and f64 arithmetic when MODE.FP_ROUND[3:2] is set via s_round_mode, s_setreg_imm32_b32, or dynamic s_setreg_b32.
  • Adds tests/semantic/test_mode_fp_round_directed.py (5 test cases covering f16 conversions across all four modes, f16 directed arithmetic & cancellation sign, f16 OMOD overflow, s_round_mode + dynamic s_setreg_b32, and f64 directed arithmetic/overflow) and updates tests/semantic/test_scalar_noop_waitcnt.py.

Tested

  • python -m unittest discover -s tests/semantic -p test_mode_fp_round_directed.py -v: 5 tests, OK.
  • python -m unittest discover -s tests/semantic -p test_scalar_noop_waitcnt.py -v: 13 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6,173 tests, 0 files failed.
  • python -m compileall -q make_game.py tools tests: exit 0.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_mode_fp_round_directed.py tests/semantic/test_scalar_noop_waitcnt.py: exit 0 (no game data).

GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10)

AI-assisted: yes

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. (extends existing MODE.FP_ROUND[3:2] rule)

🔄 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/1163 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9982-mode-fp-round-directed` --- ### 📝 Commits (2) - [`0fc211a`](https://github.com/ubiquitarianism/leonida/commit/0fc211afc1b2380153c27a777b75427adf21eb40) rdna2spirv: support directed MODE.FP_ROUND[3:2] (+inf/-inf) and dynamic s_setreg_b32 - [`bc80aea`](https://github.com/ubiquitarianism/leonida/commit/bc80aea937fb8c76044a1c3726cdb270a220ba66) docs/design.md: add MODE.FP_ROUND[3:2] contract row (OLD-9982) ### 📊 Changes **4 files changed** (+522 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/test_mode_fp_round_directed.py` (+386 -0) 📝 `tests/semantic/test_scalar_noop_waitcnt.py` (+4 -5) 📝 `tools/rdna2spirv.py` (+131 -44) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9982 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141822512) ### What and why Carries forward `old-pr/9982` (draft #247, original commit author `Lewandox` preserved; indexed in #17), rebased cleanly onto current `main`. Extends `MODE.FP_ROUND[3:2]` support in `tools/rdna2spirv.py` to all four IEEE 754 rounding modes (`RN`, `+inf`, `-inf`, `RTZ`) and dynamic `s_setreg_b32`: - Adds directed rounding (`+inf` / `-inf`) for f16 conversions, f16 arithmetic/OMOD overflow, and f64 arithmetic when `MODE.FP_ROUND[3:2]` is set via `s_round_mode`, `s_setreg_imm32_b32`, or dynamic `s_setreg_b32`. - Adds `tests/semantic/test_mode_fp_round_directed.py` (5 test cases covering f16 conversions across all four modes, f16 directed arithmetic & cancellation sign, f16 OMOD overflow, `s_round_mode` + dynamic `s_setreg_b32`, and f64 directed arithmetic/overflow) and updates `tests/semantic/test_scalar_noop_waitcnt.py`. ### Tested - `python -m unittest discover -s tests/semantic -p test_mode_fp_round_directed.py -v`: 5 tests, OK. - `python -m unittest discover -s tests/semantic -p test_scalar_noop_waitcnt.py -v`: 13 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 471 files, 6,173 tests, 0 files failed. - `python -m compileall -q make_game.py tools tests`: exit 0. - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_mode_fp_round_directed.py tests/semantic/test_scalar_noop_waitcnt.py`: exit 0 (no game data). GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10) AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (extends existing `MODE.FP_ROUND[3:2]` rule) --- <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#1196
No description provided.