Repository navigation
compact: reduce unmerged sums horizontally, like LLVM's SLP reductions - #33
Draft
Transurgeon wants to merge 7 commits into
Draft
Transurgeon wants to merge 7 commits into
Transurgeon wants to merge 7 commits into
Conversation
A term that merges with no other term may be a long chain of adds, e.g. an objective accumulated as f = f + term_k in a loop. Its operands are flattened (iteratively, so deep chains work), compacted and summed, and the result is kept only if the graph gets smaller. 20000-term loop objective: Problem build 32 s -> 5 ms, objective + gradient + Hessian 10.5 s -> 4 ms, same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename insts -> instructions and lanes -> rows, and document compact and its helpers with Parameters/Returns sections, following CVXPY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
compact stacks scalar expressions into rows; it does not sum them, so "term" was misleading. Rename UnsupportedTermError to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like an LLVM pass pipeline, Problem now runs compact on the objective (merging a loop-built sum(terms)) and on each run of consecutive scalar constraints. Merged rows are gathered back into the given order with one index node, so constraint values, Jacobian rows and Lagrange multipliers keep their order. test_vectorize_problems now builds the scalar problems directly with Problem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Transurgeon
force-pushed
the
compact-reduction
branch
from
November 9, 2026 01:03
7106220 to
5c03238
Compare
Transurgeon
force-pushed
the
scalar-perf
branch
from
November 9, 2026 01:03
3aa02ff to
b49ba05
Compare
This branch has not been deployed
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.
A term that merges with no other term may be a long chain of adds, e.g. an objective accumulated as f = f + term_k in a loop. Its operands are flattened (iteratively, so deep chains work), compacted and summed, and the result is kept only if the graph gets smaller.
20000-term loop objective: Problem build 32 s -> 5 ms, objective + gradient + Hessian 10.5 s -> 4 ms, same value.