Skip to content

Commit

Permalink
Mooncake Ext (#741)
Browse files Browse the repository at this point in the history
* Mooncake ext

* Bump patch version

* Update ext/DynamicPPLMooncakeExt.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update test/ext/DynamicPPLMooncakeExt.jl

* Update test/ext/DynamicPPLMooncakeExt.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
willtebbutt and github-actions[bot] authored Dec 8, 2024
1 parent f0c31f0 commit 5316700
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DynamicPPL"
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
version = "0.31.3"
version = "0.31.4"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -30,13 +30,15 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[extensions]
DynamicPPLChainRulesCoreExt = ["ChainRulesCore"]
DynamicPPLEnzymeCoreExt = ["EnzymeCore"]
DynamicPPLForwardDiffExt = ["ForwardDiff"]
DynamicPPLMCMCChainsExt = ["MCMCChains"]
DynamicPPLMooncakeExt = ["Mooncake"]
DynamicPPLZygoteRulesExt = ["ZygoteRules"]

[compat]
Expand All @@ -58,6 +60,7 @@ LogDensityProblems = "2"
LogDensityProblemsAD = "1.7.0"
MCMCChains = "6"
MacroTools = "0.5.6"
Mooncake = "0.4.59"
OrderedCollections = "1"
Random = "1.6"
Requires = "1"
Expand Down
9 changes: 9 additions & 0 deletions ext/DynamicPPLMooncakeExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module DynamicPPLMooncakeExt

using DynamicPPL: DynamicPPL, istrans
using Mooncake: Mooncake

# This is purely an optimisation.
Mooncake.@zero_adjoint Mooncake.DefaultCtx Tuple{typeof(istrans),Vararg}

end # module
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ LogDensityProblems = "2"
LogDensityProblemsAD = "1.7.0"
MCMCChains = "6.0.4"
MacroTools = "0.5.6"
Mooncake = "0.4.50"
Mooncake = "0.4.59"
ReverseDiff = "1"
StableRNGs = "1"
Tracker = "0.2.23"
Expand Down
5 changes: 5 additions & 0 deletions test/ext/DynamicPPLMooncakeExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@testset "DynamicPPLMooncakeExt" begin
Mooncake.TestUtils.test_rule(
StableRNG(123456), istrans, VarInfo(); unsafe_perturb=true, interface_only=true
)
end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using LogDensityProblems, LogDensityProblemsAD
using MacroTools
using MCMCChains
using Mooncake: Mooncake
using StableRNGs
using Tracker
using ReverseDiff
using Zygote
Expand Down Expand Up @@ -77,6 +78,7 @@ include("test_util.jl")

@testset "ad" begin
include("ext/DynamicPPLForwardDiffExt.jl")
include("ext/DynamicPPLMooncakeExt.jl")
include("ad.jl")
end

Expand Down

2 comments on commit 5316700

@penelopeysm
Copy link
Member

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/120957

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.31.4 -m "<description of version>" 5316700c1f5a8ff608294f32297e245e9b39d761
git push origin v0.31.4

Please sign in to comment.