Skip global gradient propagation when no source can contribute - #196
Closed
genixpro wants to merge 1 commit into
Closed
Skip global gradient propagation when no source can contribute#196genixpro wants to merge 1 commit into
genixpro wants to merge 1 commit into
Conversation
Contributor
Author
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.
Stacked on #195; merge that PR first. This diff contains a five-line production fast path, focused tests, and the performance/equivalence evidence report.
A freshly seeded global gradient containing only values 0, 1 and 2 cannot change during propagation: zero is immutable, and neither 1 nor 2 can raise a free cell above its seed of 1. Return immediately when no input byte is at least 3, avoiding the two full-map sweeps that would otherwise discover this fixed point.
The comment states that invariant. The check deliberately accepts contributing seeds of 3 and 254 as well as 255-valued goals. It changes neither seed construction nor when callers refresh gradients, and introduces no cache or new persistent state.
Measured performance
Fresh measurements of the exact clean patches against
masteratb47c7d23b, on an Apple M3 with an optimized Apple Clang build. Median core simulation CPU time over three serial 15,000-tick runs:The timer covers advancing
Game::syncStepcalls, excluding AI order generation, order execution, startup and replay I/O. It was identical in all timed binaries and is absent from these commits. Runs were serial, variant order alternated, and competing compiler/game jobs triggered retries. The Playground setup uses Numbi on all eight teams, seed 424242, plus the headless passive local controller on team 0. These are CPU-time measurements on one machine, not FPS claims.The evidence report and raw samples/checksum digests include methodology and reproduction steps. They distinguish these results from the earlier 22–24% combined exploratory results on a different base, which also included a local-gradient rewrite. The experimental cache and local rewrite are not part of either PR.
Validation
global-gradient-testbuilds pass. The harness is wired into Linux CI by Reduce work in global gradient sweeps without changing results #195; hosted CI is pending.