Skip to content

Commit 4bb812f

Browse files
committed
Fix for commit that prevents reordereding of unrolled reductions.
1 parent fa9f6c5 commit 4bb812f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/LoopVectorization.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module LoopVectorization
22

33
using VectorizationBase, SIMDPirates, SLEEFPirates, MacroTools
44
using VectorizationBase: REGISTER_SIZE, extract_data, num_vector_load_expr
5-
using SIMDPirates: VECTOR_SYMBOLS
5+
using SIMDPirates: VECTOR_SYMBOLS, evadd, evmul
66
using MacroTools: @capture, prewalk, postwalk
77

88
export vectorizable, @vectorize, @vvectorize
@@ -133,7 +133,11 @@ end
133133
throw("Type $Tsym is not supported.")
134134
end
135135
end
136-
@noinline function vectorize_body(N, T::DataType, unroll_factor::Int, n, body, vecdict = SLEEFPiratesDict, VType = SVec, gcpreserve::Bool = true, mod = :LoopVectorization)
136+
@noinline function vectorize_body(
137+
N, ::Type{T}, unroll_factor::Int, n::Symbol, body::Array{Any},
138+
vecdict::Dict{Symbol,Tuple{Symbol,Symbol}} = SLEEFPiratesDict,
139+
@nospecialize(VType = SVec), gcpreserve::Bool = true, mod = :LoopVectorization
140+
) where {T}
137141
# unroll_factor == 1 || throw("Only unroll factor of 1 is currently supported. Was set to $unroll_factor.")
138142
T_size = sizeof(T)
139143
if isa(N, Integer)
@@ -295,7 +299,7 @@ end
295299
pushfirst!(q.args, :($gsym = $mod.vbroadcast($V,one($T))))
296300
end
297301
end
298-
func = ((op == :*) | (op == :/)) ? :($mod.vmul) : :($mod.vadd)
302+
func = ((op == :*) | (op == :/)) ? :($mod.evmul) : :($mod.evadd)
299303
uf_new = unroll_factor
300304
while uf_new > 1
301305
uf_new, uf_prev = uf_new >> 1, uf_new

0 commit comments

Comments
 (0)