[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:56 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.
+ if (Signature.Weight != 1) {
+ Signature.CachedGainLR *= static_cast<float>(Signature.Weight);
+ Signature.CachedGainRL *= static_cast<float>(Signature.Weight);
----------------
karim-alweheshy wrote:
Superseded by the sparse side-map design. Actual weighted runs multiply directly; absent or all-one maps dispatch to the original unweighted instantiation.
https://github.com/llvm/llvm-project/pull/213837
More information about the llvm-commits
mailing list