Skip to content

Commit 5316700

Browse files
Mooncake Ext (#741)
* 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>
1 parent f0c31f0 commit 5316700

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.31.3"
3+
version = "0.31.4"
44

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

3536
[extensions]
3637
DynamicPPLChainRulesCoreExt = ["ChainRulesCore"]
3738
DynamicPPLEnzymeCoreExt = ["EnzymeCore"]
3839
DynamicPPLForwardDiffExt = ["ForwardDiff"]
3940
DynamicPPLMCMCChainsExt = ["MCMCChains"]
41+
DynamicPPLMooncakeExt = ["Mooncake"]
4042
DynamicPPLZygoteRulesExt = ["ZygoteRules"]
4143

4244
[compat]
@@ -58,6 +60,7 @@ LogDensityProblems = "2"
5860
LogDensityProblemsAD = "1.7.0"
5961
MCMCChains = "6"
6062
MacroTools = "0.5.6"
63+
Mooncake = "0.4.59"
6164
OrderedCollections = "1"
6265
Random = "1.6"
6366
Requires = "1"

ext/DynamicPPLMooncakeExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module DynamicPPLMooncakeExt
2+
3+
using DynamicPPL: DynamicPPL, istrans
4+
using Mooncake: Mooncake
5+
6+
# This is purely an optimisation.
7+
Mooncake.@zero_adjoint Mooncake.DefaultCtx Tuple{typeof(istrans),Vararg}
8+
9+
end # module

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ LogDensityProblems = "2"
4545
LogDensityProblemsAD = "1.7.0"
4646
MCMCChains = "6.0.4"
4747
MacroTools = "0.5.6"
48-
Mooncake = "0.4.50"
48+
Mooncake = "0.4.59"
4949
ReverseDiff = "1"
5050
StableRNGs = "1"
5151
Tracker = "0.2.23"

test/ext/DynamicPPLMooncakeExt.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@testset "DynamicPPLMooncakeExt" begin
2+
Mooncake.TestUtils.test_rule(
3+
StableRNG(123456), istrans, VarInfo(); unsafe_perturb=true, interface_only=true
4+
)
5+
end

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ using LogDensityProblems, LogDensityProblemsAD
1313
using MacroTools
1414
using MCMCChains
1515
using Mooncake: Mooncake
16+
using StableRNGs
1617
using Tracker
1718
using ReverseDiff
1819
using Zygote
@@ -77,6 +78,7 @@ include("test_util.jl")
7778

7879
@testset "ad" begin
7980
include("ext/DynamicPPLForwardDiffExt.jl")
81+
include("ext/DynamicPPLMooncakeExt.jl")
8082
include("ad.jl")
8183
end
8284

0 commit comments

Comments
 (0)