Skip to content

Commit

Permalink
Skip uniqueness check
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreener64 committed Aug 3, 2022
1 parent c951b0a commit 67069cb
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 @@ -288,16 +288,9 @@ using GPUArraysCore # replaces @require CUDA block, weird indenting to preserve

∇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 67069cb

Please sign in to comment.