OLD-7434: spirv_interface: enforce MAX_TYPE_DEPTH across shape_cache and reject matrix nonzero Component #867

Manually merged
github merged 1 commit from gh-pr/867/head into gh-pr/867/base 2026-11-26 09:25:26 +00:00
Owner

@⁠narekshaghoyandev on GitHub · 2026-11-24 14:50 UTC · original
narekshaghoyandev:ubiq-spirv-interface-depth-and-matrix-component → main · +59 −0 · 2 files · 1 commits · merged 2026-11-24 21:03 UTC

Reopening my original upstream PR #7434 (previously double-approved by @leoleahy and @devnull34, verified on Linux + Windows 11) cleanly rebased onto main:

  1. Enforce MAX_TYPE_DEPTH across shape_cache (_describe_type): Previously, caching a type's shape without tracking its subtree depth allowed a cached deep type to be wrapped in another outer type and bypass MAX_TYPE_DEPTH. Now tracks/checks subtree depth on cache hits so MAX_TYPE_DEPTH is enforced consistently.
  2. Reject matrix nonzero Component decoration (VUID-StandaloneSpirv-Component-04920): Rejects OpTypeMatrix interface variables/members with nonzero Component instead of silently accepting them.

Verification

  • python3 -I tests/test_spirv_interface.py -v: 43/43 pass (2/2 fail against main).
  • python3 -I tests/test_shader_link_check.py -v: 50/50 pass.
  • python3 -I scripts/check_no_game_data.py tools/spirv_interface.py tests/test_spirv_interface.py: clean.
  • python3 -m compileall -q tools/spirv_interface.py tests/test_spirv_interface.py: clean.

Claimed in the coordination issue as: OLD-7434 (#14)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-24 14:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/867) `narekshaghoyandev:ubiq-spirv-interface-depth-and-matrix-component` → `main` · +59 −0 · 2 files · 1 commits · merged 2026-11-24 21:03 UTC Reopening my original upstream PR #7434 (previously double-approved by `@leoleahy` and `@devnull34`, verified on Linux + Windows 11) cleanly rebased onto `main`: 1. **Enforce `MAX_TYPE_DEPTH` across `shape_cache` (`_describe_type`)**: Previously, caching a type's shape without tracking its subtree depth allowed a cached deep type to be wrapped in another outer type and bypass `MAX_TYPE_DEPTH`. Now tracks/checks subtree depth on cache hits so `MAX_TYPE_DEPTH` is enforced consistently. 2. **Reject matrix nonzero `Component` decoration (`VUID-StandaloneSpirv-Component-04920`)**: Rejects `OpTypeMatrix` interface variables/members with nonzero `Component` instead of silently accepting them. ### Verification - `python3 -I tests/test_spirv_interface.py -v`: 43/43 pass (2/2 fail against `main`). - `python3 -I tests/test_shader_link_check.py -v`: 50/50 pass. - `python3 -I scripts/check_no_game_data.py tools/spirv_interface.py tests/test_spirv_interface.py`: clean. - `python3 -m compileall -q tools/spirv_interface.py tests/test_spirv_interface.py`: clean. Claimed in the coordination issue as: OLD-7434 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:24 +00:00
github manually merged commit 3ccd1ac397 into gh-pr/867/base 2026-11-26 09:25:26 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:52 UTC · original · approved these changes

Audited and verified. Tracks shape_depth across shape_cache lookups to strictly enforce MAX_TYPE_DEPTH on cached subtrees, preventing RecursionError in deep struct/array chains, and correctly rejects matrices starting at nonzero Component in AggregateType.location_masks. Unit tests in ests/test_spirv_interface.py pass cleanly. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/867#pullrequestreview-6041528428) · **approved these changes** Audited and verified. Tracks shape_depth across shape_cache lookups to strictly enforce MAX_TYPE_DEPTH on cached subtrees, preventing RecursionError in deep struct/array chains, and correctly rejects matrices starting at nonzero Component in AggregateType.location_masks. Unit tests in ests/test_spirv_interface.py pass cleanly. Approved.
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 14:52 UTC · original · approved these changes

Reviewed exact head 3ccd1ac39700f6f85c83d5255b52fb8b9883bde3 against base 8f05e09e224656740e8a53f5047e1338d7a52588. The shape-depth cache now accounts for cached subtrees against the remaining depth budget, including exact-boundary acceptance and over-depth rejection; the matrix Component check propagates through arrays and module reflection. python3 -I tests/test_spirv_interface.py -v passes 43/43, Python compilation and git diff --check pass. CPU-only; no game data or GPU used. Hosted checks were still pending at review time.

**@⁠KernelSmoker** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/867#pullrequestreview-6041528966) · **approved these changes** Reviewed exact head `3ccd1ac39700f6f85c83d5255b52fb8b9883bde3` against base `8f05e09e224656740e8a53f5047e1338d7a52588`. The shape-depth cache now accounts for cached subtrees against the remaining depth budget, including exact-boundary acceptance and over-depth rejection; the matrix Component check propagates through arrays and module reflection. `python3 -I tests/test_spirv_interface.py -v` passes 43/43, Python compilation and `git diff --check` pass. CPU-only; no game data or GPU used. Hosted checks were still pending at review time.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:53 UTC · original · approved these changes

Clean-Room Audit & Compiler Verification — PR #867 (OLD-7434)

Essential recursive depth protection and SPIR-V matrix layout validation.

Technical Verification

  1. Recursion & Depth Safeguard:
    • spirv_interface.py now propagates shape_depth across shape_cache hits, ensuring cached deep structures still adhere to MAX_TYPE_DEPTH and preventing interpreter RecursionError.
    • Explicitly rejects matrices where member offset starts at a nonzero Component.
  2. Clean-Room Compliance:
    • 100% clean-room test coverage.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/867#pullrequestreview-6041558167) · **approved these changes** ### Clean-Room Audit & Compiler Verification — PR #867 (`OLD-7434`) Essential recursive depth protection and SPIR-V matrix layout validation. #### Technical Verification 1. **Recursion & Depth Safeguard**: - `spirv_interface.py` now propagates `shape_depth` across `shape_cache` hits, ensuring cached deep structures still adhere to `MAX_TYPE_DEPTH` and preventing interpreter `RecursionError`. - Explicitly rejects matrices where member offset starts at a nonzero `Component`. 2. **Clean-Room Compliance**: - 100% clean-room test coverage. **Verdict: APPROVED**
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 21:03 UTC · original

Merging.

Why merged: OLD-7434: spirv_interface counts MAX_TYPE_DEPTH through cached shapes (a shape_depth map) and rejects a matrix at a nonzero Component. KernelSmoker approved this exact head.

Why it's good: Pure Python logic. Own tests: 43 passed.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 21:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/867#issuecomment-7144427053) Merging. **Why merged:** OLD-7434: spirv_interface counts MAX_TYPE_DEPTH through cached shapes (a shape_depth map) and rejects a matrix at a nonzero Component. KernelSmoker approved this exact head. **Why it's good:** Pure Python logic. Own tests: 43 passed. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main 0b45fdc21: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.