@@ -92,7 +92,6 @@ function indices_calculated_by_pointer_offsets(ls::LoopSet, ar::ArrayReferenceMe
92
92
ls. isbroadcast && return fill (false , length (indices))
93
93
looporder = names (ls)
94
94
offset = isdiscontiguous (ar)
95
- gespinds = Expr (:tuple )
96
95
out = Vector {Bool} (undef, length (indices))
97
96
strds = getstrides (ar)
98
97
li = ar. loopedindex
@@ -310,7 +309,7 @@ function isloopvalue(
310
309
if (isrooted ≢ nothing )
311
310
isrooted[i] || continue
312
311
end
313
- iscompute (op) || continue
312
+ ( iscompute (op) | isstore (op) ) || continue
314
313
for opp ∈ parents (op)# this is to confirm `ind` still has children
315
314
# (isloopvalue(opp) && instruction(opp).instr === ind) && return true
316
315
if (isloopvalue (opp) && instruction (opp). instr === ind)
@@ -331,10 +330,8 @@ function cse_constant_offsets!(
331
330
# vptrar = vptr(ar)
332
331
arrayref_to_name_op = arrayref_to_name_op_collection[allarrayrefsind]
333
332
array_refs_with_same_name = name_to_array_map[first (first (arrayref_to_name_op))]
334
- us = ls. unrollspecification
335
333
li = ar. loopedindex
336
334
indices = getindices (ar)
337
- strides = getstrides (ar)
338
335
offset = first (indices) === DISCONTIGUOUS
339
336
# gespindoffsets = fill(Symbol(""), length(li))
340
337
gespindsummary = Vector {Symbol} (undef, length (li))
@@ -814,7 +811,6 @@ function use_loop_induct_var!(
814
811
q:: Expr ,
815
812
ar:: ArrayReferenceMeta ,
816
813
allarrayrefs:: Vector{ArrayReferenceMeta} ,
817
- allarrayrefsind:: Int ,
818
814
includeinlet:: Bool ,
819
815
# array_refs_with_same_name::Vector{Int}, arrayref_to_name_op_collection::Vector{Vector{Tuple{Int,Int,Int}}}
820
816
):: Vector{Int}
@@ -868,7 +864,7 @@ function use_loop_induct_var!(
868
864
Wisz || pushgespind! (gespinds, ls, Symbol (" " ), 0 , 1 , ind, isli, true , false )
869
865
else
870
866
uliv[i] = findfirst (Base. Fix2 (=== , ind), looporder):: Int
871
- loop = getloop (ls, ind)
867
+ # loop = getloop(ls, ind)
872
868
push! (offsetprecalc_descript. args, max (5 , us. u₁ + 1 , us. u₂ + 1 ))
873
869
use_offsetprecalc = true
874
870
Wisz || pushgespind! (gespinds, ls, Symbol (" " ), 0 , 1 , ind, isli, false , false )
904
900
# Plan here is that we increment every unique array
905
901
function add_loop_start_stop_manager! (ls:: LoopSet )
906
902
q = Expr (:block )
907
- us = ls. unrollspecification
908
903
# Presence of an explicit use of a loopinducation var means we should use that, so we look for one
909
904
# TODO : replace first with only once you add Compat as a dep or drop support for older Julia versions
910
905
loopinductvars = Symbol[]
@@ -917,7 +912,7 @@ function add_loop_start_stop_manager!(ls::LoopSet)
917
912
use_livs = Vector {Vector{Int}} (undef, length (arrayrefs))
918
913
# for i ∈ eachindex(name_to_array_map)
919
914
for i ∈ eachindex (arrayrefs)
920
- use_livs[i] = use_loop_induct_var! (ls, q, arrayrefs[i], arrayrefs, i, includeinlet[i])
915
+ use_livs[i] = use_loop_induct_var! (ls, q, arrayrefs[i], arrayrefs, includeinlet[i])
921
916
# name_to_array_map[first(first(unique_to_name_and_op_map[i]))], unique_to_name_and_op_map)
922
917
end
923
918
# loops, sorted from outer-most to inner-most
@@ -934,11 +929,9 @@ function add_loop_start_stop_manager!(ls::LoopSet)
934
929
reached_indices = zeros (Int, length (arrayrefs))
935
930
for (i, loopsym) ∈ enumerate (looporder) # iterates from outer to inner
936
931
loopstartᵢ = ArrayReferenceMeta[]
937
- arⱼ = 0
938
- minrem = typemax (Int)
939
932
ric = Tuple{Int,Int}[]
940
933
for j ∈ eachindex (use_livs) # j is array ref number
941
- for (l, k) ∈ enumerate ( use_livs[j]) # l is index number, k is loop number
934
+ for k ∈ use_livs[j]# l is index number, k is loop number
942
935
if k == i
943
936
push! (loopstartᵢ, arrayrefs[j])
944
937
push! (ric, ((reached_indices[j] += 1 ), length (loopstartᵢ)))
@@ -1006,7 +999,6 @@ function pointermax_index(
1006
999
# @unpack u₁loopnum, u₂loopnum, vloopnum, u₁, u₂ = us
1007
1000
loopsym = names (ls)[n]
1008
1001
index = Expr (:tuple )
1009
- found_loop_sym = false
1010
1002
ind = 0
1011
1003
for (j, i) ∈ enumerate (getindicesonly (ar))
1012
1004
if i === loopsym
@@ -1227,7 +1219,6 @@ function startloop(ls::LoopSet, us::UnrollSpecification, n::Int, staticinit::Boo
1227
1219
termind = lssm. terminators[n]
1228
1220
ptrdefs = lssm. incrementedptrs[n]
1229
1221
loopstart = Expr (:block )
1230
- firstloop = n == num_loops (ls)
1231
1222
for ar ∈ ptrdefs
1232
1223
ptr_offset = vptr_offset (ar)
1233
1224
push! (loopstart. args, Expr (:(= ), ptr_offset, ptr_offset))
@@ -1288,7 +1279,7 @@ function incrementloopcounter!(
1288
1279
if iszero (termind) # increment liv
1289
1280
push! (q. args, incrementloopcounter (us, n, loopsym, UF, loop))
1290
1281
end
1291
- for (j, ar) ∈ enumerate ( ptrdefs)
1282
+ for ar ∈ ptrdefs
1292
1283
offsetinds = indices_calculated_by_pointer_offsets (ls, ar)
1293
1284
push! (q. args, offset_ptr (ar, us, loopsym, n, UF, offsetinds, loop))
1294
1285
end
0 commit comments