[llvm] [mlir] [MLGO] Do not hardcode 33 eviction feature columns (PR #224598)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 03:30:58 PDT 2026


================
@@ -33,20 +33,15 @@ struct LRStartEndInfo {
   size_t Pos = 0;
 };
 
-// This is the maximum number of interfererring ranges. That's the number of
-// distinct AllocationOrder values, which comes from MCRegisterClass::RegsSize.
-// For X86, that's 32.
-// TODO: find a way to get this, statically, in a programmatic way.
-static const int64_t MaxInterferences = 32;
-
 // Logically, we can think of the feature set given to the evaluator as a 2D
 // matrix. The rows are the features (see next). The columns correspond to the
 // interferences. We treat the candidate virt reg as an 'interference', too, as
 // its feature set is the same as that of the interferring ranges. So we'll have
-// MaxInterferences + 1 columns and by convention, we will use the last column
-// for the virt reg seeking allocation.
-static const int64_t CandidateVirtRegPos = MaxInterferences;
-static const int64_t NumberOfInterferences = CandidateVirtRegPos + 1;
+// one column per allocation order slot, plus one, and by convention, we will
+// use the last column for the virt reg seeking allocation.
+// The advisor computes the column count per target. Changing this constant
+// requires regenerating the precompiled test models.
+static const int64_t CompiledModelNumColumns = 33;
----------------
aobolensk wrote:

I addressed that in place in the last commit. Please, take a look

https://github.com/llvm/llvm-project/pull/224598


More information about the llvm-commits mailing list