Skip to content

Commit e05ffca

Browse files
committed
further progress
1 parent 8aa104c commit e05ffca

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/LoopVectorization.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ using ArrayInterface
3636
using ArrayInterface: OptionallyStaticUnitRange, Zero
3737
const Static = ArrayInterface.StaticInt
3838

39-
# TODO: this is type piracy; move this elsewhere!
40-
VectorizationBase.memory_reference(A::OffsetArray) = VectorizationBase.memory_reference(parent(A))
41-
# ArrayInterface.parent_type(::Type{O}) where {T,N,A<:AbstractArray{T,N},O<:OffsetArray{T,N,A}} = A
4239

4340

4441
export LowDimArray, stridedpointer,

test/offsetarrays.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using LoopVectorization, ArrayInterface, OffsetArrays, Test
22
using LoopVectorization: Static
3-
# T = Float64
4-
# T = Float32
3+
T = Float64; r = -1:1;
4+
# T = Float32; r = -1:1;
55

6-
@testset "OffsetArrays" begin
6+
# @testset "OffsetArrays" begin
77

88
function old2d!(out::AbstractMatrix, A::AbstractMatrix, kern)
99
rng1k, rng2k = axes(kern)
@@ -94,9 +94,9 @@ using LoopVectorization: Static
9494
Base.axes(::SizedOffsetMatrix{T,LR,UR,LC,UC}) where {T,LR,UR,LC,UC} = (Static{LR}():Static{UR}(),Static{LC}():Static{UC}())
9595
Base.parent(A::SizedOffsetMatrix) = A.data
9696
Base.unsafe_convert(::Type{Ptr{T}}, A::SizedOffsetMatrix{T}) where {T} = pointer(A.data)
97-
ArrayInterface.contiguous_axis(A::SizedOffsetMatrix) = ArrayInterface.Contiguous{1}()
98-
ArrayInterface.contiguous_batch_size(A::SizedOffsetMatrix) = ArrayInterface.ContiguousBatch{0}()
99-
ArrayInterface.stride_rank(A::SizedOffsetMatrix) = ArrayInterface.StrideRank{(1,2)}()
97+
ArrayInterface.contiguous_axis(::Type{<:SizedOffsetMatrix}) = ArrayInterface.Contiguous{1}()
98+
ArrayInterface.contiguous_batch_size(::Type{<:SizedOffsetMatrix}) = ArrayInterface.ContiguousBatch{0}()
99+
ArrayInterface.stride_rank(::Type{<:SizedOffsetMatrix}) = ArrayInterface.StrideRank{(1,2)}()
100100
function ArrayInterface.strides(A::SizedOffsetMatrix{T,LR,UR,LC,UC}) where {T,LR,UR,LC,UC}
101101
(Static{1}(), (Static{UR}() - Static{LR}() + Static{1}()))
102102
end
@@ -112,7 +112,7 @@ using LoopVectorization: Static
112112
# end
113113
# Base.size(A::SizedOffsetMatrix{T,LR,UR,LC,UC}) where {T,LR,UR,LC,UC} = (1 + UR-LR, 1 + UC-LC)
114114
# Base.CartesianIndices(::SizedOffsetMatrix{T,LR,UR,LC,UC}) where {T,LR,UR,LC,UC} = CartesianIndices((LR:UR,LC:UC))
115-
Base.getindex(A::SizedOffsetMatrix, i, j) = LoopVectorization.vload(LoopVectorization.stridedpointer(A), (i-1,j-1))
115+
Base.getindex(A::SizedOffsetMatrix, i, j) = LoopVectorization.vload(LoopVectorization.stridedpointer(A), (i,j))
116116
function avx2dunrolled!(out::AbstractMatrix, A::AbstractMatrix, kern::SizedOffsetMatrix{T,-1,1,-1,1}) where {T}
117117
rng1, rng2 = axes(out)
118118
Base.Cartesian.@nexprs 3 jk -> Base.Cartesian.@nexprs 3 ik -> kern_ik_jk = kern[ik-2,jk-2]
@@ -208,15 +208,15 @@ using LoopVectorization: Static
208208
out
209209
end
210210

211-
for T (Float32, Float64)
211+
# for T ∈ (Float32, Float64)
212212
@show T, @__LINE__
213213
Abase = fill(T(NaN), 200, 200);
214214
# out of bounds reads load NaNs, poisoning results leading to test failure.
215-
A = view(Abase, 51:150, 51:150);
215+
A = view(Abase, 51:152, 51:152);
216216
A .= rand.();
217217
Atbase = copy(Abase');
218-
At = view(Atbase, 51:150, 51:150);
219-
for r (-1:1, -2:2)
218+
At = view(Atbase, 51:152, 51:152);
219+
# for r ∈ (-1:1, -2:2)
220220
@show r
221221
fr = first(r); lr = last(r);
222222
kern = OffsetArray(rand(T, length(r), length(r)), r, r);

0 commit comments

Comments
 (0)