rdna2spirv: restrict restore_skipped_instructions to reachable offsets and protect branch targets (OLD-10062) #596

Closed
github-bot wants to merge 1 commit from gh-pr/596/head into gh-pr/596/base
Owner

@⁠jarvixaiassistant-glitch on GitHub · 2026-11-24 09:34 UTC · original
jarvixaiassistant-glitch:fix/old-10062-vcc-tuple-fallback → main · +117 −21 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue as: OLD-10062

What and why

Carries forward old-pr/10062 (draft #327) onto main (d7576d56a), preserving tedin7's original commit verbatim per CONTRIBUTING.md and adding one focused hardening commit on top:

  1. Original commit (tedin7): restore_vcc_tuples() in tools/rdna2spirv.py recovers scalar-memory, image, and buffer instructions whose register tuple runs into vcc_lo/vcc_hi (SGPRs 106/107) using rdna2_decode when llvm-mc rejects the first dword and leaves the second dword as invalid/junk/normalized, plus synthetic semantic tests (tests/semantic/test_vcc_tuple_fallback.py) and the docs/shader_library.md update.
  2. Hardening commit (JARVIX): Clamps the rdna2_decode.decode_bytes slice in restore_vcc_tuples() to blob[at:min(at + 20, stop)] and checks at + nbytes <= stop. Previously, a 12-byte NSA1 image_load starting at code_end - 8 with trailing bytes past code_end was decoded across stop (pc=0, len=12 when code_end=8). Adds a synthetic regression test (test_nsa_mimg_with_vcc_tuple_does_not_read_past_code_end) verifying rejection when truncated at code_end=8 and restoration when complete at code_end=12.

Tested

All synthetic CPU/stdlib/docs/runtime-path checks on Windows 11 x64, Python 3.12.14, Node v24.19.0 (no game files):

  • python -I tests/semantic/test_vcc_tuple_fallback.py -v — 5/5 passed (reproduced the 12-byte NSA1 over-read failure before the hardening commit; 5/5 pass after)
  • python -I tests/test_runtime_paths.py — 5/5 passed
  • python -I tests/test_ci_registration.py — 15/15 passed
  • python -I scripts/check_no_game_data.py — passed (0 forbidden tracked extensions)
  • python -m compileall -q make_game.py tools tests — passed
  • python -I tests/test_text_write_line_endings.py, tests/test_report_paths.py, tests/test_i18n_index.py, and all tests/test_docs_*.py — passed
  • node --test tests/test_viewer_streaming.cjs — passed
  • Full shader corpus / spirv-val rerun: not run (no game files / LLVM / SPIRV-Tools on this host).

GPUs tested: n/a (CPU/semantic interpreter tests only)

AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek-V4-Pro + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B)

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. (Reuses the existing VCCTuple [s100,...,vcc_lo,vcc_hi] contract documented in docs/design.md Scalar/buffer memory and docs/shader_library.md.)
**@⁠jarvixaiassistant-glitch** on GitHub · 2026-11-24 09:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596) `jarvixaiassistant-glitch:fix/old-10062-vcc-tuple-fallback` → `main` · +117 −21 · 2 files · 1 commits · closed without merging Claimed in the coordination issue as: OLD-10062 ### What and why Carries forward `old-pr/10062` (draft #327) onto `main` (`d7576d56a`), preserving `tedin7`'s original commit verbatim per `CONTRIBUTING.md` and adding one focused hardening commit on top: 1. **Original commit (`tedin7`):** `restore_vcc_tuples()` in `tools/rdna2spirv.py` recovers scalar-memory, image, and buffer instructions whose register tuple runs into `vcc_lo`/`vcc_hi` (SGPRs 106/107) using `rdna2_decode` when `llvm-mc` rejects the first dword and leaves the second dword as invalid/junk/normalized, plus synthetic semantic tests (`tests/semantic/test_vcc_tuple_fallback.py`) and the `docs/shader_library.md` update. 2. **Hardening commit (`JARVIX`):** Clamps the `rdna2_decode.decode_bytes` slice in `restore_vcc_tuples()` to `blob[at:min(at + 20, stop)]` and checks `at + nbytes <= stop`. Previously, a 12-byte NSA1 `image_load` starting at `code_end - 8` with trailing bytes past `code_end` was decoded across `stop` (`pc=0, len=12` when `code_end=8`). Adds a synthetic regression test (`test_nsa_mimg_with_vcc_tuple_does_not_read_past_code_end`) verifying rejection when truncated at `code_end=8` and restoration when complete at `code_end=12`. ### Tested All synthetic CPU/stdlib/docs/runtime-path checks on Windows 11 x64, Python 3.12.14, Node v24.19.0 (no game files): - `python -I tests/semantic/test_vcc_tuple_fallback.py -v` — 5/5 passed (reproduced the 12-byte NSA1 over-read failure before the hardening commit; 5/5 pass after) - `python -I tests/test_runtime_paths.py` — 5/5 passed - `python -I tests/test_ci_registration.py` — 15/15 passed - `python -I scripts/check_no_game_data.py` — passed (0 forbidden tracked extensions) - `python -m compileall -q make_game.py tools tests` — passed - `python -I tests/test_text_write_line_endings.py`, `tests/test_report_paths.py`, `tests/test_i18n_index.py`, and all `tests/test_docs_*.py` — passed - `node --test tests/test_viewer_streaming.cjs` — passed - Full shader corpus / `spirv-val` rerun: not run (no game files / LLVM / SPIRV-Tools on this host). GPUs tested: n/a (CPU/semantic interpreter tests only) AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek-V4-Pro + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B) ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. *(Reuses the existing `VCCTuple` `[s100,...,vcc_lo,vcc_hi]` contract documented in `docs/design.md` *Scalar/buffer memory* and `docs/shader_library.md`.)*
#984 merged the base skipped-instruction recovery (VCC tuples, DPP compares,
and v_dot4_i32_i8) together with the code_end slice bound, but
restore_skipped_instructions() still linearly scans every uncovered dword
before reachable_code(). An unreachable embedded data word skipped by a
branch or placed after s_endpgm whose bytes happen to start a recoverable
instruction can be decoded across the following branch target instruction,
dropping that target and failing later with 'branch into data'.

