[PATCH] D139232: [ModuleInliner] Add memorization to MLPriority

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 14:59:51 PST 2022


kazu created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds memoization to MLPriority.

The trainer will inject noise, but we don't want the priority function
to produce different values for a given metric input.  The reason is
that we could potentially evaluate the priority of a call site over
and over to maintain the priority queue, and it's possible that no
metric has changed since the last evaluation.

Without this patch, Priority is the same as Cost, so we've never
bothered to rename Cost to Priority until now.  In future, Priority
will be computed by an ML model, so the mental model is:

  Priority = MLModel(Cost);

However, since we don't want to produce different outputs for a given
input, we add memorization as:

  Priority = MemoisedMLModel(Cost);

where MemoisedMLModel calls MLModel whenever we encounter a given
value of Cost for the first time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139232

Files:
  llvm/lib/Analysis/InlineOrder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139232.479753.patch
Type: text/x-patch
Size: 3212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/3e8de8eb/attachment.bin>


More information about the llvm-commits mailing list