Skip to content

Commit 6d29674

Browse files
committed
Fix type inference in bumper eval
1 parent 38ec76f commit 6d29674

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ext/DynamicExpressionsBumperExt.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ function bumper_eval_tree_array(
1111
) where {T}
1212
result = similar(cX, axes(cX, 2))
1313
n = size(cX, 2)
14-
ok = @no_escape begin
14+
all_ok = Ref(false)
15+
@no_escape begin
1516
_result_ok = tree_mapreduce(
1617
# Leaf nodes, we create an allocation and fill
1718
# it with the value of the leaf:
@@ -37,9 +38,9 @@ function bumper_eval_tree_array(
3738
)
3839
x = _result_ok.x
3940
result .= x
40-
_result_ok.ok
41+
all_ok[] = _result_ok.ok
4142
end
42-
return (result, ok)
43+
return (result, all_ok[])
4344
end
4445

4546
function dispatch_kerns!(operators, branch_node, cumulator)

test/test_evaluation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ for turbo in [Val(false), Val(true)],
6868
true_y = realfnc.(X[1, :], X[2, :], X[3, :])
6969
!all(isfinite.(true_y)) && continue
7070

71-
@inferred eval_tree_array(tree, X, operators; turbo=turbo, bumper=Val(bumper))
71+
@inferred eval_tree_array(tree, X, operators; turbo, bumper)
7272

73-
test_y = eval_tree_array(tree, X, operators; turbo=turbo, bumper=Val(bumper))[1]
73+
test_y = eval_tree_array(tree, X, operators; turbo, bumper)[1]
7474

7575
zero_tolerance = (T <: Union{Float16,Complex} ? 1e-4 : 1e-6)
7676
@test all(abs.(test_y .- true_y) / N .< zero_tolerance)
7777

78-
test_y_helper = tree(X, operators; turbo=turbo, bumper=Val(bumper))
78+
test_y_helper = tree(X, operators; turbo, bumper)
7979
@test all(test_y .== test_y_helper)
8080
end
8181
end

0 commit comments

Comments
 (0)