[PR #1212] rdna2spirv: keep NaN-pattern constants out of float-typed selects in image_bvh (OLD-9868) #1244

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

📋 Pull Request Information

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

Base: main ← Head: carry/old-9868-bvh-nan-select


📝 Commits (4)

  • d01324c rdna2spirv: keep NaN-pattern constants out of float-typed selects in image_bvh (#6623)
  • d243053 test_image_bvh_tri: a NaN vertex with a payload returns the canonical NaN words (#6623)
  • fc1fadb test_image_bvh_tri: one blank line between methods
  • 82fde44 test_image_bvh_tri: no select pairs the NaN or miss constant with a computed word

📊 Changes

2 files changed (+52 additions, -3 deletions)

View changed files

📝 tests/semantic/test_image_bvh_tri.py (+31 -1)
📝 tools/rdna2spirv.py (+21 -2)

📄 Description

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

What and why

Carries forward old-pr/9868 (draft #137, originally authored by Conrage, all 4 original commits preserved; indexed in #17), rebased cleanly onto current main.

Keeps NaN-pattern integer constants (0xFFFFFFFF box-miss and 0xFFC00000 canonical NaN) out of float-typed OpSelect instructions in image_bvh*_intersect_ray lowering (tools/rdna2spirv.py):

  • Builds those selects via bitwise (x & keep) | (k & pick) (usel_k) where keep/pick select between two integer constants, preventing drivers like KosmicKrisp (Mesa 26.3.1) from typing the select as float and emitting (NAN) (0x7FC00000) instead of 0xFFFFFFFF / 0xFFC00000.
  • Adds regression tests in tests/semantic/test_image_bvh_tri.py verifying canonical NaN payload handling and asserting that no OpSelect pairs the NaN/miss constants with a computed word.

Tested

  • python -m unittest discover -s tests/semantic -p test_image_bvh_tri.py -v: 9 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6,170 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_image_bvh_tri.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. (n/a — preserves identical integer words for existing image_bvh lowering)

🔄 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/1212 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9868-bvh-nan-select` --- ### 📝 Commits (4) - [`d01324c`](https://github.com/ubiquitarianism/leonida/commit/d01324cda791f42bb8ce94065f0479dd93b0a881) rdna2spirv: keep NaN-pattern constants out of float-typed selects in image_bvh (#6623) - [`d243053`](https://github.com/ubiquitarianism/leonida/commit/d2430532ae9be5662b82df552cda4454b8c088c2) test_image_bvh_tri: a NaN vertex with a payload returns the canonical NaN words (#6623) - [`fc1fadb`](https://github.com/ubiquitarianism/leonida/commit/fc1fadb876bb7141a8e3ad372e43ac68d197b8c3) test_image_bvh_tri: one blank line between methods - [`82fde44`](https://github.com/ubiquitarianism/leonida/commit/82fde44445b597cd30c51db7e97020a80a2e78df) test_image_bvh_tri: no select pairs the NaN or miss constant with a computed word ### 📊 Changes **2 files changed** (+52 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_image_bvh_tri.py` (+31 -1) 📝 `tools/rdna2spirv.py` (+21 -2) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9868 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143233478) ### What and why Carries forward `old-pr/9868` (draft #137, originally authored by `Conrage`, all 4 original commits preserved; indexed in #17), rebased cleanly onto current `main`. Keeps NaN-pattern integer constants (`0xFFFFFFFF` box-miss and `0xFFC00000` canonical NaN) out of float-typed `OpSelect` instructions in `image_bvh*_intersect_ray` lowering (`tools/rdna2spirv.py`): - Builds those selects via bitwise `(x & keep) | (k & pick)` (`usel_k`) where `keep`/`pick` select between two integer constants, preventing drivers like KosmicKrisp (Mesa 26.3.1) from typing the select as float and emitting `(NAN)` (`0x7FC00000`) instead of `0xFFFFFFFF` / `0xFFC00000`. - Adds regression tests in `tests/semantic/test_image_bvh_tri.py` verifying canonical NaN payload handling and asserting that no `OpSelect` pairs the NaN/miss constants with a computed word. ### Tested - `python -m unittest discover -s tests/semantic -p test_image_bvh_tri.py -v`: 9 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 470 files, 6,170 tests, 0 files failed. - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_image_bvh_tri.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. (n/a — preserves identical integer words for existing `image_bvh` lowering) --- <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#1244
No description provided.