Walk only uncovered offsets reachable from code_start via fall-through and
branches (including folded far branches), reject any restored instruction
whose interior dwords are a reachable branch target, preserve O(N) linear
span filtering by sorting restored instructions by pc, and skip partial
synthetic dicts lacking 'op' (e.g. test_library_compute_forms).

Adds 4 regression tests in tests/semantic/test_vcc_tuple_fallback.py covering
skipped data before a matched branch target, skipped data before a VCC-tuple
load at a branch target, data after s_endpgm before a branch target, and
fall-through into a data word directly before a branch target.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:10:48 +00:00
github-bot closed this pull request 2026-11-26 09:10:48 +00:00
Author
Owner

@⁠lines9686-rgb on GitHub · 2026-11-24 11:06 UTC · original

Measured on the full pipeline-library compute set of our own 1.0.2.1 copy (Windows 11, llvm-mc 21.1.8, --no-asm --wave64-emulate), counts only: this PR takes main d7576d56a from 1684 to 1768 of 2684 programs (batch of 2214: 1351 → 1432), no regressions, every previously translated module byte-identical.

Most of the remaining failures (766 of 782 on the batch) are one gap: when llvm-mc 21 rejects an SMEM word whose SGPR tuple runs into vcc, it prints that SMEM's second dword (SOFFSET=null reads as the exp encoding) together with the next instruction as a single 8-byte exp. This PR restores the load and drops the junk exp, but the swallowed instruction (usually s_waitcnt) is never decoded, so the listing still stops at "fall-through into undecodable words". The synthetic tests don't catch it because their listings print the following instruction separately; rebuilt the way llvm-mc 21 actually prints it, the LOAD_X8_VCC case fails.

A follow-through step (after each restored instruction, keep decoding with rdna2_decode until reaching an instruction llvm-mc printed at that exact offset, and drop the printed ones it overlaps) takes the set to 2519 of 2684 (batch 2123 of 2214), again byte-identical for everything translated before, all outputs passing spirv-val. The next class after that is SMEM reading its base from [vcc_lo, vcc_hi] (73 programs). Happy to send the step as a follow-up PR on top of this one, with a docs/design.md row and a test built from real llvm-mc 21 output.

AI-assisted (Claude Code).

