[lld] [llvm] [llvm][lld] Respect temporal profile weights in balanced partitioning (PR #213837)
Karim Alweheshy via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 15:45:57 PDT 2026
================
@@ -227,6 +241,14 @@ unsigned BalancedPartitioning::runIteration(const FunctionNodeRange Nodes,
Signature.CachedGainLR = Cost - logCost(L - 1, R + 1);
if (R > 0)
Signature.CachedGainRL = Cost - logCost(L + 1, R - 1);
+ // Scaling a utility's move gain is mathematically equivalent to adding
+ // Weight distinct utility nodes with the same signature, but avoids
+ // expanding the graph. Weight == 1 deliberately takes no FP operation so
+ // unweighted inputs preserve their previous behavior.
----------------
karim-alweheshy wrote:
The equivalence is to Weight distinct utility nodes that have the same signature, so the total move gain is the sum of Weight identical per-utility gains. It does not scale L and R inside logCost. WeightedUtilitiesMatchReplication now checks the exact weighted-versus-explicit-replication order.
https://github.com/llvm/llvm-project/pull/213837
More information about the llvm-commits
mailing list