Repository navigation
Take the least of the rounds in the token allocation helper, not the median - #139
Merged
Merged
Conversation
…median The first CI run of the new test workflow failed Allocation_Channel (Transform and AsyncPool, net11.0 Debug): 655 bytes for the same token twice against 638 for one command token, slack 16. The helper reads the per-thread allocated-bytes counter, so another thread cannot add to a window; the measuring thread itself sees transient extra allocation in a share of the rounds (blocks of about 140 calls at +128 bytes, single calls at about +920 bytes), and the median of the rounds follows it. The failure was not reproduced locally in 115 runs; the cause is only partly explained. BytesPerCall now returns the least of the 7 rounds per call variant. The slack and the assertions are unchanged. Allocation_Terminals, Allocation_Iterate and Allocation_Channel use the helper and benefit. A planted per-call allocation still fails all six Channel shapes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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 token allocation test now takes the least of its 7 rounds per call variant instead of the median, because a round's average on the measuring thread is shifted by transient extra allocation that the median follows.
The failure was seen once, in the first CI run of the new test workflow (net11.0 Debug,
Allocation_Channel, shapesTransformandAsyncPool: 655 bytes per call for the same token twice against 638 for one command token, slack 16). It was NOT reproduced locally in 65 runs of all six shapes (see Verification), so the cause is only partly explained, and this change is a hardening of the measurement, not a proven cure for that one failure.What changed
Test only (
TokenTerminalTests.BytesPerCall): the helper returns the least of the 7 per-round bytes-per-call values for each variant, not their median. The slack (16), the assertions and the library are unchanged.Allocation_Terminals,Allocation_IterateandAllocation_Channelall use the helper and all get the change.What the measurement showed:
Verification
Before the change (diagnostic copy of the helper, since reverted;
Allocation_Channel, all six shapes per run, 65 runs, none failed):After the change:
Allocation_Channel, net11.0 Debug, 4 processors: 20 of 20 pass; net11.0 Release, 4 processors: 10 of 10 pass.Allocation_Channelshapes fail, for example "Transform: one call token allocates 480, one command token 392 ... slack 16".Not done
🤖 Generated with Claude Code