|
711 | 711 | @test LoopVectorization.choose_order(lsAtmulBt8) == ([:n, :m, :k], :m, :n, :m, 1, 4)
|
712 | 712 | end
|
713 | 713 |
|
714 |
| - struct SizedMatrix{M,N,T} <: DenseMatrix{T} |
| 714 | + struct TestSizedMatrix{M,N,T} <: DenseMatrix{T} |
715 | 715 | data::Matrix{T}
|
716 |
| - function SizedMatrix{M,N}(data::Matrix{T}) where {M,N,T} |
| 716 | + function TestSizedMatrix{M,N}(data::Matrix{T}) where {M,N,T} |
717 | 717 | @assert (M, N) === size(data)
|
718 | 718 | new{M,N,T}(data)
|
719 | 719 | end
|
720 | 720 | end
|
721 |
| - Base.parent(A::SizedMatrix) = A.data |
722 |
| - Base.IndexStyle(::Type{<:SizedMatrix}) = Base.IndexLinear() |
723 |
| - Base.@propagate_inbounds Base.getindex(A::SizedMatrix, i::Int) = getindex(parent(A), i) |
724 |
| - Base.@propagate_inbounds Base.setindex!(A::SizedMatrix, v, i::Int) = |
| 721 | + Base.parent(A::TestSizedMatrix) = A.data |
| 722 | + Base.IndexStyle(::Type{<:TestSizedMatrix}) = Base.IndexLinear() |
| 723 | + Base.@propagate_inbounds Base.getindex(A::TestSizedMatrix, i::Int) = getindex(parent(A), i) |
| 724 | + Base.@propagate_inbounds Base.setindex!(A::TestSizedMatrix, v, i::Int) = |
725 | 725 | setindex!(parent(A), v, i)
|
726 |
| - Base.@propagate_inbounds Base.getindex(A::SizedMatrix, i::CartesianIndex) = |
| 726 | + Base.@propagate_inbounds Base.getindex(A::TestSizedMatrix, i::CartesianIndex) = |
727 | 727 | getindex(parent(A), i + oneunit(i))
|
728 |
| - Base.@propagate_inbounds Base.setindex!(A::SizedMatrix, v, i::CartesianIndex) = |
| 728 | + Base.@propagate_inbounds Base.setindex!(A::TestSizedMatrix, v, i::CartesianIndex) = |
729 | 729 | setindex!(parent(A), v, i + oneunit(i))
|
730 |
| - Base.@propagate_inbounds Base.getindex(A::SizedMatrix, i::Int, j::Int) = |
| 730 | + Base.@propagate_inbounds Base.getindex(A::TestSizedMatrix, i::Int, j::Int) = |
731 | 731 | getindex(parent(A), i + 1, j + 1)
|
732 |
| - Base.@propagate_inbounds Base.setindex!(A::SizedMatrix, v, i::Int, j::Int) = |
| 732 | + Base.@propagate_inbounds Base.setindex!(A::TestSizedMatrix, v, i::Int, j::Int) = |
733 | 733 | setindex!(parent(A), v, i + 1, j + 1)
|
734 |
| - Base.size(::SizedMatrix{M,N}) where {M,N} = (M, N) |
735 |
| - LoopVectorization.ArrayInterface.size(::SizedMatrix{M,N}) where {M,N} = |
| 734 | + Base.size(::TestSizedMatrix{M,N}) where {M,N} = (M, N) |
| 735 | + LoopVectorization.ArrayInterface.size(::TestSizedMatrix{M,N}) where {M,N} = |
736 | 736 | (LoopVectorization.StaticInt{M}(), LoopVectorization.StaticInt{N}())
|
737 |
| - function Base.axes(::SizedMatrix{M,N}) where {M,N} |
| 737 | + function Base.axes(::TestSizedMatrix{M,N}) where {M,N} |
738 | 738 | (
|
739 | 739 | LoopVectorization.CloseOpen(LoopVectorization.StaticInt{M}()),
|
740 | 740 | LoopVectorization.CloseOpen(LoopVectorization.StaticInt{N}()),
|
741 | 741 | )
|
742 | 742 | end
|
743 | 743 | function LoopVectorization.ArrayInterface.axes_types(
|
744 |
| - ::Type{SizedMatrix{M,N,T}}, |
| 744 | + ::Type{TestSizedMatrix{M,N,T}}, |
745 | 745 | ) where {M,N,T}
|
746 | 746 | Tuple{
|
747 | 747 | LoopVectorization.CloseOpen{LoopVectorization.StaticInt{0},LoopVectorization.StaticInt{M}},
|
748 | 748 | LoopVectorization.CloseOpen{LoopVectorization.StaticInt{0},LoopVectorization.StaticInt{N}},
|
749 | 749 | }
|
750 | 750 | end
|
751 |
| - Base.unsafe_convert(::Type{Ptr{T}}, A::SizedMatrix{M,N,T}) where {M,N,T} = pointer(A.data) |
752 |
| - LoopVectorization.ArrayInterface.strides(::SizedMatrix{M}) where {M} = |
| 751 | + Base.unsafe_convert(::Type{Ptr{T}}, A::TestSizedMatrix{M,N,T}) where {M,N,T} = pointer(A.data) |
| 752 | + LoopVectorization.ArrayInterface.strides(::TestSizedMatrix{M}) where {M} = |
753 | 753 | (LoopVectorization.StaticInt{1}(), LoopVectorization.StaticInt{M}())
|
754 |
| - LoopVectorization.ArrayInterface.contiguous_axis(::Type{<:SizedMatrix}) = |
| 754 | + LoopVectorization.ArrayInterface.contiguous_axis(::Type{<:TestSizedMatrix}) = |
755 | 755 | LoopVectorization.One()
|
756 |
| - LoopVectorization.ArrayInterface.contiguous_batch_size(::Type{<:SizedMatrix}) = |
| 756 | + LoopVectorization.ArrayInterface.contiguous_batch_size(::Type{<:TestSizedMatrix}) = |
757 | 757 | LoopVectorization.Zero()
|
758 |
| - LoopVectorization.ArrayInterface.stride_rank(::Type{<:SizedMatrix}) = |
| 758 | + LoopVectorization.ArrayInterface.stride_rank(::Type{<:TestSizedMatrix}) = |
759 | 759 | (LoopVectorization.StaticInt(1), LoopVectorization.StaticInt(2))
|
760 |
| - # LoopVectorization.ArrayInterface.offsets(::Type{SizedMatrix{M,N,T}}) where {M,N,T} = (LoopVectorization.StaticInt{0}(), LoopVectorization.StaticInt{0}()) |
761 |
| - LoopVectorization.ArrayInterface.offsets(::SizedMatrix) = |
| 760 | + # LoopVectorization.ArrayInterface.offsets(::Type{TestSizedMatrix{M,N,T}}) where {M,N,T} = (LoopVectorization.StaticInt{0}(), LoopVectorization.StaticInt{0}()) |
| 761 | + LoopVectorization.ArrayInterface.offsets(::TestSizedMatrix) = |
762 | 762 | (LoopVectorization.StaticInt{0}(), LoopVectorization.StaticInt{0}())
|
763 |
| - LoopVectorization.ArrayInterface.dense_dims(::Type{SizedMatrix{M,N,T}}) where {M,N,T} = |
| 763 | + LoopVectorization.ArrayInterface.dense_dims(::Type{TestSizedMatrix{M,N,T}}) where {M,N,T} = |
764 | 764 | LoopVectorization.ArrayInterface.dense_dims(Matrix{T})
|
765 | 765 | # struct ZeroInitializedArray{T,N,A<:DenseArray{T,N}} <: DenseArray{T,N}
|
766 | 766 | # data::A
|
|
971 | 971 | end
|
972 | 972 | # exceeds_time_limit() && break
|
973 | 973 | if (M, K) === (73, 77) # pick a random size, we only want to compile once
|
974 |
| - As = SizedMatrix{M,K}(A) |
975 |
| - Ats = SizedMatrix{K,M}(At) |
976 |
| - Bs = SizedMatrix{K,N}(B) |
977 |
| - Bts = SizedMatrix{N,K}(Bt) |
978 |
| - Cs = SizedMatrix{M,N}(C) |
| 974 | + As = TestSizedMatrix{M,K}(A) |
| 975 | + Ats = TestSizedMatrix{K,M}(At) |
| 976 | + Bs = TestSizedMatrix{K,N}(B) |
| 977 | + Bts = TestSizedMatrix{N,K}(Bt) |
| 978 | + Cs = TestSizedMatrix{M,N}(C) |
979 | 979 | C2z = LoopVectorization.OffsetArray(C2, -1, -1)
|
980 | 980 | @testset "avx $T static gemm" begin
|
981 | 981 | # AmulBavx1!(Cs, As, Bs)
|
|
0 commit comments