Skip to content

Commit bf4088f

Browse files
authored
Fix ABI mismatch (#2776)
* Fix ABI mismatch * fix
1 parent f7ec291 commit bf4088f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/api.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ EnzymeGradientUtilsSetReverseBlock(
884884
block,
885885
) = ccall(
886886
(:EnzymeGradientUtilsSetReverseBlock, libEnzyme),
887-
LLVM.API.LLVMBasicBlockRef,
887+
Cvoid,
888888
(
889889
EnzymeGradientUtilsRef,
890890
LLVM.API.LLVMBasicBlockRef,

src/gradientutils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function add_reverse_block!(gutils::GradientUtils, block::LLVM.BasicBlock, name:
9595
end
9696

9797
function set_reverse_block!(gutils::GradientUtils, block::LLVM.BasicBlock)
98-
return LLVM.BasicBlock(API.EnzymeGradientUtilsSetReverseBlock(gutils, block))
98+
return API.EnzymeGradientUtilsSetReverseBlock(gutils, block)
9999
end
100100

101101
function get_or_insert_conditional_execute!(fn::LLVM.Function; force_run=false, need_result=true, preprocess=nothing, postprocess=nothing, postprocess_const=nothing, cmpidx::Int = 1)
@@ -357,4 +357,4 @@ function batch_call_same_with_inverted_arg_if_active!(
357357
end
358358

359359
return shadow
360-
end
360+
end

src/rules/llvmrules.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,9 +1570,6 @@ end
15701570
offset = new_from_original(gutils, origops[2])
15711571
offset = lookup_value(gutils, offset, B)
15721572

1573-
currentBlock = Base.position(B)
1574-
ogname = LLVM.name(currentBlock)
1575-
15761573
fval = if get_runtime_activity(gutils)
15771574
lookup_value(gutils, new_from_original(gutils, origops[1]), B)
15781575
else
@@ -1593,6 +1590,9 @@ end
15931590
if get_runtime_activity(gutils) && endB === nothing
15941591
cond = icmp!(B, LLVM.API.LLVMIntNE, fval, args[1])
15951592

1593+
currentBlock = Base.position(B)
1594+
ogname = LLVM.name(currentBlock)
1595+
15961596
nextB = add_reverse_block!(gutils, currentBlock, ogname*"_active")
15971597

15981598
endB = add_reverse_block!(gutils, nextB, ogname*"_end", true, false)
@@ -1644,9 +1644,6 @@ end
16441644

16451645
i8 = LLVM.IntType(8)
16461646

1647-
currentBlock = Base.position(B)
1648-
ogname = LLVM.name(currentBlock)
1649-
16501647
fval = if get_runtime_activity(gutils)
16511648
lookup_value(gutils, new_from_original(gutils, origops[1]), B)
16521649
else
@@ -1664,6 +1661,9 @@ end
16641661

16651662
if get_runtime_activity(gutils)
16661663
cond = icmp!(B, LLVM.API.LLVMIntNE, fval, anti)
1664+
1665+
currentBlock = Base.position(B)
1666+
ogname = LLVM.name(currentBlock)
16671667

16681668
nextB = add_reverse_block!(gutils, currentBlock, ogname*"_active")
16691669

0 commit comments

Comments
 (0)