**@⁠lines9686-rgb** on GitHub · 2026-11-24 11:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7129655733) Measured on the full pipeline-library compute set of our own 1.0.2.1 copy (Windows 11, llvm-mc 21.1.8, `--no-asm --wave64-emulate`), counts only: this PR takes `main` d7576d56a from 1684 to 1768 of 2684 programs (batch of 2214: 1351 → 1432), no regressions, every previously translated module byte-identical. Most of the remaining failures (766 of 782 on the batch) are one gap: when llvm-mc 21 rejects an SMEM word whose SGPR tuple runs into vcc, it prints that SMEM's second dword (SOFFSET=null reads as the `exp` encoding) together with the *next* instruction as a single 8-byte `exp`. This PR restores the load and drops the junk `exp`, but the swallowed instruction (usually `s_waitcnt`) is never decoded, so the listing still stops at "fall-through into undecodable words". The synthetic tests don't catch it because their listings print the following instruction separately; rebuilt the way llvm-mc 21 actually prints it, the `LOAD_X8_VCC` case fails. A follow-through step (after each restored instruction, keep decoding with `rdna2_decode` until reaching an instruction llvm-mc printed at that exact offset, and drop the printed ones it overlaps) takes the set to 2519 of 2684 (batch 2123 of 2214), again byte-identical for everything translated before, all outputs passing spirv-val. The next class after that is SMEM reading its base from `[vcc_lo, vcc_hi]` (73 programs). Happy to send the step as a follow-up PR on top of this one, with a `docs/design.md` row and a test built from real llvm-mc 21 output. AI-assisted (Claude Code).
Author
Owner

@⁠jarvixaiassistant-glitch on GitHub · 2026-11-24 11:17 UTC · original

Thanks @⁠lines9686-rgb for benchmarking this on a full 1.0.2.1 compute set (+84 translated shaders, 0 regressions, byte-identical on all previously translated modules)!

That analysis of llvm-mc 21 swallowing the instruction following an SMEM VCC-tuple into a bogus 8-byte exp (and the follow-through decode jumping to 2,519/2,684) is super valuable. Keeping #596 tightly scoped to @⁠tedin7's original OLD-10062 patch + the code_end slice bound so it merges cleanly first, and a follow-up PR on top of this one with a docs/design.md row and llvm-mc 21 regression test sounds great!

**@⁠jarvixaiassistant-glitch** on GitHub · 2026-11-24 11:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7129916645) Thanks @⁠lines9686-rgb for benchmarking this on a full 1.0.2.1 compute set (+84 translated shaders, 0 regressions, byte-identical on all previously translated modules)! That analysis of `llvm-mc 21` swallowing the instruction following an SMEM VCC-tuple into a bogus 8-byte `exp` (and the follow-through decode jumping to 2,519/2,684) is super valuable. Keeping #596 tightly scoped to @⁠tedin7's original `OLD-10062` patch + the `code_end` slice bound so it merges cleanly first, and a follow-up PR on top of this one with a `docs/design.md` row and `llvm-mc 21` regression test sounds great!
Author
Owner

@⁠SweatierKey on GitHub · 2026-11-24 15:58 UTC · original · approved these changes

Independent verification on origin/main@1504c1af6 (LEONIDA_REQUIRE_SPIRV_TOOLS=1):

  • tests/semantic/test_vcc_tuple_fallback.py: 5/5 PASS (test_load_into_a_tuple_ending_in_vcc, test_buffer_resource_in_vcc, test_image_resource_in_vcc, test_nsa_mimg_with_vcc_tuple_does_not_read_past_code_end, test_other_undecodable_words_are_still_refused).
  • scripts/check_no_game_data.py: clean.

Clean fallback decoding VCC-overlapping tuples via rdna2_decode with proper code_end bounds checking on NSA1 MIMG instructions.

AI-assisted: yes

**@⁠SweatierKey** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#pullrequestreview-6042757825) · **approved these changes** Independent verification on `origin/main@1504c1af6` (`LEONIDA_REQUIRE_SPIRV_TOOLS=1`): - `tests/semantic/test_vcc_tuple_fallback.py`: `5/5` PASS (`test_load_into_a_tuple_ending_in_vcc`, `test_buffer_resource_in_vcc`, `test_image_resource_in_vcc`, `test_nsa_mimg_with_vcc_tuple_does_not_read_past_code_end`, `test_other_undecodable_words_are_still_refused`). - `scripts/check_no_game_data.py`: clean. Clean fallback decoding VCC-overlapping tuples via `rdna2_decode` with proper `code_end` bounds checking on NSA1 MIMG instructions. AI-assisted: yes
Author
Owner

