[PATCH] D131930: [mlgo] Add in-development instruction based features for regalloc advisor

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 16:44:17 PDT 2022


aidengrossman created this revision.
Herald added subscribers: mtrofin, mgrang, hiraditya, qcolombet, MatzeB.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds in instruction based features to the regalloc advisor
gated behind a flag so a user can decide at runtime whether or not they
want to enable the feature. The features are only enabled when LLVM is
compiled in MLGO develpment mode (LLVM_HAVE_TF_API) is set to true.

To extract the instruction features, I'm taking a list of segments from
each LiveInterval and noting the start and end SlotIndices. This list is then
sorted based on the start SlotIndex and I iterate through each SlotIndex
to grab instructions, making sure to check for overlaps. This results in
a vector of opcodes and binary mapping matrix that maps live ranges to the
opcodes of the instructions within that LR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131930

Files:
  llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
  llvm/test/CodeGen/MLRegalloc/Inputs/reference-log-noml-dev-features.txt
  llvm/test/CodeGen/MLRegalloc/dev-mode-extra-features-logging.ll



More information about the llvm-commits mailing list