Skip to content

Generate forward_as_tuple for tuple expressions, fully template tuple functions#1535

Merged
WardBrian merged 9 commits intomasterfrom
fix/forward-as-tuple
Aug 6, 2025
Merged

Generate forward_as_tuple for tuple expressions, fully template tuple functions#1535
WardBrian merged 9 commits intomasterfrom
fix/forward-as-tuple

Conversation

@WardBrian
Copy link
Copy Markdown
Member

Closes both #1534 and #1532.

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

Updated code generation of tuples to avoid issues with dangling references and some generated code being uncompilable.

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)

@WardBrian WardBrian changed the title Fix/forward as tuple Generate forward_as_tuple for tuple expressions, fully template tuple functions Jul 23, 2025
@WardBrian WardBrian requested a review from SteveBronder July 23, 2025 20:21
@WardBrian WardBrian added cleanup Code simplification or clean-up robustness cpp-codegen labels Jul 23, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 23, 2025

Codecov Report

❌ Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.76%. Comparing base (1d44b05) to head (d3e48e7).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/stan_math_backend/Lower_functions.ml 96.55% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1535   +/-   ##
=======================================
  Coverage   89.76%   89.76%           
=======================================
  Files          66       66           
  Lines        9890     9890           
=======================================
  Hits         8878     8878           
  Misses       1012     1012           
Files with missing lines Coverage Δ
src/stan_math_backend/Cpp.ml 89.48% <100.00%> (ø)
src/stan_math_backend/Lower_expr.ml 93.70% <100.00%> (ø)
src/stan_math_backend/Lower_program.ml 99.19% <100.00%> (ø)
src/stan_math_backend/Lower_stmt.ml 95.65% <100.00%> (ø)
src/stan_math_backend/Lower_functions.ml 96.75% <96.55%> (ø)
🚀 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
Copy link
Copy Markdown
Member Author

WardBrian commented Jul 23, 2025

@SteveBronder it looks like the only things that failed were some of the nasty laplace examples

Think I've got it now

@nsiccha
Copy link
Copy Markdown

nsiccha commented Jul 24, 2025

Cool, thanks @WardBrian. If you like (and github builds the stanc executable) I could try whether this runs with the original model, which is slightly more complex than the MWE.

@nsiccha
Copy link
Copy Markdown

nsiccha commented Jul 25, 2025

I can try that and report back if it helps! We've for now moved to the serial implementation, which works well enough for now for us :)

@WardBrian WardBrian merged commit ef5a316 into master Aug 6, 2025
3 checks passed
@WardBrian WardBrian deleted the fix/forward-as-tuple branch August 6, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment