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.
please initialize it at decl.