Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored and michel2323 committed May 22, 2024
1 parent 8021b47 commit a64daca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rules/customrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function enzyme_custom_setup_ret(gutils::GradientUtils, orig::LLVM.CallInst, mi,
# is used as part of differential use analysis, we need to avoid an ininite recursion. Thus use
# the version without differential use if actual unreachable results are not available anyways.
uncacheable = Vector{UInt8}(undef, length(collect(LLVM.operands(orig)))-1)
activep = if API.EnzymeGradientUtilsGetUncacheableArgs(gutils, orig, uncacheable, length(uncacheable)) == 1
activep = if mode == API.DEM_ForwardMode || API.EnzymeGradientUtilsGetUncacheableArgs(gutils, orig, uncacheable, length(uncacheable)) == 1
API.EnzymeGradientUtilsGetReturnDiffeType(gutils, orig, needsPrimalP, needsShadowP, mode)
else
actv = API.EnzymeGradientUtilsGetDiffeType(gutils, orig, false)
Expand Down
4 changes: 2 additions & 2 deletions test/rrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ function reverse(config::ConfigWidth{1}, ::Const{typeof(f)}, dret::Active, tape,
end
end

function augmented_primal(::ConfigWidth{1}, func::Const{typeof(f_ip)}, ::Type{<:Const}, x::Duplicated)
function augmented_primal(::Config{false, false, 1}, func::Const{typeof(f_ip)}, ::Type{<:Const}, x::Duplicated)
v = x.val[1]
x.val[1] *= v
return AugmentedReturn(nothing, nothing, v)
end

function reverse(::ConfigWidth{1}, ::Const{typeof(f_ip)}, ::Type{<:Const}, tape, x::Duplicated)
function reverse(::Config{false, false, 1}, ::Const{typeof(f_ip)}, ::Type{<:Const}, tape, x::Duplicated)
x.dval[1] = 100 + x.dval[1] * tape
return (nothing,)
end
Expand Down

0 comments on commit a64daca

Please sign in to comment.