[PR #1258] rdna2spirv: guard image_bvh PhysicalStorageBuffer loads on active EXEC lanes (OLD-9827) #1290

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

📋 Pull Request Information

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

Base: main ← Head: carry/old-9827-bvh-exec-guard


📝 Commits (1)

  • 85ea3e7 rdna2spirv: guard image_bvh PhysicalStorageBuffer loads on active EXEC lanes

📊 Changes

2 files changed (+51 additions, -1 deletions)

View changed files

📝 tests/semantic/test_image_bvh_box.py (+42 -0)
📝 tools/rdna2spirv.py (+9 -1)

📄 Description

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

What and why

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

Guards image_bvh*_intersect_ray PhysicalStorageBuffer loads on active EXEC lanes in tools/rdna2spirv.py:

  • Wraps the BVH node pointer dereference and triangle/box intersection body inside an OpSelectionMerge / OpBranchConditional gated on self.active_b(), so inactive lanes (EXEC == 0) in divergent traversal loops never dereference stale or null node pointers and leave vdst untouched.
  • Adds test_inactive_lane_skips_memory_reads_and_preserves_dst in tests/semantic/test_image_bvh_box.py.

Tested

  • python -m unittest discover -s tests/semantic -p test_image_bvh_box.py -v: 5 tests, OK.
  • python -m unittest discover -s tests/semantic -p test_image_bvh_tri.py -v: 7 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6,169 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_image_bvh_box.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 — EXEC guard on existing image_bvh PSB loads)

🔄 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/1258 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9827-bvh-exec-guard` --- ### 📝 Commits (1) - [`85ea3e7`](https://github.com/ubiquitarianism/leonida/commit/85ea3e78a4eed6b6d4b7f4175f234e31ac4b20cc) rdna2spirv: guard image_bvh PhysicalStorageBuffer loads on active EXEC lanes ### 📊 Changes **2 files changed** (+51 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_image_bvh_box.py` (+42 -0) 📝 `tools/rdna2spirv.py` (+9 -1) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9827 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144109503) ### What and why Carries forward `old-pr/9827` (draft #95, original commit author `Lewandox` preserved; indexed in #17), rebased cleanly onto current `main`. Guards `image_bvh*_intersect_ray` `PhysicalStorageBuffer` loads on active `EXEC` lanes in `tools/rdna2spirv.py`: - Wraps the BVH node pointer dereference and triangle/box intersection body inside an `OpSelectionMerge` / `OpBranchConditional` gated on `self.active_b()`, so inactive lanes (`EXEC == 0`) in divergent traversal loops never dereference stale or null node pointers and leave `vdst` untouched. - Adds `test_inactive_lane_skips_memory_reads_and_preserves_dst` in `tests/semantic/test_image_bvh_box.py`. ### Tested - `python -m unittest discover -s tests/semantic -p test_image_bvh_box.py -v`: 5 tests, OK. - `python -m unittest discover -s tests/semantic -p test_image_bvh_tri.py -v`: 7 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 470 files, 6,169 tests, 0 files failed. - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_image_bvh_box.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 — EXEC guard on existing `image_bvh` PSB loads) --- <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#1290
No description provided.