Skip to content

Commit f22c9b4

Browse files
simenhuwsmoses
andauthored
Update EnzymeCoreExt.jl (#2565)
The inactive_noinl failed in broadcast assignment when using Enzyme=0.13.16 and CUDA=5.5.2. Switching to the version that prevents inlining seem to have fixed it. Co-authored-by: William Moses <gh@wsmoses.com>
1 parent 05736a7 commit f22c9b4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ext/EnzymeCoreExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ end
2525
function EnzymeCore.EnzymeRules.inactive_noinl(::typeof(CUDA.is_pinned), args...)
2626
return nothing
2727
end
28-
function EnzymeCore.EnzymeRules.inactive_noinl(::typeof(CUDA.launch_configuration), args...; kwargs...)
28+
function EnzymeCore.EnzymeRules.inactive(::typeof(CUDA.launch_configuration), args...; kwargs...)
2929
return nothing
3030
end
3131

test/extensions/enzyme.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ end
145145
@test all(dx .≈ 1)
146146
@test all(dy .≈ 1)
147147
end
148+
149+
sumabs2(x) = sum(abs2.(x))
150+
151+
@testset "Reverse sum abs2" begin
152+
x = CuArray([1.0, 2.0, 3.0, 4.0])
153+
dx = CuArray([0., 0.0, 0.0, 0.0])
154+
Enzyme.autodiff(Reverse, sumabs2, Active, Duplicated(x, dx))
155+
@test all(dx .≈ 2 .* x)
156+
end
157+
148158
# TODO once reverse kernels are in
149159
# function togpu(x)
150160
# x = CuArray(x)

0 commit comments

Comments
 (0)