Skip to content

Commit 4f8a194

Browse files
committed
tuple support
1 parent 9da30ff commit 4f8a194

File tree

7 files changed

+40
-4
lines changed

7 files changed

+40
-4
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.135"
4+
version = "0.12.136"
55

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

src/condense_loopset.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ end
882882
@inline check_args(::LoTri) = false
883883
@inline check_args(::Diagonal) = false
884884
@inline check_args(::Type{T}) where {T} = check_type(T)
885+
@inline check_args(::Tuple{T,Vararg{T,K}}) where {T,K} = check_type(T)
885886
"""
886887
check_type(::Type{T}) where {T}
887888

src/modeling/graphs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ function fill_children!(ls::LoopSet)
623623
for op operations(ls)
624624
empty!(children(op))
625625
for opp parents(op)
626+
@assert children(opp) !== NOPARENTS
626627
push!(children(opp), op)
627628
end
628629
end

src/parse/add_compute.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function pushparent!(
5555
reduceddeps::Vector{Symbol},
5656
parent::Operation,
5757
)
58+
@assert parents !== NOPARENTS
5859
push!(parents, parent)
5960
update_deps!(deps, reduceddeps, parent)
6061
end
@@ -299,7 +300,10 @@ function add_reduction_update_parent!(
299300
# create child op, which is the reduction combination
300301
childrdeps = Symbol[]
301302
childparents = Operation[op]#, parent ]
302-
add_reduct_instruct && push!(childparents, parent)
303+
if add_reduct_instruct
304+
@assert childparents !== NOPARENTS
305+
push!(childparents, parent)
306+
end
303307
childdeps = loopdependencies(reductinit)
304308
setdiffv!(childrdeps, loopdependencies(op), childdeps)
305309
child = Operation(

src/parse/add_ifelse.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ function add_if!(
3030
all(ld -> ld loopdependencies(trueop), loopdependencies(condop)) &&
3131
!search_tree(parents(condop), trueop)
3232
trueop.instruction = Instruction(:conditionalload)
33-
push!(parents(trueop), condop)
33+
if parents(trueop) !== NOPARENTS
34+
push!(parents(trueop), condop)
35+
else
36+
trueop.parents = [condop]
37+
end
3438
end
3539
else
3640
trueop = getop(ls, iftrue, elementbytes)
@@ -50,7 +54,12 @@ function add_if!(
5054
all(ld -> ld loopdependencies(falseop), loopdependencies(condop)) &&
5155
!search_tree(parents(condop), falseop)
5256
falseop.instruction = Instruction(:conditionalload)
53-
push!(parents(falseop), negateop!(ls, condop, elementbytes))
57+
negop = negateop!(ls, condop, elementbytes)
58+
if parents(falseop) !== NOPARENTS
59+
push!(parents(falseop), negop)
60+
else
61+
falseop.parents = [negop]
62+
end
5463
if (any(==(identifier(trueop)), Iterators.map(first, ls.preamble_zeros)))
5564
falseop.variable = LHS
5665
ls.opdict[LHS] = falseop

test/grouptests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const START_TIME = time()
99
@time if LOOPVECTORIZATION_TEST == "all" || LOOPVECTORIZATION_TEST == "part1"
1010
@time include("broadcast.jl")
1111
@time include("parsing_inputs.jl")
12+
@time include("misc2.jl")
1213
end
1314

1415
@time if LOOPVECTORIZATION_TEST == "all" || LOOPVECTORIZATION_TEST == "part2"

test/misc2.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
using LoopVectorization, Test
3+
4+
function tuptestturbo(x,y,t)
5+
s = 0.0
6+
@turbo for i = eachindex(x,y)
7+
s += x[i]*t[1] - y[i]*t[2]
8+
end
9+
s
10+
end
11+
function tuptest(x,y,t)
12+
s = 0.0
13+
@inbounds @fastmath for i = eachindex(x,y)
14+
s += x[i]*t[1] - y[i]*t[2]
15+
end
16+
s
17+
end
18+
x = rand(127); y = rand(127); t = (rand(),rand());
19+
@test tuptestturbo(x,y,t) tuptest(x,y,t)
20+

0 commit comments

Comments
 (0)