Skip to content

Commit 3ef16fb

Browse files
committed
Minor cost adjustment (reducing benefit of load elimination)...
1 parent 74a81a0 commit 3ef16fb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/modeling/determinestrategy.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function cost(ls::LoopSet, op::Operation, (u₁,u₂)::Tuple{Symbol,Symbol}, vlo
114114
# Also, once more SVE (scalable vector extension) CPUs are released, would be nice to know if
115115
# this feature is common to all of them.
116116
srt += 0.5reg_size(ls) / cache_lnsze(ls)
117+
# srt += 0.25reg_size(ls) / cache_lnsze(ls)
117118
end
118119
elseif isstore(op) # broadcast or reductionstore; if store we want to penalize reduction
119120
srt *= 3
@@ -798,6 +799,7 @@ function load_elimination_cost_factor!(
798799
@unpack u₁loopsym, u₂loopsym, vloopsym = unrollsyms
799800
if !iszero(first(isoptranslation(ls, op, unrollsyms)))
800801
rt, lat, rp = cost(ls, op, (u₁loopsym, u₂loopsym), vloopsym, Wshift, size_T)
802+
# rt = Core.ifelse(isvectorized(op), 0.5rt, rt)
801803
rto = rt
802804
rt *= iters
803805
# rt *= factor1; rp *= factor2;
@@ -818,7 +820,9 @@ function load_elimination_cost_factor!(
818820
# # (0.25, dynamic_register_count() == 32 ? 1.2 : 1.0)
819821
# (0.25, 1.0)
820822
# cost_vec[1] -= rt
821-
cost_vec[1] -= 0.5625 * iters
823+
# cost_vec[1] -= 0.5625 * iters
824+
# cost_vec[1] -= 0.5625 * iters / 2
825+
# @show rto, 0.8rt, op
822826
reg_pressure[1] += 0.25rp
823827
cost_vec[2] += rt
824828
reg_pressure[2] += rp
@@ -924,7 +928,7 @@ function evaluate_cost_tile(ls::LoopSet, order::Vector{Symbol}, unrollsyms::Unro
924928
nops = length(operations(ls))
925929
iters = Vector{Float64}(undef, nops)
926930
reduced_by_unrolling = Array{Bool}(undef, 2, 2, nops)
927-
evaluate_cost_tile!(iters, reduced_bu_unrolling, ls, order, unrollsyms, anyisbit)
931+
evaluate_cost_tile!(iters, reduced_by_unrolling, ls, order, unrollsyms, anyisbit)
928932
end
929933
function evaluate_cost_tile!(
930934
iters::Vector{Float64}, reduced_by_unrolling::Array{Bool,3}, ls::LoopSet, order::Vector{Symbol}, unrollsyms::UnrollSymbols, anyisbit::Bool
@@ -1062,6 +1066,7 @@ function evaluate_cost_tile!(
10621066
rp = opisininnerloop ? rp : zero(rp) # we only care about register pressure within the inner most loop
10631067
rto = rt
10641068
rt *= iters[id]
1069+
# @show (u₁reducesrt, u₂reducesrt), rto, rt, lat, rp, op
10651070
if isstore(op) & (!u₁reducesrt) & (!u₂reducesrt)
10661071
irreducible_storecosts += rt
10671072
end

0 commit comments

Comments
 (0)