Skip to content

Commit dfb9b8d

Browse files
committed
Don't capture muladds in loop bounds expr
1 parent c121be9 commit dfb9b8d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/vectorizationbase_compat/contract_pass.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,11 @@ function contract!(expr::Expr, ex::Expr, i::Int, mod)
207207
end
208208
# contract_pass(x) = x # x will probably be a symbol
209209
function contract_pass!(expr::Expr, mod = nothing)
210-
for (i,ex) enumerate(expr.args)
211-
ex isa Expr || continue
210+
i = Core.ifelse(expr.head === :for, 1, 0)
211+
while i < length(expr.args)
212+
_ex = expr.args[(i+=1)]
213+
_ex isa Expr || continue
214+
ex::Expr = _ex
212215
contract!(expr, ex, i, mod)
213216
end
214217
end

test/gemm.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@
7171
end
7272
end
7373
function AmulBavx1!(C, A, B)
74-
@avx for m 1:size(A,1), n axes(B,2)
74+
dM, rM = divrem(size(C,1), 3)
75+
dN, rN = divrem(size(C,2), 3)
76+
dK, rK = divrem(size(B,1), 3)
77+
@avx for m 1:3*dM + rM, n 1:3*dN + rN
7578
Cₘₙ = zero(eltype(C))
76-
for k 1:size(A,2)
79+
for k 1:3*dK + rK
7780
Cₘₙ += A[m,k] * B[k,n]
7881
end
7982
C[m,n] = Cₘₙ

0 commit comments

Comments
 (0)