Skip to content

Split multi-term reductions in hoist_invariants - #9388

Open
alexreinking wants to merge 1 commit into
alexreinking/funcvecsfrom
alexreinking/hoist-splitting
Open

Split multi-term reductions in hoist_invariants#9388
alexreinking wants to merge 1 commit into
alexreinking/funcvecsfrom
alexreinking/hoist-splitting

Conversation

@alexreinking

Copy link
Copy Markdown
Member

Adjusts hoist_invariants (below in the stack) to return a FuncVec, where each entry is a separate handle to a parallel subterm, e.g. f() += a * g(r) + b * h(r) returns two intermediates (one for g, one for h), and replaces f with f() += a * f_intm0() + b * f_intm1() (i.e. scales are still hoisted).

Checklist

  • Tests added or updated (not required for docs, CI config, or typo fixes)
  • Documentation updated (if public API changed)
  • Python bindings updated (if public API changed)
  • Benchmarks are included here if the change is intended to affect performance.
  • Commits include AI attribution where applicable (see Code of Conduct)

Stack created with GitHub Stacks CLIGive Feedback 💬

Comment on lines +26 to +28
.def("hoist_invariants", [](Stage &stage) {
return std::vector<Func>(stage.hoist_invariants());
})

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't bother to bind FuncVec in Python because std::vector gets turned into a list, which supports destructuring natively in the language, like:

(f_intm,) = f.hoist_invariants()

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.16393% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.19%. Comparing base (8ed11d4) to head (e291904).

Files with missing lines Patch % Lines
src/Func.cpp 90.16% 0 Missing and 6 partials ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           alexreinking/funcvecs    #9388      +/-   ##
=========================================================
+ Coverage                  70.06%   70.19%   +0.13%     
=========================================================
  Files                        261      261              
  Lines                      79483    79510      +27     
  Branches                   19382    19391       +9     
=========================================================
+ Hits                       55693    55816     +123     
+ Misses                     17911    17899      -12     
+ Partials                    5879     5795      -84     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcourteaux
mcourteaux force-pushed the alexreinking/hoist-splitting branch from 5138a6a to e291904 Compare August 26, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant