3939
4040`N`-dimensional Metal array with storage mode `S` and elements of type `T`.
4141
42- `S` can be `Metal.PrivateStorage` (default), `Metal.SharedStorage`, or `Metal.ManagedStorage` .
42+ `S` can be `Metal.PrivateStorage` (default), `Metal.SharedStorage`.
4343
4444See the Array Programming section of the Metal.jl docs for more details.
4545"""
@@ -96,6 +96,7 @@ mutable struct MtlArray{T,N,S} <: AbstractGPUArray{T,N}
9696 obj = if storagemode == MTL. MTLStorageModeShared
9797 new {T,N,SharedStorage} (copy (data), maxsize, offset, dims)
9898 elseif storagemode == MTL. MTLStorageModeManaged
99+ @warn " `ManagedStorage` is no longer supported with `MtlArray`s. Instead, use `SharedStorage` or use the Metal api directly from `Metal.MTL`."
99100 new {T,N,ManagedStorage} (copy (data), maxsize, offset, dims)
100101 elseif storagemode == MTL. MTLStorageModePrivate
101102 new {T,N,PrivateStorage} (copy (data), maxsize, offset, dims)
@@ -140,6 +141,9 @@ is_shared(A::MtlArray) = storagemode(A) == SharedStorage
140141
141142Returns true if `A` has storage mode [`Metal.ManagedStorage`](@ref).
142143
144+ !!! warning
145+ `ManagedStorage` is no longer supported with `MtlArray`s. Instead, use `SharedStorage` or use the Metal api directly from `Metal.MTL`.
146+
143147See also [`is_shared`](@ref) and [`is_private`](@ref).
144148"""
145149is_managed (A:: MtlArray ) = storagemode (A) == ManagedStorage
@@ -149,7 +153,7 @@ is_managed(A::MtlArray) = storagemode(A) == ManagedStorage
149153
150154Returns true if `A` has storage mode [`Metal.PrivateStorage`](@ref).
151155
152- See also [`is_shared`](@ref) and [`is_managed`](@ref) .
156+ See also [`is_shared`](@ref).
153157"""
154158is_private (A:: MtlArray ) = storagemode (A) == PrivateStorage
155159
@@ -192,8 +196,6 @@ const DefaultStorageMode = let str = @load_preference("default_storage", "privat
192196 PrivateStorage
193197 elseif str == " shared"
194198 SharedStorage
195- elseif str == " managed"
196- ManagedStorage
197199 else
198200 error (" unknown default storage mode: $default_storage " )
199201 end
@@ -247,7 +249,7 @@ Base.sizeof(x::MtlArray) = Base.elsize(x) * length(x)
247249@inline function Base. pointer (x:: MtlArray{T} , i:: Integer = 1 ; storage= PrivateStorage) where {T}
248250 PT = if storage == PrivateStorage
249251 MtlPtr{T}
250- elseif storage == SharedStorage || storage == ManagedStorage
252+ elseif storage == SharedStorage
251253 Ptr{T}
252254 else
253255 error (" unknown memory type" )
@@ -272,12 +274,12 @@ end
272274
273275
274276# # indexing
275- function Base. getindex (x:: MtlArray{T,N,S} , I:: Int ) where {T,N,S<: Union{ SharedStorage,ManagedStorage} }
277+ function Base. getindex (x:: MtlArray{T,N,S} , I:: Int ) where {T,N,S<: SharedStorage }
276278 @boundscheck checkbounds (x, I)
277279 unsafe_load (pointer (x, I; storage= S))
278280end
279281
280- function Base. setindex! (x:: MtlArray{T,N,S} , v, I:: Int ) where {T,N,S<: Union{ SharedStorage,ManagedStorage} }
282+ function Base. setindex! (x:: MtlArray{T,N,S} , v, I:: Int ) where {T,N,S<: SharedStorage }
281283 @boundscheck checkbounds (x, I)
282284 unsafe_store! (pointer (x, I; storage= S), v)
283285end
@@ -481,7 +483,7 @@ Adapt.adapt_storage(::MtlArrayAdaptor{S}, xs::AbstractArray{T,N}) where {T<:Comp
481483"""
482484 mtl(A; storage=Metal.PrivateStorage)
483485
484- `storage` can be `Metal.PrivateStorage` (default), `Metal.SharedStorage`, or `Metal.ManagedStorage `.
486+ `storage` can be `Metal.PrivateStorage` (default) or `Metal.SharedStorage `.
485487
486488Opinionated GPU array adaptor, which may alter the element type `T` of arrays:
487489* For `T<:AbstractFloat`, it makes a `MtlArray{Float32}` for performance and compatibility
0 commit comments