Skip to content

Commit d730b10

Browse files
IanButterworthmaleadt
authored andcommitted
Override deepcopy, not deepcopy_internal, to avoid invalidations.
Closes #632.
1 parent 6933cd8 commit d730b10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/array.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ function Base.unsafe_copyto!(dest::DenseCuArray{T}, doffs, src::DenseCuArray{T},
408408
return dest
409409
end
410410

411-
function Base.deepcopy_internal(x::CuArray, dict::IdDict)
411+
# XXX: defining deepcopy_internal, as per the deepcopy documentation, results in a ton
412+
# of invalidations, so we redefine deepcopy itself (see JuliaGPU/CUDA.jl#632)
413+
function Base.deepcopy(x::CuArray)
414+
dict = IdDict()
412415
haskey(dict, x) && return dict[x]::typeof(x)
413416
return dict[x] = copy(x)
414417
end

0 commit comments

Comments
 (0)