You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/errors.jl
+46-8Lines changed: 46 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,24 @@
1
1
const VERBOSE_ERRORS =Ref(false)
2
2
3
-
abstract type CompilationException <:Base.Exceptionend
3
+
"""
4
+
EnzymeError
4
5
5
-
struct EnzymeRuntimeException <:Base.Exception
6
+
Common supertype for Enzyme-specific errors.
7
+
8
+
This type is made public so that downstream packages can add custom [error hints](https://docs.julialang.org/en/v1/base/base/#Base.Experimental.register_error_hint) for the most common exceptions thrown by Enzyme.
9
+
"""
10
+
abstract type EnzymeError <:Base.Exceptionend
11
+
12
+
abstract type CompilationException <:EnzymeErrorend
13
+
14
+
struct EnzymeRuntimeException <:EnzymeError
6
15
msg::Cstring
7
16
end
8
17
9
18
function Base.showerror(io::IO, ece::EnzymeRuntimeException)
function Base.showerror(io::IO, ece::IllegalTypeAnalysisException)
69
+
ifisdefined(Base.Experimental, :show_error_hints)
70
+
Base.Experimental.show_error_hints(io, ece)
71
+
end
54
72
print(io, "Enzyme compilation failed due to illegal type analysis.\n")
55
73
print(io, " This usually indicates the use of a Union type, which is not fully supported with Enzyme.API.strictAliasing set to true [the default].\n")
56
74
print(io, " Ideally, remove the union (which will also make your code faster), or try setting Enzyme.API.strictAliasing!(false) before any autodiff call.\n")
0 commit comments