Skip to content

feat(shader): keep barriers after a loop's iteration cap behind VICTORY_BARRIER_AFTER_CAP - #514

Closed
Zeyphers wants to merge 1 commit into
pragyaangaur:mainfrom
Zeyphers:feat/barrier-after-cap
Closed

Zeyphers wants to merge 1 commit into
pragyaangaur:mainfrom
Zeyphers:feat/barrier-after-cap

Conversation

@Zeyphers

Copy link
Copy Markdown
Contributor

What changed

VICTORY_BARRIER_AFTER_CAP=1 keeps a group barrier that a lane may have left the program before, at a capped back edge's iteration limit (LOOP_LIMIT), instead of refusing the whole program with "an s_barrier where a lane may have left the program early at a loop's iteration limit". It is off by default, and the shader cache key now includes it, like thread_ticket.

Why

That refusal drops 15 compute programs in Series 1.0.2.1's world on an M1 Max. Among them are CS_TAA2_Resolve, CS_ScreenProbes_Inject, CS_ScreenProbes_RadianceSpatialFilter, the raster classification passes and CS_CollectTriangles_Meshlets. Without the TAA resolve, the gameplay frame stays exactly black (0,0,0) even though about 4,900 draws a frame run. Cutscenes show only a flat fog colour.

With the switch on, all 15 translate. On the next run the prologue cell drew: the character, the cell, the window and the yard outside. The player is in control ("Move around / Move the camera") at about 1 s per frame, with 35 programs still untranslated instead of 46. No hang, GPU recovery or Metal error was logged.

The risk is the one the refusal guards against. If a lane really reaches the cap (2^14 iterations), its group waits at the barrier. Real loops in these programs stay far below that. That is why this is opt-in for now, rather than changing the cap's exit, which would be the fuller fix: break out of the loop instead of leaving the program.

Testing

🤖 Generated with Claude Code

…RY_BARRIER_AFTER_CAP

A group barrier that a lane may have left the program before, at a capped
back edge's iteration limit, refuses the whole program, since that lane
would leave the rest of the group waiting. Real loops stay far below the
limit, and the refusal drops programs such as Series 1.0.2.1's TAA
resolve (CS_TAA2_Resolve), the screen probes' inject and spatial filter
and the raster classification passes: 15 programs on an M1 Max.
VICTORY_BARRIER_AFTER_CAP=1 keeps the barrier instead. Off by default;
the shader cache keys on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pragyaangaur

Copy link
Copy Markdown
Owner

Thanks Zeyphers. This refusal is the one #408 added and #506 already made opt-in: the loop-cap barrier refusal is now off by default (VICTORY_CAP_BARRIERS=1 turns it back on), so the 15 compute programs you list, including the TAA resolve, are translated on main without a new switch. Your flag would be the opposite sense of the same behaviour and conflicts with that change, so I am closing this rather than carrying two names for one thing. If you still see CS_TAA2_Resolve refused on current main, please post the log line on #497.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants