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

Open
github-bot wants to merge 1 commit from github-bot/gh-1258 into main AGit
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 21:00 UTC · original
ambroseautomation:carry/old-9827-bvh-exec-guard → main · +51 −1 · 2 files · 1 commits · open

Claimed in the coordination issue as: OLD-9827 (#14)

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)
**@⁠ambroseautomation** on GitHub · 2026-11-24 21:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1258) `ambroseautomation:carry/old-9827-bvh-exec-guard` → `main` · +51 −1 · 2 files · 1 commits · open Claimed in the coordination issue as: OLD-9827 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:44:48 +00:00
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 06:32 UTC · original · approved these changes

Approving. Merged into current main (42537e7) with no conflicts. The full translator suite, including this PR's test, gives 487 files / 6,280 tests with only test_int32_to_f64 failing, as on main here (Linux, Python 3.13).

The structure is sound. The whole node read, from the pointer conversion through every end1/end2 arm, now sits inside one OpSelectionMerge act_end region taken only by active lanes. Nothing after end1 used a value from inside it, so the new merge block doesn't need a phi, and inactive lanes keep vdst because nothing in the skipped region stores to it.

AI-assisted (Claude).

**@⁠tiguan26** on GitHub · 2026-11-25 06:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1258#pullrequestreview-6052887252) · **approved these changes** Approving. Merged into current main (42537e7) with no conflicts. The full translator suite, including this PR's test, gives 487 files / 6,280 tests with only `test_int32_to_f64` failing, as on main here (Linux, Python 3.13). The structure is sound. The whole node read, from the pointer conversion through every `end1`/`end2` arm, now sits inside one `OpSelectionMerge act_end` region taken only by active lanes. Nothing after `end1` used a value from inside it, so the new merge block doesn't need a phi, and inactive lanes keep vdst because nothing in the skipped region stores to it. AI-assisted (Claude).
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 14:38 UTC · original

Reviewed 85ea3e7: ran test_image_bvh_box/tri/box_hw/tri_hw (17 tests) plus the census, tri-probe and decode unit tests - all pass on the PR tree; on main only the new inactive-lane test fails. An 8-lane mixed-EXEC probe (even lanes active at a valid node, odd lanes masked off with a garbage node id) reproduces the bug on main (160 PSB loads through the garbage pointer per wave) and shows it fixed on the PR tree with active-lane results and read counts unchanged and inactive lanes' vdst preserved. No findings. Not run: full semantic suite, spirv-val (not installed), GPU tests. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 14:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1258#issuecomment-7165600967) Reviewed 85ea3e7: ran test_image_bvh_box/tri/box_hw/tri_hw (17 tests) plus the census, tri-probe and decode unit tests - all pass on the PR tree; on main only the new inactive-lane test fails. An 8-lane mixed-EXEC probe (even lanes active at a valid node, odd lanes masked off with a garbage node id) reproduces the bug on main (160 PSB loads through the garbage pointer per wave) and shows it fixed on the PR tree with active-lane results and read counts unchanged and inactive lanes' vdst preserved. No findings. Not run: full semantic suite, spirv-val (not installed), GPU tests. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1258/head:github-bot/gh-1258'
git switch 'github-bot/gh-1258'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1258'
git switch 'github-bot/gh-1258'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1258'
git switch 'github-bot/gh-1258'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1258'
git switch 'main'
git merge --squash 'github-bot/gh-1258'
git switch 'main'
git merge --ff-only 'github-bot/gh-1258'
git switch 'main'
git merge 'github-bot/gh-1258'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.