Skip to content

Commit 187eb95

Browse files
committed
Disable inplace accumulation for Symmertic/Hermitian because JuliaLang/julia#38056
1 parent 791f25d commit 187eb95

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/accumulation.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ function is_inplaceable_destination(x::AbstractArray)
5656
return is_inplaceable_destination(p)
5757
end
5858

59+
# Hermitian and Symmetric are too fussy to deal with right now
60+
# https://github.com/JuliaLang/julia/issues/38056
61+
# TODO: https://github.com/JuliaDiff/ChainRulesCore.jl/issues/236
62+
is_inplaceable_destination(::LinearAlgebra.Hermitian) = false
63+
is_inplaceable_destination(::LinearAlgebra.Symmetric) = false
64+
65+
5966
function debug_add!(accumuland, t::InplaceableThunk)
6067
returned_value = t.add!(accumuland)
6168
if returned_value !== accumuland

test/accumulation.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
@test is_inplaceable_destination(view([1, 2, 3, 4], :, :))
1212
@test !is_inplaceable_destination(view(1:4, :, :))
1313

14-
@test !is_inplaceable_destination(1.3)
1514
@test is_inplaceable_destination(falses(4))
1615
@test is_inplaceable_destination(spzeros(4))
1716
@test is_inplaceable_destination(spzeros(2, 2))
17+
18+
@test !is_inplaceable_destination(1.3)
1819
@test !is_inplaceable_destination(@SVector [1, 2, 3])
20+
@test !is_inplaceable_destination(Hermitian([1 2; 2 4]))
21+
@test !is_inplaceable_destination(Symmetric([1 2; 2 4]))
1922
end
2023

2124
@testset "add!!" begin

0 commit comments

Comments
 (0)