[PR #177] [MERGED] spirv_gs_to_compute: derived input/output pointers keep the capture's storage class (OLD-4126) #228

Closed
opened 2026-11-26 20:17:12 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/177
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: geometry-capture-storage-class


📝 Commits (1)

  • 2f9fd8f spirv_gs_to_compute: a pointer derived from a captured input or output keeps the new storage class

📊 Changes

2 files changed (+58 additions, -0 deletions)

View changed files

📝 tests/test_spirv_gs_to_compute.py (+43 -0)
📝 tools/spirv_gs_to_compute.py (+15 -0)

📄 Description

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

What and why

Old #4126: the geometry capture pass (tools/spirv_gs_to_compute.py) rewrites an access chain on a GS input to point into the input buffer (StorageBuffer), and one on a GS output to point at the matching private variable. A pointer derived from that result — another OpAccessChain / OpInBoundsAccessChain / OpPtrAccessChain, or an OpCopyObject — was passed through unchanged, so it still had its old Input / Output pointer type over a base in another storage class, which makes an invalid module.

The rewrite now tracks every pointer it moved to the input buffer or to a private output variable, and gives anything derived from one the same storage class (%gsc_ptr_sb_* / %gsc_ptr_pv_*, for vec4 and float pointees, the only types those hold). A derived pointer to any other type now raises Unsupported instead of being given the wrong type.

Tested

Windows 11, Python 3.11.9, no GPU needed. spirv-as / spirv-val are not on PATH here, so the tests that need them were skipped (25); the new test also runs spirv-val on both modules when those tools are present.

  • Repro on origin/main with a hand-built GS (%pc = OpCopyObject %ptr_in_v4 %p, %py = OpInBoundsAccessChain %ptr_in_float %pc %u1, %oc = OpCopyObject %ptr_out_float %ox): output kept %ptr_in_v4 / %ptr_in_float / %ptr_out_float.
  • python -m pytest -q tests/test_spirv_gs_to_compute.py tests/test_spirv_gs_to_compute_bounds.py: before the fix 1 failed (new test), 4 passed, 25 skipped; after it 12 passed, 25 skipped.
  • python -I scripts/run_semantic_tests.py tests/semantic: 463 files, 6075 tests, 4 files failed: test_exec_computed, test_image_atomics_guard, test_sopc_validation, test_unary_f16_validation (the same four fail on main on this machine; unrelated to this tool).
  • python -I scripts/check_no_game_data.py on both changed files: clean.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule, so nothing to add to the contract table of docs/design.md (capture-pass rewrite only).

🔄 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/177 **Author:** [@ItsMrDubey](https://github.com/ItsMrDubey) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `geometry-capture-storage-class` --- ### 📝 Commits (1) - [`2f9fd8f`](https://github.com/ubiquitarianism/leonida/commit/2f9fd8ff83d4b57714de6ec966d92ddc76eb5cc0) spirv_gs_to_compute: a pointer derived from a captured input or output keeps the new storage class ### 📊 Changes **2 files changed** (+58 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_spirv_gs_to_compute.py` (+43 -0) 📝 `tools/spirv_gs_to_compute.py` (+15 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-4126 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964) ### What and why Old #4126: the geometry capture pass (`tools/spirv_gs_to_compute.py`) rewrites an access chain on a GS input to point into the input buffer (`StorageBuffer`), and one on a GS output to point at the matching private variable. A pointer derived from that result — another `OpAccessChain` / `OpInBoundsAccessChain` / `OpPtrAccessChain`, or an `OpCopyObject` — was passed through unchanged, so it still had its old `Input` / `Output` pointer type over a base in another storage class, which makes an invalid module. The rewrite now tracks every pointer it moved to the input buffer or to a private output variable, and gives anything derived from one the same storage class (`%gsc_ptr_sb_*` / `%gsc_ptr_pv_*`, for vec4 and float pointees, the only types those hold). A derived pointer to any other type now raises `Unsupported` instead of being given the wrong type. ### Tested Windows 11, Python 3.11.9, no GPU needed. spirv-as / spirv-val are not on PATH here, so the tests that need them were skipped (25); the new test also runs spirv-val on both modules when those tools are present. - Repro on origin/main with a hand-built GS (`%pc = OpCopyObject %ptr_in_v4 %p`, `%py = OpInBoundsAccessChain %ptr_in_float %pc %u1`, `%oc = OpCopyObject %ptr_out_float %ox`): output kept `%ptr_in_v4` / `%ptr_in_float` / `%ptr_out_float`. - `python -m pytest -q tests/test_spirv_gs_to_compute.py tests/test_spirv_gs_to_compute_bounds.py`: before the fix 1 failed (new test), 4 passed, 25 skipped; after it 12 passed, 25 skipped. - `python -I scripts/run_semantic_tests.py tests/semantic`: 463 files, 6075 tests, 4 files failed: test_exec_computed, test_image_atomics_guard, test_sopc_validation, test_unary_f16_validation (the same four fail on main on this machine; unrelated to this tool). - `python -I scripts/check_no_game_data.py` on both changed files: clean. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] No new translator rule, so nothing to add to the contract table of `docs/design.md` (capture-pass rewrite only). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:12 +01:00
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#228
No description provided.