Skip to content

Commit 8c5419b

Browse files
authored
Return early (don't kernel launch) for copytrito and zero-sized arrays (#660)
1 parent a797b42 commit 8c5419b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/host/linalg.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ if isdefined(LinearAlgebra, :copytrito!)
164164
else
165165
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
166166
end
167+
length(A) == 0 && return B
167168
@kernel function U_kernel!(_A, _B)
168169
I = @index(Global, Cartesian)
169170
i, j = Tuple(I)
@@ -178,6 +179,7 @@ if isdefined(LinearAlgebra, :copytrito!)
178179
else
179180
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
180181
end
182+
length(A) == 0 && return B
181183
@kernel function L_kernel!(_A, _B)
182184
I = @index(Global, Cartesian)
183185
i, j = Tuple(I)

0 commit comments

Comments
 (0)