Skip to content

Commit

Permalink
Fix custom rule with batch fwd pointer (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored and michel2323 committed Nov 7, 2023
1 parent 06b8dd7 commit 214010d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4642,7 +4642,14 @@ function enzyme_custom_common_rev(forward::Bool, B, orig::LLVM.CallInst, gutils,
shadowV = extract_value!(B, res, idx)
if get_return_info(RealRt)[2] !== nothing
dval = invert_pointer(gutils, operands(orig)[1], B)
store!(B, shadowV, dval)

for idx in 1:width
to_store = (width == 1) ? shadowV : extract_value!(B, shadowV, idx-1)

store_ptr = (width == 1) ? dval : extract_value!(B, dval, idx-1)

store!(B, to_store, store_ptr)
end
shadowV = C_NULL
else
@assert value_type(shadowV) == shadowType
Expand Down

0 comments on commit 214010d

Please sign in to comment.