Skip to content

Commit

Permalink
Don't export CPUStorage from MTL
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Jul 23, 2024
1 parent df4cf68 commit e9c59e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion docs/src/api/array.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ The Metal API has various storage modes that dictate how a resource can be acces
Metal.PrivateStorage
Metal.SharedStorage
Metal.ManagedStorage
Metal.CPUStorage
```

There also exist the following convenience functions to check if an MtlArray is using a specific storage mode:
Expand Down
13 changes: 7 additions & 6 deletions lib/mtl/storage_type.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export SharedStorage, ManagedStorage, PrivateStorage, CPUStorage
export SharedStorage, ManagedStorage, PrivateStorage
export ReadUsage, WriteUsage, ReadWriteUsage

# Metal Has 4 storage types
Expand All @@ -18,7 +18,7 @@ For more information on Metal storage modes, refer to the official Metal documen
See also [`Metal.PrivateStorage`](@ref) and [`Metal.ManagedStorage`](@ref).
"""
struct SharedStorage <: StorageMode end
struct SharedStorage <: StorageMode end

"""
struct Metal.ManagedStorage <: MTL.StorageMode
Expand All @@ -29,7 +29,7 @@ For more information on Metal storage modes, refer to the official Metal documen
See also [`Metal.SharedStorage`](@ref) and [`Metal.PrivateStorage`](@ref).
"""
struct ManagedStorage <: StorageMode end
struct ManagedStorage <: StorageMode end

"""
struct Metal.PrivateStorage <: MTL.StorageMode
Expand All @@ -40,22 +40,23 @@ For more information on Metal storage modes, refer to the official Metal documen
See also [`Metal.SharedStorage`](@ref) and [`Metal.ManagedStorage`](@ref).
"""
struct PrivateStorage <: StorageMode end
struct Memoryless <: StorageMode end
struct PrivateStorage <: StorageMode end
struct Memoryless <: StorageMode end

# Remove the ".MTL" when printing
Base.show(io::IO, ::Type{<:PrivateStorage}) = print(io, "Metal.PrivateStorage")
Base.show(io::IO, ::Type{<:SharedStorage}) = print(io, "Metal.SharedStorage")
Base.show(io::IO, ::Type{<:ManagedStorage}) = print(io, "Metal.ManagedStorage")

"""
CPUStorage
MTL.CPUStorage
Union type of [`Metal.SharedStorage`](@ref) and [`Metal.ManagedStorage`](@ref) storage modes.
Represents storage modes where the resource is accessible via the CPU.
"""
const CPUStorage = Union{SharedStorage,ManagedStorage}

Base.convert(::Type{MTLStorageMode}, ::Type{SharedStorage}) = MTLStorageModeShared
Base.convert(::Type{MTLStorageMode}, ::Type{ManagedStorage}) = MTLStorageModeManaged
Base.convert(::Type{MTLStorageMode}, ::Type{PrivateStorage}) = MTLStorageModePrivate
Expand Down

0 comments on commit e9c59e2

Please sign in to comment.