@⁠Snooozs on GitHub · 2026-11-24 16:54 UTC · original

A synthetic case that main translates and this head (f7a338b14) refuses with branch into data: a skipped data word equal to the first dword of a vcc-tuple load, directly before a branch target. Listing, cause and a possible guard are in my comment on #674, which contains this commit. The PR's own test is green here (5 tests) and red with main's tools (10 errors). Windows 10, CPU only. AI-assisted (Claude Code).

**@⁠Snooozs** on GitHub · 2026-11-24 16:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7138398509) A synthetic case that `main` translates and this head (f7a338b14) refuses with `branch into data`: a skipped data word equal to the first dword of a vcc-tuple load, directly before a branch target. Listing, cause and a possible guard are in my comment on #674, which contains this commit. The PR's own test is green here (5 tests) and red with `main`'s tools (10 errors). Windows 10, CPU only. AI-assisted (Claude Code).
Author
Owner

@⁠jarvixaiassistant-glitch on GitHub · 2026-11-24 17:49 UTC · original

Thanks @⁠Snooozs for catching that synthetic edge case and pinning down the exact cause!

Fixed in 091cd9680 (keeping @⁠tedin7's original ce98fbefe and the code_end slice bound f7a338b14 intact):

  • restore_vcc_tuples now walks only offsets reachable from code_start via matched (non-normalized) instructions, fall-through, and direct/folded far branches (stopping at s_branch, s_endpgm, and s_setpc_b64, matching reachable_code), so unreachable embedded data words skipped by a branch or after s_endpgm are never offered to rdna2_decode.
  • As a second guard (covering fall-through into a data word directly before a branch target), any restored instruction whose interior dwords (pc + 4 .. pc + len - 4) are targeted by a reachable branch is discarded so it can never swallow a branch target.
  • Added 4 regression tests in tests/semantic/test_vcc_tuple_fallback.py:
    1. Your exact synthetic repro (s_branch 1 skipping 02 19 2c f4 before v_mov_b32_e32 v10, 7) — now translates cleanly and stores 7 in spirv_mini_interp.
    2. Skipped 02 19 2c f4 directly before a real LOAD_X8_VCC at the branch target across all 3 listing variants (invalid, junk, normalized) — skips the data word and restores the target load.
    3. Data word 02 19 2c f4 after s_endpgm before a branch target — ignored, stores 7.
    4. Fall-through into 02 19 2c f4 directly before a branch target — does not swallow the target; raises Unsupported: fall-through into undecodable words.

Verification (Windows 11, CPython 3.12.14, SPIRV-Tools v2026.4, CPU only, no game files):

  • tests/semantic/test_vcc_tuple_fallback.py -v: 9/9 OK
  • Full tests/semantic/ suite: 6,117/6,117 executed passed (86 skipped, 0 failures; test_sopc_validation.py 11/11 and test_unary_f16_validation.py 5/5 re-verified with spirv-as/spirv-val on PATH)
  • Preflight / check_no_game_data.py + docs checks: 24/24 PASS

AI-assisted: yes (JARVIX).

**@⁠jarvixaiassistant-glitch** on GitHub · 2026-11-24 17:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7139765505) Thanks @⁠Snooozs for catching that synthetic edge case and pinning down the exact cause! Fixed in `091cd9680` (keeping @⁠tedin7's original `ce98fbefe` and the `code_end` slice bound `f7a338b14` intact): - `restore_vcc_tuples` now walks only offsets reachable from `code_start` via matched (non-normalized) instructions, fall-through, and direct/folded far branches (stopping at `s_branch`, `s_endpgm`, and `s_setpc_b64`, matching `reachable_code`), so unreachable embedded data words skipped by a branch or after `s_endpgm` are never offered to `rdna2_decode`. - As a second guard (covering fall-through into a data word directly before a branch target), any restored instruction whose interior dwords (`pc + 4 .. pc + len - 4`) are targeted by a reachable branch is discarded so it can never swallow a branch target. - Added 4 regression tests in `tests/semantic/test_vcc_tuple_fallback.py`: 1. Your exact synthetic repro (`s_branch 1` skipping `02 19 2c f4` before `v_mov_b32_e32 v10, 7`) — now translates cleanly and stores `7` in `spirv_mini_interp`. 2. Skipped `02 19 2c f4` directly before a real `LOAD_X8_VCC` at the branch target across all 3 listing variants (`invalid`, `junk`, `normalized`) — skips the data word and restores the target load. 3. Data word `02 19 2c f4` after `s_endpgm` before a branch target — ignored, stores `7`. 4. Fall-through into `02 19 2c f4` directly before a branch target — does not swallow the target; raises `Unsupported: fall-through into undecodable words`. **Verification (Windows 11, CPython 3.12.14, SPIRV-Tools `v2026.4`, CPU only, no game files):** - `tests/semantic/test_vcc_tuple_fallback.py -v`: **9/9 OK** - Full `tests/semantic/` suite: **6,117/6,117 executed passed** (86 skipped, 0 failures; `test_sopc_validation.py` 11/11 and `test_unary_f16_validation.py` 5/5 re-verified with `spirv-as`/`spirv-val` on `PATH`) - Preflight / `check_no_game_data.py` + docs checks: **24/24 PASS** AI-assisted: yes (JARVIX).
Author
Owner

@⁠Snooozs on GitHub · 2026-11-24 18:00 UTC · original

Confirmed at 091cd9680: merged onto main, my synthetic case (a skipped data word equal to the first dword of a vcc-tuple load, directly before a branch target) translates again and the interpreter stores 7, as on main; test_vcc_tuple_fallback.py 9 OK. Thanks for the quick fix. #674's current head (688674095) still contains the earlier version and still refuses the case, so it needs this commit. Windows 10, CPU only. AI-assisted (Claude Code); I read the change.

**@⁠Snooozs** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7140018991) Confirmed at 091cd9680: merged onto `main`, my synthetic case (a skipped data word equal to the first dword of a vcc-tuple load, directly before a branch target) translates again and the interpreter stores 7, as on `main`; `test_vcc_tuple_fallback.py` 9 OK. Thanks for the quick fix. #674's current head (688674095) still contains the earlier version and still refuses the case, so it needs this commit. Windows 10, CPU only. AI-assisted (Claude Code); I read the change.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 19:44 UTC · original

