Skip to content

Commit 5fb3ea8

Browse files
committed
Merge branch 'master'
2 parents 7a0ffd4 + cfcea17 commit 5fb3ea8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/condense_loopset.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ struct OperationStruct <: AbstractLoopOperation
145145
childdeps::UInt128
146146
parents₀::UInt128
147147
parents₁::UInt128
148+
parents₂::UInt128
149+
parents₃::UInt128
148150
node_type::OperationType
149151
symid::UInt16
150152
array::UInt8
@@ -183,10 +185,12 @@ end
183185
function parents_uint(op::Operation)
184186
opv = parents(op)
185187
N = length(opv)
186-
@assert N 16
188+
@assert N 32
187189
p0 = parents_uint(view(opv, 1:min(8, N)))
188-
p1 = N > 8 ? parents_uint(view(opv, 9:N)) : zero(p0)
189-
p0, p1
190+
p1 = N > 8 ? parents_uint(view(opv, 9:min(16,N))) : zero(p0)
191+
p2 = N > 16 ? parents_uint(view(opv, 17:min(24,N))) : zero(p0)
192+
p3 = N > 24 ? parents_uint(view(opv, 25:N)) : zero(p0)
193+
p0, p1, p2, p3
190194
end
191195
function recursively_set_parents_true!(x::Vector{Bool}, op::Operation)
192196
x[identifier(op)] && return nothing # don't redescend
@@ -221,10 +225,10 @@ function OperationStruct!(
221225
ld = loopdeps_uint(ls, op)
222226
rd = reduceddeps_uint(ls, op)
223227
cd = childdeps_uint(ls, op)
224-
p0, p1 = parents_uint(op)
228+
p0, p1, p2, p3 = parents_uint(op)
225229
array = accesses_memory(op) ? findmatchingarray(ls, op.ref) : 0x00
226230
ids[identifier(op)] = id = findindoradd!(varnames, name(op))
227-
OperationStruct(ld, rd, cd, p0, p1, op.node_type, id, array)
231+
OperationStruct(ld, rd, cd, p0, p1, p2, p3, op.node_type, id, array)
228232
end
229233
## turn a LoopSet into a type object which can be used to reconstruct the LoopSet.
230234

src/reconstruct_loopset.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,15 @@ childdependencies(ls::LoopSet, os::OperationStruct, expand = false, offset = 0)
557557
parents_symvec(ls, os.childdeps, expand, offset)
558558

559559
# parents(ls::LoopSet, u::UInt128) = loopindexoffset(ls, u, false)
560-
function parents(ls::LoopSet, u₀::UInt128, u₁::UInt128)
560+
function parents(ls::LoopSet, u₀::UInt128, u₁::UInt128, u₂::UInt128, u₃::UInt128)
561561
idxs = Int[]
562+
u₃ == zero(u₃) || loopindex!(idxs, ls, u₃, 0x0010)
563+
u₂ == zero(u₂) || loopindex!(idxs, ls, u₂, 0x0010)
562564
u₁ == zero(u₁) || loopindex!(idxs, ls, u₁, 0x0010)
563565
loopindex!(idxs, ls, u₀, 0x0010)
564566
reverse!(idxs)
565567
end
566-
parents(ls::LoopSet, os::OperationStruct) = parents(ls, os.parents₀, os.parents₁)
568+
parents(ls::LoopSet, os::OperationStruct) = parents(ls, os.parents₀, os.parents₁, os.parents₂, os.parents₃)
567569

568570
expandedopname(opsymbol::Symbol, offset::Integer) =
569571
Symbol(String(opsymbol) * '#' * string(offset + 1) * '#')
@@ -669,6 +671,8 @@ function add_parents_to_op!(
669671
op::Operation,
670672
up₀::UInt128,
671673
up₁::UInt128,
674+
up₂::UInt128,
675+
up₃::UInt128,
672676
k::Int,
673677
Δ::Int,
674678
)
@@ -677,7 +681,7 @@ function add_parents_to_op!(
677681
offsets = ls.operation_offsets
678682
if isone(Δ) # not expanded
679683
@assert isone(k)
680-
for i parents(ls, up₀, up₁)
684+
for i parents(ls, up₀, up₁, up₂, up₃)
681685
# FIXME; children also filled in cacheunrolled
682686
for j offsets[i]+1:offsets[i+1] # if parents are expanded, add them all
683687
opp = ops[j]
@@ -689,7 +693,7 @@ function add_parents_to_op!(
689693
# Do we want to require that all Δidxs are equal?
690694
# Because `CartesianIndex((2,3)) - 1` results in a methoderorr, I think this is reasonable for now
691695
# FIXME; children also filled in cacheunrolled
692-
for i parents(ls, up₀, up₁)
696+
for i parents(ls, up₀, up₁, up₂, up₃)
693697
opp = ops[offsets[i]+k]
694698
pushfirst!(vparents, opp)
695699
push!(children(opp), op)
@@ -710,7 +714,7 @@ function add_parents_to_ops!(ls::LoopSet, ops::Vector{OperationStruct}, constoff
710714
pushpreamble!(ls, Expr(:(=), instr.instr, extract_varg(constoffset)))
711715
end
712716
elseif !isloopvalue(op)
713-
add_parents_to_op!(ls, op, ops[i].parents₀, ops[i].parents₁, k, Δ)
717+
add_parents_to_op!(ls, op, ops[i].parents₀, ops[i].parents₁, ops[i].parents₂, ops[i].parents₃, k, Δ)
714718
end
715719
end
716720
end

0 commit comments

Comments
 (0)