From cb74d52c6fa75010017af429334a5ca1051bb183 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Thu, 10 Apr 2025 09:12:43 +0200 Subject: [PATCH 1/2] perf: remove Mooncake warmup during preparation --- .../ext/DifferentiationInterfaceMooncakeExt/onearg.jl | 4 +--- .../ext/DifferentiationInterfaceMooncakeExt/twoarg.jl | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/onearg.jl index 2e46bc7c4..d637a01bd 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/onearg.jl @@ -17,7 +17,6 @@ function DI.prepare_pullback_nokwarg( y = f(x, map(DI.unwrap, contexts)...) dy_righttype = zero_tangent(y) prep = MooncakeOneArgPullbackPrep(_sig, cache, dy_righttype) - DI.value_and_pullback(f, prep, backend, x, ty, contexts...) return prep end @@ -111,11 +110,10 @@ function DI.prepare_gradient_nokwarg( ) where {F,C} _sig = DI.signature(f, backend, x, contexts...; strict) config = get_config(backend) - cache = prepare_pullback_cache( + cache = prepare_gradient_cache( f, x, map(DI.unwrap, contexts)...; config.debug_mode, config.silence_debug_messages ) prep = MooncakeGradientPrep(_sig, cache) - DI.value_and_gradient(f, prep, backend, x, contexts...) return prep end diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/twoarg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/twoarg.jl index e89fbc37e..24cb39e41 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/twoarg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceMooncakeExt/twoarg.jl @@ -31,7 +31,6 @@ function DI.prepare_pullback_nokwarg( ) dy_righttype_after = zero_tangent(y) prep = MooncakeTwoArgPullbackPrep(_sig, cache, dy_righttype_after, target_function) - DI.value_and_pullback(f!, y, prep, backend, x, ty, contexts...) return prep end From eadb50e634cbe44cee5e8a0291f3b29a3e886d2a Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Thu, 10 Apr 2025 09:14:15 +0200 Subject: [PATCH 2/2] Bump --- DifferentiationInterface/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DifferentiationInterface/Project.toml b/DifferentiationInterface/Project.toml index c14bca747..f6527dd12 100644 --- a/DifferentiationInterface/Project.toml +++ b/DifferentiationInterface/Project.toml @@ -1,7 +1,7 @@ name = "DifferentiationInterface" uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" authors = ["Guillaume Dalle", "Adrian Hill"] -version = "0.6.50" +version = "0.6.51" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"