From 6f1acac037e3cf273aa666228566b167e23a9254 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 11 Nov 2025 17:47:35 +0000 Subject: [PATCH 1/3] Re-enable Mooncake --- test/Project.toml | 1 + test/ad.jl | 14 +++++--------- test/runtests.jl | 7 ------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index 2dbd5b455..d5988119a 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -19,6 +19,7 @@ LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" MarginalLogDensities = "f0c3360a-fb8d-11e9-1194-5521fd7ee392" +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" diff --git a/test/ad.jl b/test/ad.jl index d7505aab2..80ae458fa 100644 --- a/test/ad.jl +++ b/test/ad.jl @@ -5,15 +5,11 @@ using DynamicPPL.TestUtils.AD: run_ad, WithExpectedResult, NoTest # Used as the ground truth that others are compared against. ref_adtype = AutoForwardDiff() - test_adtypes = if MOONCAKE_SUPPORTED - [ - AutoReverseDiff(; compile=false), - AutoReverseDiff(; compile=true), - AutoMooncake(; config=nothing), - ] - else - [AutoReverseDiff(; compile=false), AutoReverseDiff(; compile=true)] - end + test_adtypes = [ + AutoReverseDiff(; compile=false), + AutoReverseDiff(; compile=true), + AutoMooncake(; config=nothing), + ] @testset "Unsupported backends" begin @model demo() = x ~ Normal() diff --git a/test/runtests.jl b/test/runtests.jl index 861d3bb87..c02996874 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -37,13 +37,6 @@ using DynamicPPL: getargs_dottilde, getargs_tilde const GROUP = get(ENV, "GROUP", "All") const AQUA = get(ENV, "AQUA", "true") == "true" -# Skip Mooncake if it doesn't work -const MOONCAKE_SUPPORTED = VERSION < v"1.12.0" -if MOONCAKE_SUPPORTED - Pkg.add("Mooncake") - using Mooncake: Mooncake -end - Random.seed!(100) include("test_util.jl") From e43f2f68b2c910e51872a9c081d3b485a8cedaab Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 11 Nov 2025 18:24:18 +0000 Subject: [PATCH 2/3] fixes --- test/ad.jl | 4 ++-- test/runtests.jl | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/test/ad.jl b/test/ad.jl index 80ae458fa..0236c232f 100644 --- a/test/ad.jl +++ b/test/ad.jl @@ -39,13 +39,13 @@ using DynamicPPL.TestUtils.AD: run_ad, WithExpectedResult, NoTest # Put predicates here to avoid long lines is_mooncake = adtype isa AutoMooncake is_1_10 = v"1.10" <= VERSION < v"1.11" - is_1_11 = v"1.11" <= VERSION < v"1.12" + is_1_11_or_1_12 = v"1.11" <= VERSION < v"1.13" is_svi_vnv = linked_varinfo isa SimpleVarInfo{<:DynamicPPL.VarNamedVector} is_svi_od = linked_varinfo isa SimpleVarInfo{<:OrderedDict} # Mooncake doesn't work with several combinations of SimpleVarInfo. - if is_mooncake && is_1_11 && is_svi_vnv + if is_mooncake && is_1_11_or_1_12 && is_svi_vnv # https://github.com/compintell/Mooncake.jl/issues/470 @test_throws ArgumentError DynamicPPL.LogDensityFunction( m, getlogjoint_internal, linked_varinfo; adtype=adtype diff --git a/test/runtests.jl b/test/runtests.jl index c02996874..7fba71e4d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -78,9 +78,7 @@ include("test_util.jl") end @testset "ad" begin include("ext/DynamicPPLForwardDiffExt.jl") - if MOONCAKE_SUPPORTED - include("ext/DynamicPPLMooncakeExt.jl") - end + include("ext/DynamicPPLMooncakeExt.jl") include("ad.jl") end @testset "prob and logprob macro" begin From a0fdc2aeac3657ba5489af04294c72632e44a6e0 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 11 Nov 2025 18:58:03 +0000 Subject: [PATCH 3/3] fix import --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index 7fba71e4d..5e40635e6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,7 @@ using MacroTools using MCMCChains using StableRNGs using ReverseDiff +using Mooncake using Zygote using Distributed