You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cap canonical-form expansion to fix#1069 OOM/hang in big_o
Composed-path overheads that traverse quadratic-overhead reductions
(e.g. QuadraticAssignment) form nested (sum)^2*(sum)^2 expressions.
canonical_form() expanded these into sum-of-monomials, which is
exponential in nesting depth, blowing up to multi-GB and OOM/hanging
`pred path --all`. On CI this SIGTERM-killed the Test job (exit 143)
via the integration test test_path_all_max_paths_truncates.
Add a hard cap (MAX_CANONICAL_TERMS) on the intermediate term count,
checked before the Cartesian product is materialized. On overflow,
expansion is abandoned with CanonicalizationError::Unsupported; the
existing big_o_of fallback then prints the compact, un-expanded
expression instead of hanging. Paths are still enumerated and shown
— only the Big-O rendering of pathological paths degrades to
un-simplified form. Stopgap until the symbolic system is reworked to
derive Big-O structurally without full expansion.
Regression tests:
- canonical: nested-power blowup returns Unsupported; moderate power
still expands normally (cap does not perturb legitimate exprs)
- big_o: pathological nesting errors instead of hanging
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments