Skip to content

Commit

Permalink
Skip uniqueness check
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Feb 22, 2022
1 parent 40517a6 commit 3b85689
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/lib/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,9 @@ end

∇getindex(x::CUDA.CuArray, inds::Tuple{AbstractArray{<:Integer}}) = dy -> begin
inds1_cpu = Array(inds[1])
if allunique(inds1_cpu)
dx = _zero(x, eltype(dy))
dxv = view(dx, inds[1])
dxv .= accum.(dxv, _droplike(dy, dxv))
return _project(x, dx), nothing
else
dx = zeros(eltype(dy), length(x))
dxv = view(dx, inds1_cpu)
dxv .= accum.(dxv, _droplike(Array(dy), dxv))
return _project(x, CUDA.CuArray(dx)), nothing
end
dx = zeros(eltype(dy), length(x))
dxv = view(dx, inds1_cpu)
dxv .= accum.(dxv, _droplike(Array(dy), dxv))
return _project(x, CUDA.CuArray(dx)), nothing
end
end

0 comments on commit 3b85689

Please sign in to comment.