Repository navigation
A budget stops an expansion and a linear solve over polynomials - #1746
Merged
Rafael-SOWNet merged 2 commits intoOct 4, 2026
Merged
Conversation
Expand's recursion and the fraction-free elimination behind the partial-fraction and ansatz solves check for cancellation, once a call and once a row: a search under a budget ran on inside an elimination for nine seconds past it, building rows nothing would read. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.
Part of #718.
A computation under a cancellation token -- the corpus harness's budget, or a caller's timeout -- ran on past the cancellation inside an expansion and inside the linear solve over polynomials that partial fractions makes, since neither looked at the token. On sixty of the problems that ran past the 5-second budget in the corpus run on master
cb8e133d, the first sixty of families 1, 3, 4 and 6, run one after another in one process per build at that budget, each on a thread of its own and a problem that does not stop left running beside the next, under a 2 GB heap:7075a747The latest any of this column stopped is 6.7 s. Sampled past the cancellation on master, four of the seven that ran on for a minute were in the linear solve over polynomials, two of them, in an expansion, one, and evaluating at pinned symbols what partial fractions had built, one.
What changes.
MultithreadingFunctional.ExitIfCancelled, which forty other places in the library call -- the simplifier, the polynomial GCD and factorisation, the solvers, the limits -- is called once per expansion of a product or a power,TreeAnalyzer.SmartExpandOver, and once per row of the elimination inPartialFractions.TrySolveOverPolynomials.MaxExpansionTermCountbounds the terms of one expansion, not the time the expansions of a computation take between them. With no token set the call does nothing, and no answer differs, so there is no entry inBREAKING-CHANGES.md, as there was none for #870; a caller whose token is cancelled gets the cancellation from an expansion now, as from the other steps.Tests:
ExpansionCancelTest: an expansion of(a + b + c)^5 (d + e)^3under a token cancelled before it starts throwsOperationCanceledException, and on master it completes; one that is not cancelled completes.The suite passes on the commit measured,
93dcd0ac, 14,782 tests with 13 skipped. On the merge with master3f744439,14f4da3d, the multithreading tests, #1743's and the corpus gate pass, 115 of them. The allocation gate was not run here; the check is one read of anAsyncLocalper call and allocates nothing, and CI runs the gate.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura