Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Gibbs inner loop with recursion #2464

Merged
merged 4 commits into from
Jan 15, 2025
Merged

Conversation

mhauru
Copy link
Member

@mhauru mhauru commented Jan 14, 2025

Fixes #2445

This seems to help with the type inference regression in Julia v1.11. #2445 should be fixed anyway in v1.11.3, but never hurts to help the type inference machinery, let the compiler unroll the loop if it feels like it.

Also made the same change in initialstep, for consistency, and to neatly ensure that states is always a tuple. Also, in the process, removed some initialisation of the varinfo in initialstep, that was repeating work done in https://github.com/TuringLang/DynamicPPL.jl/blob/e673b69210e85b60199f2ccd8165226cb03cf040/src/sampler.jl#L113.

We were doing work that was already done by the caller of initialstep.
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.01%. Comparing base (7d6f8ed) to head (a8fd37e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2464      +/-   ##
==========================================
+ Coverage   84.88%   85.01%   +0.13%     
==========================================
  Files          21       21              
  Lines        1581     1582       +1     
==========================================
+ Hits         1342     1345       +3     
+ Misses        239      237       -2     

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

@mhauru mhauru marked this pull request as ready for review January 14, 2025 11:57
@mhauru mhauru requested a review from penelopeysm January 14, 2025 11:57
@coveralls
Copy link

coveralls commented Jan 14, 2025

Pull Request Test Coverage Report for Build 12771943133

Details

  • 33 of 33 (100.0%) changed or added relevant lines in 1 file are covered.
  • 134 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-8.6%) to 76.459%

Files with Coverage Reduction New Missed Lines %
src/mcmc/hmc.jl 134 0.0%
Totals Coverage Status
Change from base Build 12675082674: -8.6%
Covered Lines: 1205
Relevant Lines: 1576

💛 - Coveralls

@mhauru
Copy link
Member Author

mhauru commented Jan 14, 2025

The discrepancy in test suite runtimes between 1.10 and 1.11 is now gone, as expected.

* Variable naming, destructuring

* Tuple -> Vec
@penelopeysm
Copy link
Member

I supposeeeee we should wait for CI to run again, because I don't know if my renaming broke something, but otherwise happy

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mhauru mhauru merged commit 11944c9 into master Jan 15, 2025
60 of 62 checks passed
@mhauru mhauru deleted the mhauru/recursive-gibbs branch January 15, 2025 10:11
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.

Gibbs performance regression on Julia v1.11
3 participants