Skip to content

Commit 26237ff

Browse files
authored
Move bcast check earlier (#689)
1 parent 7b3bd07 commit 26237ff

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/host/broadcast.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ end
4747
@inline function _copyto!(dest::AbstractArray, bc::Broadcasted)
4848
axes(dest) == axes(bc) || Broadcast.throwdm(axes(dest), axes(bc))
4949
isempty(dest) && return dest
50+
if eltype(dest) <: BrokenBroadcast
51+
throw(ArgumentError("Broadcast operation resulting in $(eltype(eltype(dest))) is not GPU compatible"))
52+
end
5053
bc = Broadcast.preprocess(dest, bc)
5154

5255
@kernel function broadcast_kernel_linear(dest, bc)
@@ -69,10 +72,6 @@ end
6972

7073
# ndims check for 0D support
7174
broadcast_kernel(dest, bc; ndrange = ndims(dest) > 0 ? size(dest) : (1,))
72-
if eltype(dest) <: BrokenBroadcast
73-
throw(ArgumentError("Broadcast operation resulting in $(eltype(eltype(dest))) is not GPU compatible"))
74-
end
75-
7675
return dest
7776
end
7877

0 commit comments

Comments
 (0)