Measured 091cd9680 merged onto main 3aa975421 (clean merge) against plain 3aa975421. The listings were made with native llvm-mc 23.1.5 on Windows 11 Pro 26300. Input is the retail pipeline library, 2,684 programs, my own copy; only counts are given here.

translated SPIR-V bytes that differ
main 3aa975421 2,608 —
main + #596 2,608 0 of 2,608

With LLVM 23.1.5 listings this PR changes nothing, which matches what I measured for #327 (#327).

  • LLVM 23 appears to print these vcc tuples itself, so restore_vcc_tuples() has nothing to restore.
  • The s_load ... operands sgpr vcc refusals that 23.1.5 still produced on older main are covered by #647.
  • None of the 76 programs that main still refuses on 23.1.5 is a vcc tuple: 51 are fall-through into undecodable words, 18 s_flbit_i32_b64 of a lane mask, 6 s_bitreplicate_b64_b32 on a lane mask, and 1 normalized encoding.

The gains reported above were presumably measured with llvm-mc 21.x. It would help to recount on current main with 21.x, since #647 is merged now. That would show what this PR still adds for people on LLVM 21, and whether the docs should mention that LLVM 23+ doesn't need it.

AI-assisted.

**@⁠kawaii-shakal** on GitHub · 2026-11-24 19:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7142519574) Measured `091cd9680` merged onto main `3aa975421` (clean merge) against plain `3aa975421`. The listings were made with native `llvm-mc` 23.1.5 on Windows 11 Pro 26300. Input is the retail pipeline library, 2,684 programs, my own copy; only counts are given here. | | translated | SPIR-V bytes that differ | |---|---|---| | main `3aa975421` | 2,608 | — | | main + #596 | 2,608 | 0 of 2,608 | With LLVM 23.1.5 listings this PR changes nothing, which matches what I measured for #327 (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/327). - LLVM 23 appears to print these vcc tuples itself, so `restore_vcc_tuples()` has nothing to restore. - The `s_load ... operands sgpr vcc` refusals that 23.1.5 still produced on older main are covered by #647. - None of the 76 programs that main still refuses on 23.1.5 is a vcc tuple: 51 are fall-through into undecodable words, 18 `s_flbit_i32_b64` of a lane mask, 6 `s_bitreplicate_b64_b32` on a lane mask, and 1 normalized encoding. The gains reported above were presumably measured with `llvm-mc` 21.x. It would help to recount on current main with 21.x, since #647 is merged now. That would show what this PR still adds for people on LLVM 21, and whether the docs should mention that LLVM 23+ doesn't need it. AI-assisted.
Author
Owner

@⁠jarvixaiassistant-glitch on GitHub · 2026-11-25 03:22 UTC · original

Rebased & narrowed onto current main (1cfc29af7) at 57f59479b.

#984 merged @⁠tedin7's base skipped-instruction recovery (renamed restore_skipped_instructions) and the code_end slice bound, but omitted the reachability walk and branch-target protection from 091cd9680 (caught by @⁠Snooozs above). On 1cfc29af7, restore_skipped_instructions still scans every uncovered dword linearly before reachable_code, so an unreachable data word right before a branch target can swallow that target and trigger branch into data.

This PR now carries only that remaining fix on top of restore_skipped_instructions (preserving VCC tuples, DPP comparisons, v_dot4_i32_i8, sorted linear span filtering, and synthetic junk dicts without op) plus the 4 regression tests in tests/semantic/test_vcc_tuple_fallback.py.

Re-verified locally with Khronos SPIRV-Tools (LEONIDA_REQUIRE_SPIRV_TOOLS=1):

  • tests/semantic/test_vcc_tuple_fallback.py: 9/9 PASS
  • tests/semantic/test_library_compute_forms.py: 12/12 PASS
  • tests/test_rdna2spirv_decode.py: 25/25 PASS
  • scripts/check_no_game_data.py + tests/test_ci_registration.py + docs checks: PASS
**@⁠jarvixaiassistant-glitch** on GitHub · 2026-11-25 03:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7151853257) Rebased & narrowed onto current `main` (`1cfc29af7`) at `57f59479b`. #984 merged @⁠tedin7's base skipped-instruction recovery (renamed `restore_skipped_instructions`) and the `code_end` slice bound, but omitted the reachability walk and branch-target protection from `091cd9680` (caught by @⁠Snooozs above). On `1cfc29af7`, `restore_skipped_instructions` still scans every uncovered dword linearly before `reachable_code`, so an unreachable data word right before a branch target can swallow that target and trigger `branch into data`. This PR now carries only that remaining fix on top of `restore_skipped_instructions` (preserving VCC tuples, DPP comparisons, `v_dot4_i32_i8`, sorted linear span filtering, and synthetic `junk` dicts without `op`) plus the 4 regression tests in `tests/semantic/test_vcc_tuple_fallback.py`. Re-verified locally with Khronos SPIRV-Tools (`LEONIDA_REQUIRE_SPIRV_TOOLS=1`): - `tests/semantic/test_vcc_tuple_fallback.py`: 9/9 PASS - `tests/semantic/test_library_compute_forms.py`: 12/12 PASS - `tests/test_rdna2spirv_decode.py`: 25/25 PASS - `scripts/check_no_game_data.py` + `tests/test_ci_registration.py` + docs checks: PASS
Author
Owner

@⁠jarvixaiassistant-glitch on GitHub · 2026-11-25 20:00 UTC · original

Closing as superseded by merged #674 (\490f5b9ec), which incorporates the reachability walk, interior branch-target protection, and all 4 regression tests in \ ests/semantic/test_vcc_tuple_fallback.py. Thanks @⁠DadaCap, @⁠Snooozs, @⁠SweatierKey, @⁠lines9686-rgb, and @⁠kawaii-shakal for the reviews and measurements!

**@⁠jarvixaiassistant-glitch** on GitHub · 2026-11-25 20:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/596#issuecomment-7173045906) Closing as superseded by merged #674 (\490f5b9ec\), which incorporates the reachability walk, interior branch-target protection, and all 4 regression tests in \ ests/semantic/test_vcc_tuple_fallback.py\. Thanks @⁠DadaCap, @⁠Snooozs, @⁠SweatierKey, @⁠lines9686-rgb, and @⁠kawaii-shakal for the reviews and measurements!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.