rdna2spirv: bound loop visits at the structured exit (SHADER-LOOP-GUARD) #1101

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

@⁠Moriz82 on GitHub · 2026-11-24 18:22 UTC · original
split/shader-loop-guard → main · +7 −1 · 2 files · 1 commits · closed without merging

Rebased onto bfef489c at 30baacf9. Main already includes the loop guard. This diff tests the build flag forwarding and documents the native and emulated forced-exit behavior reported below. The three focused suites passed 71 tests.

Claimed in the coordination issue as: SHADER-LOOP-GUARD (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 is the parent integration. This child merges cleanly beside #1068 and #1073. Either can land first.

What and why

A compute invocation can keep taking a loop back edge when its input makes the exit condition unreachable. On Linux, a synthetic shader that added two on each visit could never reach its odd target. With the guard disabled, both the 32-lane and 64-lane cases exceeded the interpreter's 10,000-step limit in structured and dispatch modes.

The translator now counts visits to each structured loop header per invocation. Entering the loop starts a fresh counter. At the configured limit, a back edge goes to the loop's merge block. A dispatch-loop visit counts one dispatch iteration. Both the translator and the shader build accept --loop-limit N. The default is 65,536. Set it to zero to restore the unbounded output.

This also truncates finite loops that need more visits. With a budget of 16, every lane reached a target of 6 normally. For targets of 1 and 34, every lane reported 32 in structured mode and 30 in dispatch mode. For nested loops with three visits to each header per entry, every lane reported all nine inner iterations. A merge phi with no value on a newly forced exit receives an undefined value on that edge.

The structured-branch test interpreter now reads header phis from the entering edge, as the new counters require. The build digest, fixture build dependencies and runtime workflow path filters include the new translator module.

Tested

Applied only the new tests and their synthetic fixture to pristine main 3aa975421 for the regression comparison. The child has one commit on that base.

Test Main plus tests Child
LoopGuardTests.test_finite_and_nonterminating Both wave-width subcases failed because the module had no guard. Both passed. Finite output matched the unbounded control, and the unreachable target stopped.
LoopGuardTests.test_dispatch_loop_also_stops Both wave-width subcases exceeded 10,000 interpreter steps. Both passed. All 32 or 64 lanes finished.
LoopGuardTests.test_inner_budget_resets_on_each_entry Passed on the finite control. Passed at a budget of 3.
MainWiringTest.test_explicit_loop_limit_reaches_the_shaders_stage Both explicit settings, 0 and 16, were rejected by the build CLI. Both reached the shader stage.
Command or check Result
python3 -I scripts/run_semantic_tests.py tests/semantic -p test_loop_iteration_guard.py -j 2 3 methods. Main had one passing method, one failing method and one method with interpreter timeouts. All 3 passed on the child.
python3 -I scripts/run_semantic_tests.py tests/semantic -p test_control_flow_branches.py -j 2 33 passed.
python3 -I tests/test_make_game_translator_flags.py 34 passed.
python3 -I tests/test_cmake_translator_deps.py and python3 -I tests/test_runtime_paths.py 5 passed in each file.
python3 -I -m compileall -q make_game.py tools tests Passed.
Full Python CI loop over 520 nonsemantic files using python3 -I <file> or python3 -I -m pytest -q <file> One failing file on each tree, tests/test_imhex_patterns.py. The same 6 of its 9 cases failed. Zero new failing files.
python3 -I scripts/run_semantic_tests.py tests/semantic -j 2 Main ran 6,168 tests in 470 files. The child ran 6,171 in 471 files, twice, in 504 s and 322 s. Zero failing files on each run.
python3 -I scripts/check_no_game_data.py Passed, 2,465 tracked entries.
cmake -S runtime -B runtime/build/boot and cmake --build runtime/build/boot --target gta6rt -j6 Windows x86-64 runtime target built incrementally on Linux.

For the synthetic loop, spirv-val accepted all 24 combinations of lane width, structured or dispatch lowering, peephole optimization on or off, and limits 0, 16 or 65,536. Nine additional modules with exit phis validated at limits 0, 1 and 4,294,967,295. A loop-free control was byte-identical. On the translator CLI, limit zero reproduced main's 7,116-byte binary and shader index. The default and explicit 65,536 produced the same 7,220-byte binary and index.

The following repository fixtures were also built on main and the child:

out=$(mktemp -d)
LEONIDA_BARY_FALLBACK=0 python3 -I runtime/test/shaders/build.py "$out" \
  cs_barrier_loop cs_imgatomic cs_imgatomic3d cs_imgatomic_ext cs_lds_atomics_ext \
  ps_imgatomic ps_w64_b_ballot_atomic ps_w64_b_waterfall ps_w64_c_waterfall_count \
  vs_w64_b_ballot_atomic vs_w64_b_waterfall

All 11 synthetic modules translated and validated on each tree. Nine contained loops. Main had zero guard counters across 41 loop headers, and the default child had 41 across the same 41 headers.

GPUs tested: none. Validation used CPU interpreters and SPIRV-Tools on Linux. Native Windows, Wine, NVIDIA GPU, AMD GPU, Intel GPU and game boots were not run.

AI-assisted: yes

Checklist

  • One commit on current upstream main, with a clean merge into main and beside the related published branches.
  • One translator bound, its build wiring and its tests.
  • Synthetic fixtures and a passing game-data check.
  • Translator contract and confirmation in docs/design.md.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101) `split/shader-loop-guard` → `main` · +7 −1 · 2 files · 1 commits · closed without merging **Rebased onto `bfef489c` at `30baacf9`.** Main already includes the loop guard. This diff tests the build flag forwarding and documents the native and emulated forced-exit behavior reported below. The three focused suites passed 71 tests. Claimed in the coordination issue as: SHADER-LOOP-GUARD ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 is the parent integration. This child merges cleanly beside #1068 and #1073. Either can land first. ### What and why A compute invocation can keep taking a loop back edge when its input makes the exit condition unreachable. On Linux, a synthetic shader that added two on each visit could never reach its odd target. With the guard disabled, both the 32-lane and 64-lane cases exceeded the interpreter's 10,000-step limit in structured and dispatch modes. The translator now counts visits to each structured loop header per invocation. Entering the loop starts a fresh counter. At the configured limit, a back edge goes to the loop's merge block. A dispatch-loop visit counts one dispatch iteration. Both the translator and the shader build accept `--loop-limit N`. The default is 65,536. Set it to zero to restore the unbounded output. This also truncates finite loops that need more visits. With a budget of 16, every lane reached a target of 6 normally. For targets of 1 and 34, every lane reported 32 in structured mode and 30 in dispatch mode. For nested loops with three visits to each header per entry, every lane reported all nine inner iterations. A merge phi with no value on a newly forced exit receives an undefined value on that edge. The structured-branch test interpreter now reads header phis from the entering edge, as the new counters require. The build digest, fixture build dependencies and runtime workflow path filters include the new translator module. ### Tested Applied only the new tests and their synthetic fixture to pristine main `3aa975421` for the regression comparison. The child has one commit on that base. | Test | Main plus tests | Child | |---|---|---| | `LoopGuardTests.test_finite_and_nonterminating` | Both wave-width subcases failed because the module had no guard. | Both passed. Finite output matched the unbounded control, and the unreachable target stopped. | | `LoopGuardTests.test_dispatch_loop_also_stops` | Both wave-width subcases exceeded 10,000 interpreter steps. | Both passed. All 32 or 64 lanes finished. | | `LoopGuardTests.test_inner_budget_resets_on_each_entry` | Passed on the finite control. | Passed at a budget of 3. | | `MainWiringTest.test_explicit_loop_limit_reaches_the_shaders_stage` | Both explicit settings, 0 and 16, were rejected by the build CLI. | Both reached the shader stage. | | Command or check | Result | |---|---| | `python3 -I scripts/run_semantic_tests.py tests/semantic -p test_loop_iteration_guard.py -j 2` | 3 methods. Main had one passing method, one failing method and one method with interpreter timeouts. All 3 passed on the child. | | `python3 -I scripts/run_semantic_tests.py tests/semantic -p test_control_flow_branches.py -j 2` | 33 passed. | | `python3 -I tests/test_make_game_translator_flags.py` | 34 passed. | | `python3 -I tests/test_cmake_translator_deps.py` and `python3 -I tests/test_runtime_paths.py` | 5 passed in each file. | | `python3 -I -m compileall -q make_game.py tools tests` | Passed. | | Full Python CI loop over 520 nonsemantic files using `python3 -I <file>` or `python3 -I -m pytest -q <file>` | One failing file on each tree, `tests/test_imhex_patterns.py`. The same 6 of its 9 cases failed. Zero new failing files. | | `python3 -I scripts/run_semantic_tests.py tests/semantic -j 2` | Main ran 6,168 tests in 470 files. The child ran 6,171 in 471 files, twice, in 504 s and 322 s. Zero failing files on each run. | | `python3 -I scripts/check_no_game_data.py` | Passed, 2,465 tracked entries. | | `cmake -S runtime -B runtime/build/boot` and `cmake --build runtime/build/boot --target gta6rt -j6` | Windows x86-64 runtime target built incrementally on Linux. | For the synthetic loop, `spirv-val` accepted all 24 combinations of lane width, structured or dispatch lowering, peephole optimization on or off, and limits 0, 16 or 65,536. Nine additional modules with exit phis validated at limits 0, 1 and 4,294,967,295. A loop-free control was byte-identical. On the translator CLI, limit zero reproduced main's 7,116-byte binary and shader index. The default and explicit 65,536 produced the same 7,220-byte binary and index. The following repository fixtures were also built on main and the child: ```sh out=$(mktemp -d) LEONIDA_BARY_FALLBACK=0 python3 -I runtime/test/shaders/build.py "$out" \ cs_barrier_loop cs_imgatomic cs_imgatomic3d cs_imgatomic_ext cs_lds_atomics_ext \ ps_imgatomic ps_w64_b_ballot_atomic ps_w64_b_waterfall ps_w64_c_waterfall_count \ vs_w64_b_ballot_atomic vs_w64_b_waterfall ``` All 11 synthetic modules translated and validated on each tree. Nine contained loops. Main had zero guard counters across 41 loop headers, and the default child had 41 across the same 41 headers. GPUs tested: none. Validation used CPU interpreters and SPIRV-Tools on Linux. Native Windows, Wine, NVIDIA GPU, AMD GPU, Intel GPU and game boots were not run. AI-assisted: yes ### Checklist - [x] One commit on current upstream main, with a clean merge into main and beside the related published branches. - [x] One translator bound, its build wiring and its tests. - [x] Synthetic fixtures and a passing game-data check. - [x] Translator contract and confirmation in `docs/design.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A loop with an unreachable exit can keep a translated invocation running.
