From 87ed2f23a326234f589ff512684533792f41f36f Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Mon, 24 Nov 2025 13:14:05 -0500 Subject: [PATCH] Return early (don't kernel launch) for copytrito and zero-sized arrays --- src/host/linalg.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/host/linalg.jl b/src/host/linalg.jl index 0cc40bf1..24106557 100644 --- a/src/host/linalg.jl +++ b/src/host/linalg.jl @@ -164,6 +164,7 @@ if isdefined(LinearAlgebra, :copytrito!) else (m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)")) end + length(A) == 0 && return B @kernel function U_kernel!(_A, _B) I = @index(Global, Cartesian) i, j = Tuple(I) @@ -178,6 +179,7 @@ if isdefined(LinearAlgebra, :copytrito!) else (m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)")) end + length(A) == 0 && return B @kernel function L_kernel!(_A, _B) I = @index(Global, Cartesian) i, j = Tuple(I)