Skip to content

Update size codegen to reduce bracket depth as number of parameters grows#1542

Merged
WardBrian merged 3 commits intomasterfrom
less-bracket-depth
Sep 24, 2025
Merged

Update size codegen to reduce bracket depth as number of parameters grows#1542
WardBrian merged 3 commits intomasterfrom
less-bracket-depth

Conversation

@WardBrian
Copy link
Copy Markdown
Member

The current codegen has occasionally lead to issues for clang users who use BRMS and end up with a lot of parameters. We were already using very similar logic elsewhere that didn't generate a ton of extra parenthesis, so I just made them use the same logic.

Submission Checklist

  • Run unit tests
  • Documentation
    • If a user-facing facing change was made, the documentation PR is here:
    • OR, no user-facing changes were made

Release notes

The C++ generated by models with many individually named parameters should be less likely to produce errors complaining about bracket depth exceeded

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.24%. Comparing base (4156b8e) to head (ef31047).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1542      +/-   ##
==========================================
- Coverage   90.25%   90.24%   -0.02%     
==========================================
  Files          64       64              
  Lines        9914     9914              
==========================================
- Hits         8948     8947       -1     
- Misses        966      967       +1     
Files with missing lines Coverage Δ
src/stan_math_backend/Lower_program.ml 98.93% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 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.

@WardBrian WardBrian requested a review from nhuurre September 24, 2025 15:47
@WardBrian WardBrian merged commit cc00c23 into master Sep 24, 2025
3 checks passed
@WardBrian WardBrian deleted the less-bracket-depth branch September 24, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants