Skip to content

Commit

Permalink
Revert "Revert "Adapt to pending Enzyme breaking change"" (#94)
Browse files Browse the repository at this point in the history
* Revert "Revert "Adapt to pending Enzyme breaking change (#92)" (#93)"

This reverts commit 5e9b84b.

* fix errors, bump Enzyme compat in test and run formatter
* remove Enzyme compat bound in tests like Tapir
  • Loading branch information
Red-Portal authored Sep 20, 2024
1 parent 5e9b84b commit be5d7b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ChainRulesCore = "1.16"
DiffResults = "1"
Distributions = "0.25.111"
DocStringExtensions = "0.8, 0.9"
Enzyme = "0.12.32"
Enzyme = "0.13"
FillArrays = "1.3"
ForwardDiff = "0.10.36"
Functors = "0.4"
Expand Down
9 changes: 5 additions & 4 deletions ext/AdvancedVIEnzymeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ end
function AdvancedVI.value_and_gradient!(
::ADTypes.AutoEnzyme, f, x::AbstractVector{<:Real}, out::DiffResults.MutableDiffResult
)
Enzyme.API.runtimeActivity!(true)
∇x = DiffResults.gradient(out)
fill!(∇x, zero(eltype(∇x)))
_, y = Enzyme.autodiff(
Enzyme.ReverseWithPrimal, Enzyme.Const(f), Enzyme.Active, Enzyme.Duplicated(x, ∇x)
Enzyme.set_runtime_activity(Enzyme.ReverseWithPrimal, true),
Enzyme.Const(f),
Enzyme.Active,
Enzyme.Duplicated(x, ∇x),
)
DiffResults.value!(out, y)
return out
Expand All @@ -35,11 +37,10 @@ function AdvancedVI.value_and_gradient!(
aux,
out::DiffResults.MutableDiffResult,
)
Enzyme.API.runtimeActivity!(true)
∇x = DiffResults.gradient(out)
fill!(∇x, zero(eltype(∇x)))
_, y = Enzyme.autodiff(
Enzyme.ReverseWithPrimal,
Enzyme.set_runtime_activity(Enzyme.ReverseWithPrimal, true),
Enzyme.Const(f),
Enzyme.Active,
Enzyme.Duplicated(x, ∇x),
Expand Down
1 change: 0 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Bijectors = "0.13"
DiffResults = "1.0"
Distributions = "0.25.111"
DistributionsAD = "0.6.45"
Enzyme = "0.12.32"
FillArrays = "1.6.1"
ForwardDiff = "0.10.36"
Functors = "0.4.5"
Expand Down

0 comments on commit be5d7b2

Please sign in to comment.