1
1
using LoopVectorization, ArrayInterface, OffsetArrays, Test
2
2
using LoopVectorization: Static
3
- # T = Float64
4
- # T = Float32
3
+ T = Float64; r = - 1 : 1 ;
4
+ # T = Float32; r = -1:1;
5
5
6
- @testset " OffsetArrays" begin
6
+ # @testset "OffsetArrays" begin
7
7
8
8
function old2d! (out:: AbstractMatrix , A:: AbstractMatrix , kern)
9
9
rng1k, rng2k = axes (kern)
@@ -94,9 +94,9 @@ using LoopVectorization: Static
94
94
Base. axes (:: SizedOffsetMatrix{T,LR,UR,LC,UC} ) where {T,LR,UR,LC,UC} = (Static {LR} (): Static {UR} (),Static {LC} (): Static {UC} ())
95
95
Base. parent (A:: SizedOffsetMatrix ) = A. data
96
96
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)} ()
100
100
function ArrayInterface. strides (A:: SizedOffsetMatrix{T,LR,UR,LC,UC} ) where {T,LR,UR,LC,UC}
101
101
(Static {1} (), (Static {UR} () - Static {LR} () + Static {1} ()))
102
102
end
@@ -112,7 +112,7 @@ using LoopVectorization: Static
112
112
# end
113
113
# Base.size(A::SizedOffsetMatrix{T,LR,UR,LC,UC}) where {T,LR,UR,LC,UC} = (1 + UR-LR, 1 + UC-LC)
114
114
# 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 ))
116
116
function avx2dunrolled! (out:: AbstractMatrix , A:: AbstractMatrix , kern:: SizedOffsetMatrix{T,-1,1,-1,1} ) where {T}
117
117
rng1, rng2 = axes (out)
118
118
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
208
208
out
209
209
end
210
210
211
- for T ∈ (Float32, Float64)
211
+ # for T ∈ (Float32, Float64)
212
212
@show T, @__LINE__
213
213
Abase = fill (T (NaN ), 200 , 200 );
214
214
# 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 );
216
216
A .= rand .();
217
217
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)
220
220
@show r
221
221
fr = first (r); lr = last (r);
222
222
kern = OffsetArray (rand (T, length (r), length (r)), r, r);
0 commit comments