Skip to content

Commit e07f203

Browse files
committed
Fix hh(avx)! test take 2.
1 parent f100672 commit e07f203

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

test/gemv.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,20 @@ using Test
147147
@test LoopVectorization.choose_order(lsp) == ([:d1, :d2], :d2, :d1, :d2, Unum, Tnum)
148148
# lsp.preamble_symsym
149149

150-
function hhavx!(A, B, C, D)
150+
function hhavx!(A::AbstractVector{T}, B, C, D) where {T}
151+
L = T(length(axes(B,2)));
151152
@avx for i in axes(A, 1)
152-
A[i] = A[i] + D[i] * length(axes(B,2));
153+
A[i] = A[i] + D[i] * L
153154
for j = axes(B, 2)
154155
B[i, j] = B[i, j] + D[i]
155156
C[j] = C[j] + D[i]
156157
end
157158
end
158159
end
159-
function hh!(A, B, C, D)
160+
function hh!(A::AbstractVector{T}, B, C, D) where {T}
161+
L = T(length(axes(B,2)));
160162
@inbounds @fastmath for i in axes(A, 1)
161-
A[i] = A[i] + D[i] * length(axes(B,2));
163+
A[i] = A[i] + D[i] * L
162164
for j = axes(B, 2)
163165
B[i, j] = B[i, j] + D[i]
164166
C[j] = C[j] + D[i]
@@ -211,10 +213,10 @@ using Test
211213
fill!(G2, TC(NaN)); AtmulvB_avx3!(G2,B,1);
212214
@test G1 G2
213215

214-
D = rand(T, M);
215-
B1 = rand(T, M,N); B2 = copy(B1);
216-
C1 = rand(T, N); C2 = copy(C1);
217-
A1 = rand(T, size(D)...); A2 = copy(A1);
216+
D = rand(R, M);
217+
B1 = rand(R, M,N); B2 = copy(B1);
218+
C1 = rand(R, N); C2 = copy(C1);
219+
A1 = rand(R, size(D)...); A2 = copy(A1);
218220
hh!(A1, B1, C1, D)
219221
hhavx!(A2, B2, C2, D)
220222
@test B1 B2

0 commit comments

Comments
 (0)