Skip to content

Commit 34767a3

Browse files
authored
Merge pull request #2632 from JuliaGPU/tb/fixes
NFC fixes
2 parents b2ee7e7 + 7db9e3c commit 34767a3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/array.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ function Base.fill!(A::DenseCuArray{T}, x) where T <: MemsetCompatTypes
780780
U = memsettype(T)
781781
y = reinterpret(U, convert(T, x))
782782
context!(context(A)) do
783-
memset(convert(CuPtr{U}, pointer(A)), y, length(A))
783+
GC.@preserve A memset(convert(CuPtr{U}, pointer(A)), y, length(A))
784784
end
785785
A
786786
end
@@ -823,6 +823,8 @@ the first `n` elements will be retained. If `n` is larger, the new elements are
823823
guaranteed to be initialized.
824824
"""
825825
function Base.resize!(A::CuVector{T}, n::Integer) where T
826+
n == length(A) && return A
827+
826828
# TODO: add additional space to allow for quicker resizing
827829
maxsize = n * sizeof(T)
828830
bufsize = if isbitstype(T)
@@ -839,8 +841,7 @@ function Base.resize!(A::CuVector{T}, n::Integer) where T
839841
ptr = convert(CuPtr{T}, mem)
840842
m = min(length(A), n)
841843
if m > 0
842-
synchronize(A)
843-
unsafe_copyto!(ptr, pointer(A), m)
844+
GC.@preserve A unsafe_copyto!(ptr, pointer(A), m)
844845
end
845846
DataRef(pool_free, mem)
846847
end

src/profile.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ function nsight()
203203
end
204204

205205

206+
206207
"""
207208
start()
208209

0 commit comments

Comments
 (0)