Skip to content

Commit 6500968

Browse files
committed
Fix reduce_expr! call in lower_computer, and define static_step on CartesianIndices for Julia 1.5
1 parent 48226d4 commit 6500968

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/LoopVectorization.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ using Base.FastMath: add_fast, sub_fast, mul_fast, div_fast, inv_fast, abs2_fast
3636

3737

3838
using ArrayInterface
39-
using ArrayInterface: OptionallyStaticUnitRange, OptionallyStaticRange, Zero, One, StaticBool, True, False, reduce_tup, indices, static_step
39+
using ArrayInterface: OptionallyStaticUnitRange, OptionallyStaticRange, Zero, One, StaticBool, True, False, reduce_tup, indices
40+
@static if VERSION v"1.6.0-rc1" #TODO: delete `else` when dropping 1.5 support
41+
using ArrayInterface: static_step
42+
else # Julia 1.5 did not define `step` on CartesianIndices
43+
@inline static_step(x) = ArrayInterface.static_step
44+
static_step(x::CartesianIndices) = CartesianIndex(map(step, x.indices))
45+
end
4046
const Static = ArrayInterface.StaticInt
4147

4248
using Requires
@@ -50,6 +56,7 @@ export LowDimArray, stridedpointer, indices,
5056

5157
const VECTORWIDTHSYMBOL, ELTYPESYMBOL, MASKSYMBOL = Symbol("##Wvecwidth##"), Symbol("##Tloopeltype##"), Symbol("##mask##")
5258

59+
5360
include("vectorizationbase_compat/contract_pass.jl")
5461
include("vectorizationbase_compat/subsetview.jl")
5562
include("closeopen.jl")

src/codegen/lower_compute.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function lower_compute!(
351351
else
352352
newpname = Symbol(newparentname, '_', u₁)
353353
push!(q.args, Expr(:(=), newpname, Symbol(parentname, '_', u₁)))
354-
reduce_expr!(q, newparentname, instruction(newparentop), u₁, -1, true)
354+
reduce_expr!(q, newparentname, instruction(newparentop), u₁, -1, true, false)
355355
push!(q.args, Expr(:(=), Symbol(newparentname, '_', 1), Symbol(newparentname, "##onevec##")))
356356
end
357357
end

src/reconstruct_loopset.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ Execute an `@avx` block. The block's code is represented via the arguments:
619619
@generated function _avx_!(
620620
::Val{UNROLL}, ::Val{OPS}, ::Val{ARF}, ::Val{AM}, ::Val{LPSYM}, var"#lv#tuple#args#"::Tuple{LB,V}
621621
) where {UNROLL, OPS, ARF, AM, LPSYM, LB, V}
622-
1 + 1 # Irrelevant line you can comment out/in to force recompilation...
622+
# 1 + 1 # Irrelevant line you can comment out/in to force recompilation...
623623
ls = _avx_loopset(OPS, ARF, AM, LPSYM, LB.parameters, V.parameters, UNROLL)
624624
# return @show avx_body(ls, UNROLL)
625625
if last(UNROLL) > 1

0 commit comments

Comments
 (0)