Skip to content

Commit 68a9f70

Browse files
committed
ArrayInterface 6
1 parent 6f149ee commit 68a9f70

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

Project.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.110"
4+
version = "0.12.111"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
8+
ArrayInterfaceOffsetArrays = "015c0d05-e682-4f19-8f0a-679ce4c54826"
9+
ArrayInterfaceStaticArrays = "b0d46f97-bff5-4637-a19a-dd75974142cd"
810
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
911
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
1012
CloseOpenIntervals = "fb6a15b2-703c-40df-9091-08a04967cfa9"
@@ -25,7 +27,9 @@ UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
2527
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
2628

2729
[compat]
28-
ArrayInterface = "3.1.32, 3.2.1, 5.0.1"
30+
ArrayInterface = "6.0.1"
31+
ArrayInterfaceOffsetArrays = "0.1.2"
32+
ArrayInterfaceStaticArrays = "0.1.2"
2933
CPUSummary = "0.1.3 - 0.1.8, 0.1.11"
3034
ChainRulesCore = "1"
3135
CloseOpenIntervals = "0.1.2"

src/LoopVectorization.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module LoopVectorization
22

33
using Static: StaticInt, gt, static
4-
using VectorizationBase, SLEEFPirates, UnPack, OffsetArrays
4+
using VectorizationBase,
5+
SLEEFPirates, UnPack, OffsetArrays, ArrayInterfaceOffsetArrays, ArrayInterfaceStaticArrays
56
using VectorizationBase:
67
mask,
78
MM,

src/constructors.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ end
176176
function replace_enumerate!(q, prepreamble)
177177
looprange = q.args[1]
178178
if Meta.isexpr(looprange, :block)
179-
for i in 1:length(looprange.args)
179+
for i = 1:length(looprange.args)
180180
replace_single_enumerate!(q, prepreamble, i)
181181
end
182182
else
183183
replace_single_enumerate!(q, prepreamble)
184184
end
185185
return q
186186
end
187-
function replace_single_enumerate!(q, prepreamble, i=nothing)
187+
function replace_single_enumerate!(q, prepreamble, i = nothing)
188188
if isnothing(i) # not nest loop
189189
looprange, body = q.args[1], q.args[2]
190190
else # nest loop
@@ -203,7 +203,7 @@ function replace_single_enumerate!(q, prepreamble, i=nothing)
203203
if Meta.isexpr(itersyms, :tuple, 2)
204204
indsym, varsym = itersyms.args[1]::Symbol, itersyms.args[2]::Symbol
205205
_replace_looprange!(q, i, indsym, iter)
206-
pushfirst!(body.args, :($varsym = $iter[$indsym + firstindex($iter) - 1]))
206+
pushfirst!(body.args, :($varsym = $iter[$indsym+firstindex($iter)-1]))
207207
elseif Meta.isexpr(itersyms, :tuple, 1) # like `for (i,) in enumerate(...)`
208208
indsym = itersyms.args[1]::Symbol
209209
_replace_looprange!(q, i, indsym, iter)
@@ -216,8 +216,10 @@ function replace_single_enumerate!(q, prepreamble, i=nothing)
216216
end
217217
return q
218218
end
219-
_replace_looprange!(q, ::Nothing, indsym, iter) = q.args[1] = :($indsym = Base.OneTo(length($iter)))
220-
_replace_looprange!(q, i::Int, indsym, iter) = q.args[1].args[i] = :($indsym = Base.OneTo(length($iter)))
219+
_replace_looprange!(q, ::Nothing, indsym, iter) =
220+
q.args[1] = :($indsym = Base.OneTo(length($iter)))
221+
_replace_looprange!(q, i::Int, indsym, iter) =
222+
q.args[1].args[i] = :($indsym = Base.OneTo(length($iter)))
221223

222224
function turbo_macro(mod, src, q, args...)
223225
q = macroexpand(mod, q)

src/modeling/determinestrategy.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ function cost(
111111
# cannot shuffle false means reject curly
112112
# either false means shuffle
113113
dont_shuffle =
114-
(Wshift > 3) || (rejectinterleave(op) && (cannot_shuffle(op, u₁, u₂, contigind, indices)))
114+
(Wshift > 3) ||
115+
(rejectinterleave(op) && (cannot_shuffle(op, u₁, u₂, contigind, indices)))
115116
if dont_shuffle
116117
# offset = 0.0 # gather/scatter, alignment doesn't matter
117118
r = 1 << shifter

test/parsing_inputs.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ end
7272
@test A == 1:4
7373
@test B == ones(4)
7474
@test A .* B' == C' == D
75-
@test_throws ArgumentError check_inputs!(:(for ix in enumerate(A)
76-
A[ix[1]] = ix[1] + ix[2]
77-
end), Any[])
78-
@test_throws ArgumentError check_inputs!(:(for () in enumerate(A); end), Any[])
75+
@test_throws ArgumentError check_inputs!(:(
76+
for ix in enumerate(A)
77+
A[ix[1]] = ix[1] + ix[2]
78+
end
79+
), Any[])
80+
@test_throws ArgumentError check_inputs!(:(
81+
for () in enumerate(A)
82+
end
83+
), Any[])
7984
end

0 commit comments

Comments
 (0)