Skip to content

Commit d606fee

Browse files
Remove obsolete MtlLargerDeviceArray (#574)
1 parent 8d4dd5d commit d606fee

File tree

2 files changed

+2
-54
lines changed

2 files changed

+2
-54
lines changed

src/device/intrinsics/memory.jl

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -48,55 +48,3 @@ end
4848
call_function(llvm_f, Core.LLVMPtr{T,AS.ThreadGroup})
4949
end
5050
end
51-
52-
53-
## device array wrapper extending small element types
54-
55-
struct MtlLargerDeviceArray{T,N,A} <: DenseArray{T,N}
56-
x::MtlDeviceArray{UInt32,N,A}
57-
end
58-
59-
Base.elsize(::Type{<:MtlLargerDeviceArray{T}}) where {T} = sizeof(UInt32)
60-
61-
Base.size(g::MtlLargerDeviceArray) = size(g.x)
62-
Base.sizeof(x::MtlLargerDeviceArray) = Base.elsize(x) * length(x)
63-
64-
Base.pointer(x::MtlLargerDeviceArray{T,<:Any,A}) where {T,A} =
65-
Base.unsafe_convert(Core.LLVMPtr{T,A}, x)
66-
@inline function Base.pointer(x::MtlLargerDeviceArray{T,<:Any,A}, i::Integer) where {T,A}
67-
Base.unsafe_convert(Core.LLVMPtr{T,A}, x) + Base._memory_offset(x, i)
68-
end
69-
70-
Base.unsafe_convert(::Type{Core.LLVMPtr{T,A}}, x::MtlLargerDeviceArray{T,<:Any,A}) where {T,A} =
71-
reinterpret(Core.LLVMPtr{T,A}, Base.unsafe_convert(Core.LLVMPtr{UInt32,A}, x.x))
72-
73-
Base.@propagate_inbounds Base.getindex(A::MtlLargerDeviceArray{T}, i1::Integer) where {T} =
74-
arrayref(A, i1)
75-
Base.@propagate_inbounds Base.setindex!(A::MtlLargerDeviceArray{T}, x, i1::Integer) where {T} =
76-
arrayset(A, convert(T, x)::T, i1)
77-
78-
# preserve the specific integer type when indexing device arrays,
79-
# to avoid extending 32-bit hardware indices to 64-bit.
80-
Base.to_index(::MtlLargerDeviceArray, i::Integer) = i
81-
82-
# Base doesn't like Integer indices, so we need our own ND get and setindex! routines.
83-
# See also: https://github.com/JuliaLang/julia/pull/42289
84-
Base.@propagate_inbounds Base.getindex(A::MtlLargerDeviceArray,
85-
I::Union{Integer, CartesianIndex}...) =
86-
A[Base._to_linear_index(A, to_indices(A, I)...)]
87-
Base.@propagate_inbounds Base.setindex!(A::MtlLargerDeviceArray, x,
88-
I::Union{Integer, CartesianIndex}...) =
89-
A[Base._to_linear_index(A, to_indices(A, I)...)] = x
90-
91-
@inline function arrayref(A::MtlLargerDeviceArray{T}, index::Integer) where {T}
92-
@boundscheck checkbounds(A, index)
93-
align = Base.datatype_alignment(T)
94-
unsafe_load(pointer(A), index, Val(align))
95-
end
96-
97-
@inline function arrayset(A::MtlLargerDeviceArray{T}, x::T, index::Integer) where {T}
98-
@boundscheck checkbounds(A, index)
99-
align = Base.datatype_alignment(T)
100-
unsafe_store!(pointer(A), x, index, Val(align))
101-
return A
102-
end

src/device/intrinsics/simd.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for (jltype, suffix) in ((:Float16, "f16"), (:Float32, "f32"))
1111
for as in (AS.Device, AS.ThreadGroup)
1212
@eval begin
1313
@device_function simdgroup_load(
14-
data::Union{MtlDeviceArray{$jltype, <:Any, $as}, MtlLargerDeviceArray{$jltype, <:Any, $as}},
14+
data::MtlDeviceArray{$jltype, <:Any, $as},
1515
matrix_origin::NTuple{2, Int64} = (1, 1),
1616
) = @typed_ccall($"air.simdgroup_matrix_8x8_load.v64$suffix.p$as$suffix",
1717
llvmcall, NTuple{64, VecElement{$jltype}},
@@ -20,7 +20,7 @@ for (jltype, suffix) in ((:Float16, "f16"), (:Float32, "f32"))
2020

2121
@device_function simdgroup_store(
2222
src::NTuple{64, VecElement{$jltype}},
23-
dest::Union{MtlDeviceArray{$jltype, <:Any, $as}, MtlLargerDeviceArray{$jltype, <:Any, $as}},
23+
dest::MtlDeviceArray{$jltype, <:Any, $as},
2424
matrix_origin::NTuple{2, Int64} = (1, 1),
2525
) = @typed_ccall($"air.simdgroup_matrix_8x8_store.v64$suffix.p$as$suffix",
2626
llvmcall, Cvoid,

0 commit comments

Comments
 (0)