Skip to content

Commit 4e9ca9e

Browse files
committed
Fix #351, add tests, and bump version.
1 parent 34f3dc2 commit 4e9ca9e

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.92"
4+
version = "0.12.93"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/parse/memory_ops_common.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ function array_reference_meta!(ls::LoopSet, array::Symbol, rawindices, elementby
522522
if indop !== nothing && !isconstant(indop)
523523
if iscompute(indop) && Base.sym_in(instruction(indop).instr, (:add_fast, :sub_fast))
524524
vptrarray = add_additive_index!(ls, parents, vptrarray, ind, indop, ninds, indices, offsets, strides, loopedindex, loopdependencies, reduceddeps, 0, 1, D)
525+
ninds += 1
525526
else
526527
pushparent!(parents, loopdependencies, reduceddeps, indop)
527528
push!(indices, name(indop)); ninds += 1

test/grouptests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ const START_TIME = time()
6161
@time include("special.jl")
6262

6363
@time include("mapreduce.jl")
64+
65+
@time include("index_processing.jl")
6466
end
6567

6668
@time if LOOPVECTORIZATION_TEST == "all" || LOOPVECTORIZATION_TEST == "part3"

test/index_processing.jl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
3+
function multiindexreverse(n,m)
4+
A = zeros(n,2m)
5+
@turbo for i=1:n÷2, j = 1:m
6+
a = 1.23
7+
b = 3.21
8+
A[i, j] = a
9+
A[i, m+j] = b
10+
r = n + 1 - i
11+
A[r, j] = a
12+
A[r, m+j] = b
13+
end
14+
return A
15+
end
16+
function multiindexreverse_ref(n,m)
17+
A = zeros(n,2m)
18+
@turbo for i=1:n÷2, j = 1:m
19+
a = 1.23
20+
b = 3.21
21+
A[i, j] = a
22+
A[i, m+j] = b
23+
r = n + 1 - i
24+
A[r, j] = a
25+
A[r, m+j] = b
26+
end
27+
return A
28+
end
29+
30+
@testset "Multiple indices" begin
31+
for m in 1:10, n in 1:20
32+
@test multiindexreverse(n, m) == multiindexreverse_ref(n, m)
33+
end
34+
end
35+

0 commit comments

Comments
 (0)