[PATCH] D134166: [MLGO] Add per-instruction MBB frequencies to regalloc dev features

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 10:51:38 PDT 2022


aidengrossman added a comment.

> just so I understand, mbb_frequencies will be of shape (1, 100) and if there are less than 100 mbbs, the rest of the entries will be 0? and mbb_mapping will of shape (1, 300) and contains the indices of the mbb for each instruction?

Yes. Up to 100 MBBs have their frequency data stored and otherwise everything is zero padded. The mapping vector is intended to work exactly as you describe. I settled on 100 MBBs after monitoring a LLVM compile after setting up some debug logging to see how many MBBs there were in each eviction problem and didn't see any with more than 100.

> just a small question/nit: why use a one-hot encoding for the instruction opcode features but an index encoding for the frequencies?

I did this to give added flexibility in terms of how we integrate these features on the ML side. Currently just encoding a vector of length (1, ModelMaxSupportedInstructionCount) with the MBB frequencies would work for what I have been experimenting with, but if we want to do anything else in the future, the way this is setup gives added flexibility in that area (ie grouping instructions by MBB). This is the same reason I set up passing the instructions through an opcode vector and a binary mapping matrix rather than just passing the opcodes directly in a (33, 300) matrix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134166/new/

https://reviews.llvm.org/D134166



More information about the llvm-commits mailing list