Skip to content

Commit 517c254

Browse files
authored
Adapt to GPUArrays.jl changes. (#487)
1 parent 74fb416 commit 517c254

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ oneAPI_Support_jll = "b049733a-a71d-5ed3-8eba-7d323ac00b36"
3131
Adapt = "4"
3232
CEnum = "0.4, 0.5"
3333
ExprTools = "0.1"
34-
GPUArrays = "11.1"
34+
GPUArrays = "11.2.1"
3535
GPUCompiler = "0.23, 0.24, 0.25, 0.26, 0.27, 1"
3636
KernelAbstractions = "0.9.1"
3737
LLVM = "6, 7, 8, 9"

src/array.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,16 @@ mutable struct oneArray{T,N,B} <: AbstractGPUArray{T,N}
6060

6161
ctx = context()
6262
dev = device()
63-
buf = allocate(B, ctx, dev, bufsize, Base.datatype_alignment(T))
64-
data = DataRef(buf) do buf
65-
release(buf)
63+
alignment = Base.datatype_alignment(T)
64+
data = GPUArrays.cached_alloc((oneArray, B, ctx, dev, bufsize, alignment)) do
65+
buf = allocate(B, ctx, dev, bufsize, alignment)
66+
data = DataRef(buf) do buf
67+
release(buf)
68+
end
6669
end
6770
obj = new{T,N,B}(data, maxsize, 0, dims)
68-
finalizer(unsafe_free!, obj)
71+
return finalizer(unsafe_free!, obj)
72+
return arr
6973
end
7074

7175
function oneArray{T,N}(data::DataRef{B}, dims::Dims{N};

0 commit comments

Comments
 (0)