Skip to content

Commit 0573c62

Browse files
authored
Add batched writebarrier test (#2394)
* Add batched writebarrier test * Update abi.jl
1 parent 19c0e28 commit 0573c62

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/abi.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,3 +623,17 @@ end
623623
@test batched_result[1][1] 1.0
624624
@test batched_result[2][1] 2.0
625625
end
626+
627+
function f_wb!(c)
628+
@inbounds c.a[1] = @inbounds c.b[1] .+ 1
629+
return nothing
630+
end
631+
632+
@testset "Batched Writebarrier" begin
633+
c = (; a=[ones(4)], b=[3.1*ones(4)])
634+
dc = ntuple(_ -> make_zero(c), Val(2))
635+
636+
autodiff(
637+
Forward, f_wb!, BatchDuplicated(c, dc)
638+
)
639+
end

0 commit comments

Comments
 (0)