Skip to content

Commit f5bd59a

Browse files
committed
Clean up some old/removed code, add tests for first-ninth.
1 parent 9b44334 commit f5bd59a

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

src/broadcast.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,6 @@ function add_broadcast!(
236236
parent = add_broadcast!(ls, gensym(:temp), argname, loopsyms, arg, elementbytes)::Operation
237237
push!(parents, parent)
238238
mergesetdiffv!(deps, loopdependencies(parent), reduceddependencies(parent))
239-
# if !(isload(parent) || isconstant(parent))# && parent.instruction.instr ∉ (:reduced_add, :reduced_prod, :reduce_to_add, :reduce_to_prod)
240-
# mergesetv!(reduceddeps, reduceddependencies(parent))
241-
# end
242-
# pushparent!(parents, deps, reduceddeps, parent)
243239
end
244240
op = Operation(
245241
length(operations(ls)), destname, elementbytes, instr, compute, deps, NOPARENTS, parents

src/costs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ const COST = Dict{Symbol,InstructionCost}(
244244
:fifth => InstructionCost(0,0.0,0.0,0),
245245
:sixth => InstructionCost(0,0.0,0.0,0),
246246
:seventh => InstructionCost(0,0.0,0.0,0),
247-
:eigth => InstructionCost(0,0.0,0.0,0),
247+
:eighth => InstructionCost(0,0.0,0.0,0),
248248
:ninth => InstructionCost(0,0.0,0.0,0),
249249
:prefetch => InstructionCost(0,0.0,0.0,0),
250250
:prefetch0 => InstructionCost(0,0.0,0.0,0),

src/graphs.jl

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ end
178178
use_expect() = true
179179
function looplengthexpr(loop, n)
180180
le = looplengthexpr(loop)
181-
if false && use_expect() && isone(n) && !isstaticloop(loop)
182-
le = expect(le)
183-
push!(le.args, Expr(:call, Expr(:curly, :Val, length(loop))))
184-
end
181+
# if false && use_expect() && isone(n) && !isstaticloop(loop)
182+
# le = expect(le)
183+
# push!(le.args, Expr(:call, Expr(:curly, :Val, length(loop))))
184+
# end
185185
le
186186
end
187187

@@ -251,7 +251,6 @@ struct LoopSet
251251
loadelimination::Base.RefValue{Bool}
252252
lssm::Base.RefValue{LoopStartStopManager}
253253
vector_width::Base.RefValue{Int}
254-
# align_loops::Base.RefValue{Int}
255254
isbroadcast::Base.RefValue{Bool}
256255
mod::Symbol
257256
end
@@ -341,7 +340,7 @@ function LoopSet(mod::Symbol)
341340
Matrix{Float64}(undef, 5, 2),
342341
Bool[], Bool[], Ref{UnrollSpecification}(),
343342
Ref(false), Ref{LoopStartStopManager}(),
344-
Ref(0), #=Ref(0),=# Ref(false), mod
343+
Ref(0), Ref(false), mod
345344
)
346345
end
347346

@@ -393,16 +392,6 @@ function Operation(ls::LoopSet, variable, elementbytes, instr, optype, mpref::Ar
393392
Operation(length(operations(ls)), variable, elementbytes, instr, optype, mpref)
394393
end
395394

396-
# load_operations(ls::LoopSet) = ls.loadops
397-
# compute_operations(ls::LoopSet) = ls.computeops
398-
# store_operations(ls::LoopSet) = ls.storeops
399-
# function operations(ls::LoopSet)
400-
# Base.Iterators.flatten((
401-
# load_operations(ls),
402-
# compute_operations(ls),
403-
# store_operations(ls)
404-
# ))
405-
# end
406395
operations(ls::LoopSet) = ls.operations
407396
function pushop!(ls::LoopSet, op::Operation, var::Symbol = name(op))
408397
for opp operations(ls)
@@ -686,7 +675,7 @@ function Base.push!(ls::LoopSet, ex::Expr, elementbytes::Int, position::Int)
686675
lhstemp = gensym(:lhstuple)
687676
vparents = Operation[maybe_const_compute!(ls, add_operation!(ls, lhstemp, RHS, elementbytes, position), elementbytes, position)]
688677
for i eachindex(LHS.args)
689-
f = (:first,:second,:third,:fourth,:fifth,:sixth,:seventh,:eigth,:ninth)[i]
678+
f = (:first,:second,:third,:fourth,:fifth,:sixth,:seventh,:eighth,:ninth)[i]
690679
lhsi = LHS.args[i]
691680
if lhsi isa Symbol
692681
add_compute!(ls, lhsi, f, vparents, elementbytes)

test/miscellaneous.jl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,23 @@ function findreducedparentfornonvecstore!(U::AbstractMatrix{T}, E1::AbstractVect
721721
U,E1
722722
end
723723

724-
724+
ninereturns(x) = (0.25x, 0.5x, 0.75, 1.0x, 1.25x, 1.5x, 1.75x, 2.0x, 2.25x)
725+
function manyreturntest(x)
726+
s = zero(eltype(x))
727+
for j eachindex(x)
728+
a, b, c, d, e, f, g, h, i = ninereturns(x[j])
729+
s += a * i + b * h + c * g - d
730+
end
731+
s
732+
end
733+
function manyreturntestavx(x)
734+
s = zero(eltype(x))
735+
@avx for j eachindex(x)
736+
a, b, c, d, e, f, g, h, i = ninereturns(x[j])
737+
s += a * i + b * h + c * g - d
738+
end
739+
s
740+
end
725741

726742

727743
for T (Float32, Float64)
@@ -927,7 +943,9 @@ end
927943
R .+= randn.(T); Rc = copy(R);
928944
@test maxavx!(R, Q, true) == max.(vec(maximum(Q, dims=(2,3))), Rc)
929945

930-
U0 = randn(5,7); E0 = randn(7);
946+
@test manyreturntest(R) manyreturntestavx(R)
947+
948+
U0 = randn(T, 5, 7); E0 = randn(T, 7);
931949
U1, E1 = splitintonoloop_reference(copy(U0), copy(E0));
932950
U2, E2 = splitintonoloop(copy(U0), copy(E0));
933951
@test U1 U2

0 commit comments

Comments
 (0)