Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ jobs:
- ForwardDiff
- GTPSA
- Mooncake
- Mooncake-old
- PolyesterForwardDiff
- ReverseDiff
- SparsityDetector
Expand Down
10 changes: 9 additions & 1 deletion DifferentiationInterface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.16...main)
## [Unreleased](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.17...main)

## [0.7.17](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.16...DifferentiationInterface-v0.7.17)

### Fixed

- Make DI compatible with latest Mooncake friendly tangents ([#1001](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/1001))
- Add docstrings to the result anlysis methods for sparse matrix preparations ([#984](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/984))
- Make wrong-mode pushforward/pullback return the correct array type ([#974](https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/974))

## [0.7.16](https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.7.15...DifferentiationInterface-v0.7.16)

Expand Down
4 changes: 2 additions & 2 deletions DifferentiationInterface/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DifferentiationInterface"
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
version = "0.7.16"
version = "0.7.17"
authors = ["Guillaume Dalle", "Adrian Hill"]

[deps]
Expand Down Expand Up @@ -71,7 +71,7 @@ ForwardDiff = "0.10.36,1"
GPUArraysCore = "0.2"
GTPSA = "1.4.0"
LinearAlgebra = "1"
Mooncake = "0.5.1 - 0.5.24"
Mooncake = "0.5.1"
PolyesterForwardDiff = "0.1.2"
ReverseDiff = "1.15.1"
SparseArrays = "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ using Mooncake:
NoRData,
primal,
_copy_output,
_copy_to_output!!,
tangent_to_primal!!
_copy_to_output!!

const AnyAutoMooncake{C} = Union{AutoMooncake{C}, AutoMooncakeForward{C}}

DI.check_available(::AnyAutoMooncake{C}) where {C} = true
DI.inner_preparation_behavior(::AutoMooncakeForward) = DI.PrepareInnerSimple()

@inline new_friendly_tangents() = isdefined(Mooncake, :FriendlyTangentCache)

include("utils.jl")
include("onearg.jl")
include("twoarg.jl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ function call_and_return(f!::F, y, x, contexts...) where {F}
return y
end

function adaptive_tangent_to_primal!!(primal, tangent)
@static if new_friendly_tangents()
# TODO: optimize performance by allocating cache during prep
return Mooncake.tangent_to_friendly!!(primal, tangent)
else
return Mooncake.tangent_to_primal!!(primal, tangent)
end
end

function zero_tangent_or_primal(x, backend::AnyAutoMooncake)
if get_config(backend).friendly_tangents
# zero(x) but safer
return tangent_to_primal!!(_copy_output(x), zero_tangent(x))
return adaptive_tangent_to_primal!!(_copy_output(x), zero_tangent(x))
else
return zero_tangent(x)
end
Expand Down
13 changes: 13 additions & 0 deletions DifferentiationInterface/test/Back/Mooncake-old/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
DifferentiationInterfaceTest = "a82114a7-5aa3-49a8-9643-716bb13727a3"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Mooncake = "<0.5.25"
1 change: 1 addition & 0 deletions DifferentiationInterface/test/Back/Mooncake-old/test.jl
3 changes: 3 additions & 0 deletions DifferentiationInterface/test/Back/Mooncake/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
DifferentiationInterface = { path = "../../.." }

[compat]
Mooncake = ">=0.5.25"
15 changes: 9 additions & 6 deletions DifferentiationInterface/test/Back/Mooncake/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ test_differentiation(
@test grad.B == ps.A
end

test_differentiation(
backends[3:4],
nomatrix(static_scenarios());
logging = LOGGING,
excluded = SECOND_ORDER
)
# see https://github.com/JuliaDiff/DifferentiationInterface.jl/issues/986
if pkgversion(Mooncake) < v"0.5.25"
test_differentiation(
backends[3:4],
nomatrix(static_scenarios());
logging = LOGGING,
excluded = SECOND_ORDER
)
end
Loading