Count header visits per invocation and loop entry. At the configured
bound, take the structured merge. The default is 65536 visits and zero
disables the guard.

The unbounded dispatch fixture timed out at both wave widths on main.
The guarded fixture terminated and preserved finite results in budget.
All 6171 semantic tests ran with no failing files. The Windows runtime
build, tracked-file guard and dependency checks passed.

AI-assisted (Codex and Claude Code agents).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:14 +00:00
github-bot closed this pull request 2026-11-26 09:38:14 +00:00
Author
Owner

@⁠Plaaasma on GitHub · 2026-11-24 18:32 UTC · original

Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022, Vulkan; Python 3.10, llvm-mc (AMDGPU) and spirv-val on PATH.

Head 10ad8809b:

  • python -I scripts/run_semantic_tests.py tests/semantic -p test_loop_iteration_guard.py -v: 3/3 OK in 0.47 s (test_finite_and_nonterminating, test_inner_budget_resets_on_each_entry, test_dispatch_loop_also_stops)
  • ... -p test_control_flow_branches.py: 33/33 OK in 0.27 s
  • python -m unittest test_make_game_translator_flags (from tests/): 34/34 OK in 0.91 s
  • full suite, python -I scripts/run_semantic_tests.py tests/semantic --timeout 600: 471 files, 6171 tests, 0 files failed in 189 s (32 jobs)

