From 056f0fdfdb471faf2c131ac50ce2e5c0a059155a Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 11 Sep 2024 11:58:39 -0400 Subject: [PATCH 1/4] Mark istrans as inactive --- ext/DynamicPPLEnzymeCoreExt.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/DynamicPPLEnzymeCoreExt.jl b/ext/DynamicPPLEnzymeCoreExt.jl index f83d6e8f7..67a8222c6 100644 --- a/ext/DynamicPPLEnzymeCoreExt.jl +++ b/ext/DynamicPPLEnzymeCoreExt.jl @@ -10,4 +10,6 @@ end @inline EnzymeCore.EnzymeRules.inactive_type(::Type{<:DynamicPPL.SamplingContext}) = true +@inline EnzymeCore.EnzymeRules.inactive(::typeof(DynamicPPL.istrans), ::AbstractVarInfo) = nothing + end From 0046b787b9fde3ab729d41a052f705ca93b9177a Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 11 Sep 2024 12:01:07 -0400 Subject: [PATCH 2/4] Update DynamicPPLEnzymeCoreExt.jl --- ext/DynamicPPLEnzymeCoreExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/DynamicPPLEnzymeCoreExt.jl b/ext/DynamicPPLEnzymeCoreExt.jl index 67a8222c6..e3272487b 100644 --- a/ext/DynamicPPLEnzymeCoreExt.jl +++ b/ext/DynamicPPLEnzymeCoreExt.jl @@ -10,6 +10,6 @@ end @inline EnzymeCore.EnzymeRules.inactive_type(::Type{<:DynamicPPL.SamplingContext}) = true -@inline EnzymeCore.EnzymeRules.inactive(::typeof(DynamicPPL.istrans), ::AbstractVarInfo) = nothing +@inline EnzymeCore.EnzymeRules.inactive_noinl(::typeof(DynamicPPL.istrans), args...) = nothing end From 78d09f58402d72ace047600299236c2d786d7b98 Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 11 Sep 2024 12:45:58 -0400 Subject: [PATCH 3/4] Update DynamicPPLEnzymeCoreExt.jl --- ext/DynamicPPLEnzymeCoreExt.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/DynamicPPLEnzymeCoreExt.jl b/ext/DynamicPPLEnzymeCoreExt.jl index e3272487b..20e325fcd 100644 --- a/ext/DynamicPPLEnzymeCoreExt.jl +++ b/ext/DynamicPPLEnzymeCoreExt.jl @@ -10,6 +10,7 @@ end @inline EnzymeCore.EnzymeRules.inactive_type(::Type{<:DynamicPPL.SamplingContext}) = true +# Mark istrans as having 0 derivative @inline EnzymeCore.EnzymeRules.inactive_noinl(::typeof(DynamicPPL.istrans), args...) = nothing end From ed1776eb59b586969fa336dea60cca519d19a3e6 Mon Sep 17 00:00:00 2001 From: Markus Hauru Date: Thu, 12 Sep 2024 10:19:21 +0100 Subject: [PATCH 4/4] Expand Enzyme extension comment --- ext/DynamicPPLEnzymeCoreExt.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/DynamicPPLEnzymeCoreExt.jl b/ext/DynamicPPLEnzymeCoreExt.jl index 20e325fcd..ceb3f4981 100644 --- a/ext/DynamicPPLEnzymeCoreExt.jl +++ b/ext/DynamicPPLEnzymeCoreExt.jl @@ -10,7 +10,9 @@ end @inline EnzymeCore.EnzymeRules.inactive_type(::Type{<:DynamicPPL.SamplingContext}) = true -# Mark istrans as having 0 derivative -@inline EnzymeCore.EnzymeRules.inactive_noinl(::typeof(DynamicPPL.istrans), args...) = nothing +# Mark istrans as having 0 derivative. The `nothing` return value is not significant, Enzyme +# only checks whether such a method exists, and never runs it. +@inline EnzymeCore.EnzymeRules.inactive_noinl(::typeof(DynamicPPL.istrans), args...) = + nothing end