Repository navigation
Budget the dyld classifier in CPU time, not wall clock - #10003
Merged
Merged
Conversation
Backend CI (Python 3.13) failed on main a6887c5: test_a_pathological_reason_does_not_stall_the_classifier AssertionError: assert (728.070290015 - 727.064322356) < 1.0 1.006s against a 1.0s budget, missed by six milliseconds, on a classifier that costs about ten. The caps #8574 added are working. Measured here, the classifier holds ~0.0097s median over seven runs, 0.0168s worst, which is a hundredfold margin under the budget. Nothing regressed; the clock was the wrong one. What the caps buy is that the candidate scan stops being quadratic, and that is a cost in cycles. Wall clock also counts every microsecond this thread is not running, and a hosted runner running the whole backend suite deschedules freely. Pinned to one core, against four spinners on that same core: no contention wall 0.0097s cpu 0.0097s contended wall 0.0429s cpu 0.0118s contended wall 0.0249s cpu 0.0098s contended wall 0.0516s cpu 0.0096s Identical work. The wall reading moves 5.3x and the CPU reading does not move at all. That is the whole failure: CI charged the classifier for time it spent waiting for a core. So the assertion measures time.process_time(). The budget stays 1.0s because it was never the problem: healthy is ~0.01s and the regression it guards is 6.3s, two orders of magnitude of room on either side. It keeps its teeth. Lifting _DYLD_REASON_MAX_CHARS and _DYLD_REASON_SCAN_CHARS to 100M restores the quadratic scan, and the assertion catches it on CPU time at 6.33s, which is the 6.3s the docstring records. Under the four spinners above the whole file passes, taking 25.4s wall for what is normally 6s. One thing this does not show: that the old assertion would have failed under that same contention. It would not have -- 0.0516s is well inside 1.0s. CI's 1.006s on a 0.01s classifier is roughly a hundredfold inflation, heavier than four spinners on one core reproduce here. The mechanism is what is demonstrated, and it is the only thing that explains a six-millisecond miss on a budget with a hundredfold margin. studio/backend/tests/test_llama_cpp_start_failure_classification.py: 224 passed.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Backend CI→(Python 3.13)failed on maina6887c5ee:1.006s against a 1.0s budget. Missed by six milliseconds, on a classifier that costs about ten.
Nothing regressed
The caps #8574 added are working. Measured locally, the classifier holds 0.0097s median over seven runs, 0.0168s worst — a hundredfold margin under the budget. The clock was the wrong one.
What the caps buy is that the candidate scan stops being quadratic, and that is a cost in cycles. Wall clock also counts every microsecond the thread is not running, and a hosted runner running the whole backend suite deschedules freely. Pinned to one core, against four spinners on that same core:
Identical work. The wall reading moves 5.3x; the CPU reading does not move at all. CI charged the classifier for time it spent waiting for a core.
The change
The assertion measures
time.process_time(). The budget stays1.0because it was never the problem: healthy is ~0.01s and the regression it guards is 6.3s, two orders of magnitude of room on either side.It keeps its teeth
Lifting
_DYLD_REASON_MAX_CHARSand_DYLD_REASON_SCAN_CHARSto 100M restores the quadratic scan, and the assertion catches it on CPU time at 6.33s — the 6.3s the docstring records:Under the four spinners above the whole file passes, taking 25.4s wall for what is normally 6s.
What this does not show
That the old assertion would have failed under that same contention. It would not have: 0.0516s is well inside 1.0s. CI's 1.006s on a 0.01s classifier is roughly a hundredfold inflation, heavier than four spinners on one core reproduce here. The mechanism is what is demonstrated, and it is the only thing that explains a six-millisecond miss on a budget with a hundredfold margin.
studio/backend/tests/test_llama_cpp_start_failure_classification.py: 224 passed.