No failures. (No runtime/ctest targets in this PR, so nothing built.)

**@⁠Plaaasma** on GitHub · 2026-11-24 18:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7140798848) Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022, Vulkan; Python 3.10, llvm-mc (AMDGPU) and spirv-val on PATH. Head `10ad8809b`: - `python -I scripts/run_semantic_tests.py tests/semantic -p test_loop_iteration_guard.py -v`: **3/3 OK** in 0.47 s (`test_finite_and_nonterminating`, `test_inner_budget_resets_on_each_entry`, `test_dispatch_loop_also_stops`) - `... -p test_control_flow_branches.py`: **33/33 OK** in 0.27 s - `python -m unittest test_make_game_translator_flags` (from `tests/`): **34/34 OK** in 0.91 s - full suite, `python -I scripts/run_semantic_tests.py tests/semantic --timeout 600`: **471 files, 6171 tests, 0 files failed** in 189 s (32 jobs) No failures. (No runtime/ctest targets in this PR, so nothing built.)
Author
Owner

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

Audited and verified. Implements structured loop iteration bounding in ools/spirv_loop_guard.py, instrumenting loop headers with iteration counter phis and redirecting back edges to the loop merge block when the iteration budget is exhausted. Correctly handles split latches and OpPhi incoming values. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#pullrequestreview-6045208135) · **approved these changes** Audited and verified. Implements structured loop iteration bounding in ools/spirv_loop_guard.py, instrumenting loop headers with iteration counter phis and redirecting back edges to the loop merge block when the iteration budget is exhausted. Correctly handles split latches and OpPhi incoming values. Approved.
Author
Owner

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

Clean-Room Audit — PR #1101 (SHADER-LOOP-GUARD)

Clean loop visit bound injection (tools/spirv_loop_guard.py) guarding structured loop merge blocks (default 65,536 iterations) with --loop-limit configuration wired cleanly through rdna2spirv.py and make_game.py. Synthetic .asm fixture and semantic tests verified clean-room (0 game data).

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#pullrequestreview-6045381139) · **approved these changes** ### Clean-Room Audit — PR #1101 (`SHADER-LOOP-GUARD`) Clean loop visit bound injection (`tools/spirv_loop_guard.py`) guarding structured loop merge blocks (default 65,536 iterations) with `--loop-limit` configuration wired cleanly through `rdna2spirv.py` and `make_game.py`. Synthetic `.asm` fixture and semantic tests verified clean-room (0 game data). **Verdict: APPROVED**
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 19:11 UTC · original

AI-assisted independent GPU verification (overnight shift, worker w4).

Environment: Windows, Git Bash; runtime built RelWithDebInfo (Ninja, VS2022 BuildTools, SDK 10.0.26100, Vulkan SDK 1.4.363.0, LLVM_MC=WSL llvm-21, spirv-val/glslangValidator on PATH so the translated-draw ctest targets were built).

AMD Radeon iGPU (RDNA2 gfx1035, driver 24.10.24, Vulkan 1.3.280, 128B push constants):
VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1 py -3.14 -I scripts/run_gpu_tests.py --work <dir>

  • 230/252 passed, 20 skipped, 2 failed — both known pre-existing AMD Windows LLPC 0xC0000005 mesh-shader crashes unrelated to this change: ms_clip, ms_wave_info_s3 (SHADER-167; fixes pending in open PRs #802/#808).
  • 0 Vulkan validation errors.

NVIDIA RTX 4070 SUPER (driver 610.88):
VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~ py -3.14 -I scripts/run_gpu_tests.py --work <dir>

  • 203/252 passed, 49 skipped, 0 failed. 0 validation errors.

Translator tests:

  • test_loop_iteration_guard.py: 3/3 OK; test_control_flow_branches.py: 33/33 OK; test_make_game_translator_flags.py: 34/34 OK.
  • Full suite py -3.14 -I scripts/run_semantic_tests.py tests/semantic → 471 files, 6171 tests, 0 failed.

Verdict: verified. Loop-visit bounding at the structured exit causes no regressions on either GPU; the only AMD failures are the documented mesh-shader driver crashes.

**@⁠whoalin1** on GitHub · 2026-11-24 19:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7141742388) AI-assisted independent GPU verification (overnight shift, worker w4). **Environment:** Windows, Git Bash; runtime built RelWithDebInfo (Ninja, VS2022 BuildTools, SDK 10.0.26100, Vulkan SDK 1.4.363.0, LLVM_MC=WSL llvm-21, spirv-val/glslangValidator on PATH so the translated-draw ctest targets were built). **AMD Radeon iGPU (RDNA2 gfx1035, driver 24.10.24, Vulkan 1.3.280, 128B push constants):** `VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1 py -3.14 -I scripts/run_gpu_tests.py --work <dir>` - 230/252 passed, 20 skipped, **2 failed — both known pre-existing AMD Windows LLPC 0xC0000005 mesh-shader crashes unrelated to this change:** `ms_clip`, `ms_wave_info_s3` (SHADER-167; fixes pending in open PRs #802/#808). - **0 Vulkan validation errors.** **NVIDIA RTX 4070 SUPER (driver 610.88):** `VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~ py -3.14 -I scripts/run_gpu_tests.py --work <dir>` - 203/252 passed, 49 skipped, **0 failed**. 0 validation errors. **Translator tests:** - `test_loop_iteration_guard.py`: 3/3 OK; `test_control_flow_branches.py`: 33/33 OK; `test_make_game_translator_flags.py`: 34/34 OK. - Full suite `py -3.14 -I scripts/run_semantic_tests.py tests/semantic` → 471 files, 6171 tests, 0 failed. **Verdict: verified.** Loop-visit bounding at the structured exit causes no regressions on either GPU; the only AMD failures are the documented mesh-shader driver crashes.
Author
Owner

@⁠iFeyz on GitHub · 2026-11-24 19:51 UTC · original

AMD run (the gap the description lists): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo.

Head 10ad8809b:

  • scripts/run_gpu_tests.py with this translator: 261 of 261 shaders translated and spirv-val-clean, 236 of 252 pass, 16 skipped, 0 failed (native, subgroup 64).
  • test_control_flow_branches.py (33), test_loop_iteration_guard.py (3), tests/test_make_game_translator_flags.py (34): OK.
**@⁠iFeyz** on GitHub · 2026-11-24 19:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7142677038) AMD run (the gap the description lists): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo. Head `10ad8809b`: - `scripts/run_gpu_tests.py` with this translator: 261 of 261 shaders translated and `spirv-val`-clean, **236 of 252 pass, 16 skipped, 0 failed** (native, subgroup 64). - `test_control_flow_branches.py` (33), `test_loop_iteration_guard.py` (3), `tests/test_make_game_translator_flags.py` (34): OK.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:17 UTC · original

