Skip to content

Commit

Permalink
JIT: refactor CSE to allow running greedy ML heuristic in release (do…
Browse files Browse the repository at this point in the history
…tnet#98729)

Revise things a bit so that we can run the greedy ML heuristic in release mode,
with a built-in set of "good" parameters.

These parameters come from a policy gradient run over a 200 method training
set, on the asp.net windows x64 collection.

Contributes to dotnet#92915.
  • Loading branch information
AndyAyersMS authored Feb 21, 2024
1 parent 7403a06 commit 52dbf81
Show file tree
Hide file tree
Showing 4 changed files with 681 additions and 527 deletions.
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,7 @@ class Compiler
friend class CSE_HeuristicRandom;
friend class CSE_HeuristicReplay;
friend class CSE_HeuristicRL;
friend class CSE_HeuristicParameterized;
friend class CSE_Heuristic;
friend class CodeGenInterface;
friend class CodeGen;
Expand Down
17 changes: 9 additions & 8 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@ CONFIG_INTEGER(JitConstCSE, W("JitConstCSE"), 0)
#define CONST_CSE_ENABLE_ALL 3
#define CONST_CSE_ENABLE_ALL_NO_SHARING 4

// If nonzero, use the greedy RL policy.
//
CONFIG_INTEGER(JitRLCSEGreedy, W("JitRLCSEGreedy"), 0)

// If nonzero, dump out details of parameterized policy evaluation and
// gradient updates
CONFIG_INTEGER(JitRLCSEVerbose, W("JitRLCSEVerbose"), 0)

#if defined(DEBUG)
// Allow fine-grained controls of CSEs done in a particular method
//
Expand Down Expand Up @@ -415,7 +423,7 @@ CONFIG_STRING(JitReplayCSE, W("JitReplayCSE"))
CONFIG_STRING(JitReplayCSEReward, W("JitReplayCSEReward"))

// When set, specifies the initial parameter string for
// a reinforcement-learning based CSE heuristic.
// the reinforcement-learning based CSE heuristic.
//
// Note you can also set JitReplayCSE and JitReplayCSEPerfScore
// along with this, in which case we are asking for a policy
Expand All @@ -426,16 +434,9 @@ CONFIG_STRING(JitRLCSE, W("JitRLCSE"))
// use in learning.
CONFIG_STRING(JitRLCSEAlpha, W("JitRLCSEAlpha"))

// If nonzero, dump out details of policy evaluation and
// gradient updates
CONFIG_INTEGER(JitRLCSEVerbose, W("JitRLCSEVerbose"), 0)

// If nonzero, dump candidate feature values
CONFIG_INTEGER(JitRLCSECandidateFeatures, W("JitRLCSECandidateFeatures"), 0)

// If nonzero, use the greedy policy with current parameters.
CONFIG_INTEGER(JitRLCSEGreedy, W("JitRLCSEGreedy"), 0)

#endif

///
Expand Down
Loading

0 comments on commit 52dbf81

Please sign in to comment.