[PATCH] D115195: [mlgo][regalloc] Add score calculation for training

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:23:44 PDT 2022


mtrofin added a comment.

In D115195#3724398 <https://reviews.llvm.org/D115195#3724398>, @MatzeB wrote:

> I know this review comes pretty late, but FWIW: It seems unfortunate to me that we now have one code path producing optimization remarks in `RAGreedy::computeStats`, while the separate counting formula here is independent of regalloc algorithm but cannot produce optimization remarks for analysis / comparison with non-ML approaches...

Ack - I thought I left a FIXME somewhere about this, probably forgot to. In any case, the intent is to unify them somehow.



================
Comment at: llvm/lib/CodeGen/RegAllocScore.cpp:32-33
+cl::opt<double> CopyWeight("regalloc-copy-weight", cl::init(0.2), cl::Hidden);
+cl::opt<double> LoadWeight("regalloc-load-weight", cl::init(4.0), cl::Hidden);
+cl::opt<double> StoreWeight("regalloc-store-weight", cl::init(1.0), cl::Hidden);
+cl::opt<double> CheapRematWeight("regalloc-cheap-remat-weight", cl::init(0.2),
----------------
MatzeB wrote:
> What's the reasoning for loads having weight `4.0` compared to stores being just `1.0`? This feels like way too much emphasis on loads.
Loads would tend to block the execution pipeline, while stores wouldn't. More importantly, experimentally, this got us a reward that moved the needle best (we were surprised, too - we expected the load/store ratio to be a bit lower)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115195



More information about the llvm-commits mailing list