Recommendation: [MERGE]

Reasoning: Adds a structured loop-iteration guard pass (tools/spirv_loop_guard.py) so a non-terminating shader loop exits at its structured exit instead of hanging the GPU. Also touches .github/workflows/runtime.yml, make_game.py and the cmake deps, so a maintainer should eyeball the workflow change. Very well verified: full semantic suite 6171 tests, NVIDIA, AMD RDNA2 iGPU and RX 9070 XT runs with no new failures. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 6/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7143324315) **Recommendation:** [MERGE] **Reasoning:** Adds a structured loop-iteration guard pass (`tools/spirv_loop_guard.py`) so a non-terminating shader loop exits at its structured exit instead of hanging the GPU. Also touches `.github/workflows/runtime.yml`, `make_game.py` and the cmake deps, so a maintainer should eyeball the workflow change. Very well verified: full semantic suite 6171 tests, NVIDIA, AMD RDNA2 iGPU and RX 9070 XT runs with no new failures. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 6/10
Author
Owner

@⁠akimfomin on GitHub · 2026-11-25 02:32 UTC · original · edited 2026-11-25 03:20 UTC

Moriz82, PortBridge used the boundary work from the merged XCL #2034 to check Continued's loop guard on exact 10ad8809 and main 3ff2a2a. Both count the first real header visit and leave a finite acyclic backward-address branch uncharged.

One different result appears only on a forced exit. A finite synthetic Wave64 loop would naturally leave after five visits. With --loop-limit 4, native64 and emulated64 run four body writes. Native64 skips the post-loop marker store, while emulated64 writes it on all 64 lanes. The modes agree on natural exits within the budget, including four visits at limit four.

At the forced merge, native64 checks the retained guest PC before entering the post-loop block. Emulated64 enters that block directly. Both generated modules passed Vulkan 1.3 validation. The exact checks executed in the CPU interpreter. Is the difference in post-loop side effects intended when the limit fires? Fixture and exact logs

Vulkan follow-up on RTX 4070 Ti SUPER (driver 617.14). On exact 10ad8809, natural three-visit exits wrote 3/42 in both modes. With limit 4 and a natural exit at 5, all lanes wrote count 4. Native Wave32 at host subgroup 32 left the post-loop marker untouched in all 32 lanes, while Wave64 emulation on host subgroup 32 wrote 42 in all 64 lanes. Native Wave32 with the limit disabled wrote 5/42. All five dispatches completed with zero Khronos diagnostics. The guard withheld the limit-disabled emulated dispatch at process admission. Its CPU interpreter and SPIR-V validation checks passed. Source and raw results

AI assistance from OpenAI Codex (GPT-6 family) for the cross-project review and synthetic verification.

**@⁠akimfomin** on GitHub · 2026-11-25 02:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7150851967) · edited 2026-11-25 03:20 UTC Moriz82, [PortBridge](https://github.com/akimfomin/PortBridge) used the boundary work from the merged XCL #2034 to check Continued's loop guard on exact `10ad8809` and main `3ff2a2a`. Both count the first real header visit and leave a finite acyclic backward-address branch uncharged. One different result appears only on a forced exit. A finite synthetic Wave64 loop would naturally leave after five visits. With `--loop-limit 4`, native64 and emulated64 run four body writes. Native64 skips the post-loop marker store, while emulated64 writes it on all 64 lanes. The modes agree on natural exits within the budget, including four visits at limit four. At the forced merge, native64 checks the retained guest PC before entering the post-loop block. Emulated64 enters that block directly. Both generated modules passed Vulkan 1.3 validation. The exact checks executed in the CPU interpreter. Is the difference in post-loop side effects intended when the limit fires? [Fixture and exact logs](https://github.com/akimfomin/PortBridge/blob/f5cd8d918bc4fbe91999d4bf115ce70cc41d731c/research/rendering-night/continued-loop-budget/REPORT.md) **Vulkan follow-up on RTX 4070 Ti SUPER (driver 617.14).** On exact `10ad8809`, natural three-visit exits wrote `3/42` in both modes. With limit 4 and a natural exit at 5, all lanes wrote count `4`. Native Wave32 at host subgroup 32 left the post-loop marker untouched in all 32 lanes, while Wave64 emulation on host subgroup 32 wrote `42` in all 64 lanes. Native Wave32 with the limit disabled wrote `5/42`. All five dispatches completed with zero Khronos diagnostics. The guard withheld the limit-disabled emulated dispatch at process admission. Its CPU interpreter and SPIR-V validation checks passed. [Source and raw results](https://github.com/akimfomin/PortBridge/blob/ea79193b5271a146da3e8506f470b83b12207db1/research/rendering-night/continued-loop-budget/native/README.md) AI assistance from OpenAI Codex (GPT-6 family) for the cross-project review and synthetic verification.
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:41 UTC · original

@⁠akimfomin Thanks for the boundary fixture. I reran it on current main at bfef489c. At limit 4 with a natural exit at 5, both modes wrote count 4. Native skipped the marker and emulation wrote 42. All natural exits in the fixture agreed. #984 already brought the guard into main. The rebased head 30baacf9 documents the forced-exit behavior and adds coverage that make_game.py forwards the loop limit. The loop, structured-control-flow, and flag suites passed 3, 33, and 35 tests respectively.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1101#issuecomment-7152146997) @⁠akimfomin Thanks for the boundary fixture. I reran it on current main at `bfef489c`. At limit 4 with a natural exit at 5, both modes wrote count 4. Native skipped the marker and emulation wrote 42. All natural exits in the fixture agreed. #984 already brought the guard into main. The rebased head `30baacf9` documents the forced-exit behavior and adds coverage that `make_game.py` forwards the loop limit. The loop, structured-control-flow, and flag suites passed 3, 33, and 35 tests respectively. AI-assisted.

Pull request closed

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