From 73fc702095063571e286cb811f13dd769fec582c Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Mon, 26 May 2025 10:44:59 -0500 Subject: [PATCH 1/2] Add warnings --- Project.toml | 2 ++ src/Enzyme.jl | 1 + 2 files changed, 3 insertions(+) diff --git a/Project.toml b/Project.toml index cf95ef5e1c..8b43f110c7 100644 --- a/Project.toml +++ b/Project.toml @@ -21,6 +21,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [weakdeps] BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" +DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" @@ -29,6 +30,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [extensions] EnzymeBFloat16sExt = "BFloat16s" EnzymeChainRulesCoreExt = "ChainRulesCore" +EnzymeDifferentiationInterfaceExt = "DifferentiationInterface" EnzymeGPUArraysCoreExt = "GPUArraysCore" EnzymeLogExpFunctionsExt = "LogExpFunctions" EnzymeSpecialFunctionsExt = "SpecialFunctions" diff --git a/src/Enzyme.jl b/src/Enzyme.jl index 2bf70c2afe..72a4a24fb7 100644 --- a/src/Enzyme.jl +++ b/src/Enzyme.jl @@ -1520,5 +1520,6 @@ Returns true if within autodiff, otherwise false. @inline EnzymeCore.within_autodiff() = false include("precompile.jl") +include("init.jl") end # module From a9476585399e8ac620b51ee4bd0112065b8eeae2 Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Mon, 26 May 2025 10:48:07 -0500 Subject: [PATCH 2/2] add actual files --- ext/EnzymeDifferentiationInterfaceExt.jl | 10 ++++++++++ src/init.jl | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 ext/EnzymeDifferentiationInterfaceExt.jl create mode 100644 src/init.jl diff --git a/ext/EnzymeDifferentiationInterfaceExt.jl b/ext/EnzymeDifferentiationInterfaceExt.jl new file mode 100644 index 0000000000..c79aa909af --- /dev/null +++ b/ext/EnzymeDifferentiationInterfaceExt.jl @@ -0,0 +1,10 @@ +module EnzymeDifferentiationInterfaceExt + +function __init__() + @warn """You are using DifferentiationInterface!" + DifferentiationInterface introduces interstitial wrappers that may limit the scope of input programs and add overhead." + This can cause derivatives to be slower, or fail to differentiate with default settings when they work with Enzyme directly (e.g. Enzyme.gradient instead of DI.gradient)." + If you find issues, please report at https://github.com/EnzymeAD/Enzyme.jl/issues/new and try Enzyme directly in the interim.""" +end + +end # module diff --git a/src/init.jl b/src/init.jl new file mode 100644 index 0000000000..07357bcba9 --- /dev/null +++ b/src/init.jl @@ -0,0 +1,9 @@ + +function __init__() + if VERSION >= v"1.11.0" + @warn """You are using Julia v1.11 or later!" + Julia 1.11 changes the default Array type to contain a triply-nested pointer, rather than a doubly nested pointer." + This may cause programs (primal but especially derivatives) to be slower, or fail to differentiate with default settings when they previously worked on 1.10." + If you find issues, please report at https://github.com/EnzymeAD/Enzyme.jl/issues/new and try Julia 1.10 in the interim.""" + end +end \ No newline at end of file