Skip to content

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Aug 13, 2025

@zero_adjoint only works for reverse-mode, the replacement is @zero_derivative which works for both forwards- and reverse-mode. See https://chalk-lab.github.io/Mooncake.jl/stable/developer_documentation/internal_docstrings/#Mooncake.@zero_adjoint-Tuple{Any,%20Any}

This is required because Mooncake.TestUtil.test_rule by default now tests both forwards- and reverse-mode, so to get the following test to pass we need to change the original definition.

@testset "DynamicPPLMooncakeExt" begin
Mooncake.TestUtils.test_rule(
StableRNG(123456), istrans, VarInfo(); unsafe_perturb=true, interface_only=true
)
end

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the DynamicPPLMooncakeExt module to be compatible with Mooncake version 0.4.147 by replacing the deprecated @zero_adjoint macro with the new @zero_derivative macro.

  • Replaces @zero_adjoint with @zero_derivative in the Mooncake extension
  • Updates changelog to document the compatibility fix for Mooncake 0.4.147

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
ext/DynamicPPLMooncakeExt.jl Updates macro call to use the new @zero_derivative instead of deprecated @zero_adjoint
HISTORY.md Adds changelog entry for version 0.37.1 documenting the Mooncake compatibility update

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

github-actions bot commented Aug 13, 2025

Benchmark Report for Commit 574baba

Computer Information

Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

|                 Model | Dimension |  AD Backend |      VarInfo Type | Linked | Eval Time / Ref Time | AD Time / Eval Time |
|-----------------------|-----------|-------------|-------------------|--------|----------------------|---------------------|
| Simple assume observe |         1 | forwarddiff |             typed |  false |                  8.3 |                 1.5 |
|           Smorgasbord |       201 | forwarddiff |             typed |  false |                632.9 |                45.9 |
|           Smorgasbord |       201 | forwarddiff | simple_namedtuple |   true |                407.5 |                62.4 |
|           Smorgasbord |       201 | forwarddiff |           untyped |   true |               1150.5 |                30.3 |
|           Smorgasbord |       201 | forwarddiff |       simple_dict |   true |               6424.8 |                26.0 |
|           Smorgasbord |       201 | reversediff |             typed |   true |               1022.1 |                39.8 |
|           Smorgasbord |       201 |    mooncake |             typed |   true |                973.8 |                 4.6 |
|    Loop univariate 1k |      1000 |    mooncake |             typed |   true |               5627.1 |                 4.4 |
|       Multivariate 1k |      1000 |    mooncake |             typed |   true |                978.2 |                 8.8 |
|   Loop univariate 10k |     10000 |    mooncake |             typed |   true |              63652.6 |                 4.1 |
|      Multivariate 10k |     10000 |    mooncake |             typed |   true |               8300.5 |                10.1 |
|               Dynamic |        10 |    mooncake |             typed |   true |                133.4 |                11.1 |
|              Submodel |         1 |    mooncake |             typed |   true |                 13.0 |                 5.3 |
|                   LDA |        12 | reversediff |             typed |   true |               1069.7 |                 2.5 |

@penelopeysm
Copy link
Member Author

It's not deprecated, AI hallucinating as usual :(

Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.26%. Comparing base (6742812) to head (574baba).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1021   +/-   ##
=======================================
  Coverage   82.26%   82.26%           
=======================================
  Files          38       38           
  Lines        3947     3947           
=======================================
  Hits         3247     3247           
  Misses        700      700           

☔ View full report in Codecov by Sentry.
📢 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.

@coveralls
Copy link

coveralls commented Aug 13, 2025

Pull Request Test Coverage Report for Build 16937863462

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage remained the same at 82.516%

Files with Coverage Reduction New Missed Lines %
src/bijector.jl 1 93.33%
src/varinfo.jl 3 85.33%
Totals Coverage Status
Change from base Build 16879750686: 0.0%
Covered Lines: 3247
Relevant Lines: 3935

💛 - Coveralls

@penelopeysm penelopeysm requested a review from sunxd3 August 13, 2025 13:26
Copy link
Member

@sunxd3 sunxd3 left a comment

Choose a reason for hiding this comment

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

thanks for looking after this, Penny

@penelopeysm
Copy link
Member Author

CI fails so I have the compulsion to do something 😄

@penelopeysm penelopeysm added this pull request to the merge queue Aug 13, 2025
@penelopeysm penelopeysm removed this pull request from the merge queue due to a manual request Aug 13, 2025
@penelopeysm penelopeysm merged commit 0cf3440 into main Aug 13, 2025
21 of 22 checks passed
@penelopeysm penelopeysm deleted the py/mooncake branch August 13, 2025 15:56
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.

3 participants