Repository navigation
fix(shaders): a loop that leaves by predicated EXITs ends at its closing self-branch (the last program that did not lower) - #1810
Merged
hckrman101 merged 1 commit intoNov 10, 2026
Conversation
…nditional jump back One of OoT's compute programs is a loop that leaves only by @p0 EXIT: it ends with the loop's unconditional BRA back and the closing BRA to itself, and was refused as "native program has no unconditional EXIT". The self-branch was the end only after a jump table; now also when the instruction before it is an unconditional BRA or EXIT (nothing falls into it) and the program makes no calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Joey-Magnus
force-pushed
the
fix/lower-end-at-closing-branch
branch
from
November 10, 2026 18:01
8ca9cd3 to
7e1db37
Compare
Joey-Magnus
pushed a commit
to Joey-Magnus/Hookshot
that referenced
this pull request
Nov 10, 2026
…ed#1778 NotRexed#1789 NotRexed#1800 NotRexed#1806 NotRexed#1810 merged): to Fixed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last of OoT's programs that fail to translate (
f24a3ebf686232fb, a compute program with matrix multiplies) is refused as "native program has no unconditional EXIT". It's a loop that leaves only through@P0 EXIT, so it has no unconditional EXIT. It ends the way NVIDIA's compiler closes such programs: the loop's unconditionalBRAback, then aBRAto itself that nothing reaches.The end of the program (instructions 1808-1809, then NOP padding to 1823; its five EXITs at 646, 956, 1244, 1525 and 1528 are all
@P0):Change (
lower_to_maxwell.h, BRA): the closing self-branch already ended a program after a jump table (computed_branch). It now also ends one when the instruction before it is an unconditional BRA or EXIT, so nothing can fall into it, and the program makes no calls.finishstill refuses if any branch points past the end. A self-branch that can be fallen into is still not an end, and programs that end at an unconditional EXIT end there as before.Tests
tests/test_lower_end_at_closing_branch.py:@P0 EXIT; BRA 0; BRA selflowers and ends at the self-branch (refused onmain). After a NOP, the self-branch is no end.@P0 EXIT; EXIT; BRA selfends at the EXIT as before.run_all.py: all pass exceptnx2/test_nup_stand_in.py, red onmain(fixed by test(nup): the stand-in test's stub takes the progress #1764 passes (main is red) #1790).🤖 Generated with Claude Code