Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ oneAPI_Support_jll = "b049733a-a71d-5ed3-8eba-7d323ac00b36"
Adapt = "4"
CEnum = "0.4, 0.5"
ExprTools = "0.1"
GPUArrays = "11.1"
GPUArrays = "11.2.1"
GPUCompiler = "0.23, 0.24, 0.25, 0.26, 0.27, 1"
KernelAbstractions = "0.9.1"
LLVM = "6, 7, 8, 9"
Expand Down
12 changes: 8 additions & 4 deletions src/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ mutable struct oneArray{T,N,B} <: AbstractGPUArray{T,N}

ctx = context()
dev = device()
buf = allocate(B, ctx, dev, bufsize, Base.datatype_alignment(T))
data = DataRef(buf) do buf
release(buf)
alignment = Base.datatype_alignment(T)
data = GPUArrays.cached_alloc((oneArray, B, ctx, dev, bufsize, alignment)) do
buf = allocate(B, ctx, dev, bufsize, alignment)
data = DataRef(buf) do buf
release(buf)
end
end
obj = new{T,N,B}(data, maxsize, 0, dims)
Comment on lines +63 to 70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alignment = Base.datatype_alignment(T)
data = GPUArrays.cached_alloc((oneArray, B, ctx, dev, bufsize, alignment)) do
buf = allocate(B, ctx, dev, bufsize, alignment)
data = DataRef(buf) do buf
release(buf)
end
end
obj = new{T,N,B}(data, maxsize, 0, dims)
alignment = Base.datatype_alignment(T)
data = GPUArrays.cached_alloc((oneArray, B, ctx, dev, bufsize, alignment)) do
buf = allocate(B, ctx, dev, bufsize, alignment)
data = DataRef(buf) do buf
release(buf)
end
return finalizer(unsafe_free!, obj)
return arr

finalizer(unsafe_free!, obj)
return finalizer(unsafe_free!, obj)
return arr
end

function oneArray{T,N}(data::DataRef{B}, dims::Dims{N};
Expand Down
Loading