Skip to content

Commit 25f605b

Browse files
committed
better error for unsupported array types
1 parent 2341a8b commit 25f605b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/broadcast.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,15 @@ function Base.foreach(func, over::GPUArray, Bs...)
104104
end
105105

106106

107-
arg_length(x::Array) = error("No array in GPU Broadcast supported. Try converting it to a gpu array")
107+
function arg_length(x::AbstractArray)
108+
if !isbits(x)
109+
error("Non isbits Arrays in GPU Broadcast not supported (So arrays that don't contain pointers to memory are, e.g. UnitRanges). Try converting it to a gpu array. Found: $(typeof(x))")
110+
end
111+
UInt32.(size(x))
112+
end
108113
arg_length(x::Tuple) = (UInt32(length(x)),)
109114
arg_length(x::GPUArray) = UInt32.(size(x))
110-
arg_length(x) = ()
115+
arg_length(x) = () # Scalar
111116

112117
abstract type BroadcastDescriptor{Typ} end
113118

0 commit comments

Comments
 (0)