Skip to content

Commit

Permalink
Wrap gradient utils in julia_error (#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jul 7, 2023
1 parent cac60b1 commit 07ca881
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5647,7 +5647,7 @@ function julia_error(cstr::Cstring, val::LLVM.API.LLVMValueRef, errtype::API.Err
if errtype == API.ET_NoDerivative
exc = NoDerivativeException(msg, ir, bt)
if data != C_NULL
gutils = API.EnzymeGradientUtilsRef(data)
gutils = GradientUtils(API.EnzymeGradientUtilsRef(data))
newb = new_from_original(gutils, val)
while isa(newb, LLVM.PHIInst)
newb = LLVM.Instruction(LLVM.API.LLVMGetNextInstruction(newb))
Expand All @@ -5663,7 +5663,7 @@ function julia_error(cstr::Cstring, val::LLVM.API.LLVMValueRef, errtype::API.Err
end
throw(exc)
elseif errtype == API.ET_NoShadow
data = API.EnzymeGradientUtilsRef(data)
data = GradientUtils(API.EnzymeGradientUtilsRef(data))
ip = API.EnzymeGradientUtilsInvertedPointersToString(data)
sval = Base.unsafe_string(ip)
API.EnzymeStringFree(ip)
Expand Down

0 comments on commit 07ca881

Please sign in to comment.