[llvm] 76f2589 - [MLGO] Do not include urgent LRs in max cascade calculation (#120052)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 07:14:37 PST 2024


Author: Aiden Grossman
Date: 2024-12-16T07:14:34-08:00
New Revision: 76f258920d3baf32be297f60bee5b8520f195c25

URL: https://github.com/llvm/llvm-project/commit/76f258920d3baf32be297f60bee5b8520f195c25
DIFF: https://github.com/llvm/llvm-project/commit/76f258920d3baf32be297f60bee5b8520f195c25.diff

LOG: [MLGO] Do not include urgent LRs in max cascade calculation (#120052)

A previous PR introduced a threshold where we would mask out a LR that
had been evicted a certain number of times to combat pathological
compile time cases with a somewhat adversarial model. However, this
patch did not take into account urgent LRs which led to compilation
failures when greedy would expect us to provide an eviction and we could
not due to the newly introduced logic.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
index 23ab021c099456..9c6487b40d6061 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
@@ -654,8 +654,10 @@ bool MLEvictAdvisor::loadInterferenceFeatures(
       // There is a potential that the model could be adversarial and
       // continually evict live ranges over and over again, leading to a
       // large amount of compile time being spent in regalloc. If we hit the
-      // threshold, prevent the range from being evicted.
-      if (IntfCascade >= MaxCascade)
+      // threshold, prevent the range from being evicted. We still let the
+      // range through if it is urgent as we are required to produce an
+      // eviction if the candidate is not spillable.
+      if (IntfCascade >= MaxCascade && !Urgent)
         return false;
 
       // Only evict older cascades or live ranges without a cascade.


        


More information about the llvm-commits mailing list