Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
test_group: [
{test_type: 'ext', label: 'differentiation_interface'},
{test_type: 'ext', label: 'differentiation_interface_second_order'},
{test_type: 'ext', label: 'differentiation_interface_second_order_hvp'},
{test_type: 'ext', label: 'differentiation_interface_second_order_derivative'},
{test_type: 'ext', label: 'dynamic_expressions'},
{test_type: 'ext', label: 'flux'},
{test_type: 'ext', label: 'function_wrappers'},
Expand Down
10 changes: 7 additions & 3 deletions src/rules/misty_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ end
# reject our intentionally-older interpreter.
#
function _dual_mc(p::MistyClosure)
mc_world = UInt(p.oc.world)
interp = MooncakeInterpreter(DefaultCtx, ForwardMode; world=mc_world)
return build_frule(interp, p; skip_world_age_check=true)
return @static if VERSION ≤ v"1.12-"
build_frule(get_interpreter(ForwardMode), p)
else
mc_world = UInt(p.oc.world)
interp = MooncakeInterpreter(DefaultCtx, ForwardMode; world=mc_world)
build_frule(interp, p; skip_world_age_check=true)
end
end

tangent_type(::Type{<:MistyClosure}) = MistyClosureTangent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Pkg
Pkg.activate(@__DIR__)
Pkg.develop(; path=joinpath(@__DIR__, "..", "..", ".."))

using DifferentiationInterface, DifferentiationInterfaceTest
using Mooncake: Mooncake

function DifferentiationInterface.inner_preparation_behavior(::AutoMooncakeForward)
DifferentiationInterface.PrepareInnerSimple()
end

# Test second-order differentiation (forward-over-reverse)
test_differentiation(
[SecondOrder(AutoMooncakeForward(; config=nothing), AutoMooncake(; config=nothing))];
excluded=[FIRST_ORDER..., :hvp, :hessian], # testing only :second_derivative
logging=true,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Pkg
Pkg.activate(@__DIR__)
Pkg.develop(; path=joinpath(@__DIR__, "..", "..", ".."))

using DifferentiationInterface, DifferentiationInterfaceTest
using Mooncake: Mooncake

function DifferentiationInterface.inner_preparation_behavior(::AutoMooncakeForward)
DifferentiationInterface.PrepareInnerSimple()
end

# Test second-order differentiation (forward-over-reverse)
test_differentiation(
[SecondOrder(AutoMooncakeForward(; config=nothing), AutoMooncake(; config=nothing))];
excluded=[FIRST_ORDER..., :hessian, :second_derivative], # testing only hvp
logging=true,
)
Loading