Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions DifferentiationInterface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
## [0.6.54] - 2025-05-07

- Allocate Enzyme shadow memory during preparation ([#782])
### Added

- Error hints for Enzyme ([#788])

## [0.6.53] - 2025-05-07

### Changed

- Allocate Enzyme shadow memory during preparation ([#782])

[unreleased]: https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.6.53...main
[0.6.53]: https://github.com/JuliaDiff/DifferentiationInterface.jl/compare/DifferentiationInterface-v0.6.52...DifferentiationInterface-v0.6.53

[#788]: https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/788
[#782]: https://github.com/JuliaDiff/DifferentiationInterface.jl/pull/782
4 changes: 2 additions & 2 deletions DifferentiationInterface/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DifferentiationInterface"
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
authors = ["Guillaume Dalle", "Adrian Hill"]
version = "0.6.53"
version = "0.6.54"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -56,7 +56,7 @@ ADTypes = "1.13.0"
ChainRulesCore = "1.23.0"
DiffResults = "1.1.0"
Diffractor = "=0.2.6"
Enzyme = "0.13.17"
Enzyme = "0.13.39"
EnzymeCore = "0.8.8"
ExplicitImports = "1.10.1"
FastDifferentiation = "0.4.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ using EnzymeCore:
Split,
WithPrimal
using Enzyme:
Enzyme,
autodiff,
autodiff_thunk,
create_shadows,
Expand All @@ -53,4 +54,6 @@ include("forward_twoarg.jl")
include("reverse_onearg.jl")
include("reverse_twoarg.jl")

include("init.jl")

end # module
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function __init__()
# robust against internal changes
condition = (
isdefined(Enzyme, :Compiler) &&
Enzyme.Compiler isa Module &&
isdefined(Enzyme.Compiler, :EnzymeError) &&
Enzyme.Compiler.EnzymeError isa DataType
)
condition || return nothing
# see https://github.com/JuliaLang/julia/issues/58367 for why this isn't easier
for n in names(Enzyme.Compiler; all=true)
T = getfield(Enzyme.Compiler, n)
if T isa DataType && T <: Enzyme.Compiler.EnzymeError
# robust against internal changes
Base.Experimental.register_error_hint(T) do io, exc
if occursin("EnzymeMutabilityException", string(nameof(T)))
printstyled(
io,
"\nIf you are using Enzyme through DifferentiationInterface, you may want to try modifying the ADTypes backend object as follows:";
Comment thread
gdalle marked this conversation as resolved.
Outdated
bold=true,
)
printstyled(
io,
"\n\n\tAutoEnzyme(; function_annotation=Enzyme.Duplicated)\n\n";
color=:cyan,
bold=true,
)
elseif occursin("EnzymeRuntimeActivityError", string(nameof(T)))
printstyled(
io,
"\nIf you are using Enzyme through DifferentiationInterface, you may want to try modifying the ADTypes backend object as follows:";
bold=true,
)
printstyled(
io,
"\n\n\tAutoEnzyme(; mode=Enzyme.set_runtime_activity(Enzyme.Forward))\n\tAutoEnzyme(; mode=Enzyme.set_runtime_activity(Enzyme.Reverse))\n\n";
color=:cyan,
bold=true,
)
end
end
end
end
end