Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLCSE: fix MCMC and GatherFeatures, overwrite dumps #395

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/jit-rl-cse/MLCSE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static void PolicyGradient(IEnumerable<Method> methods)
// number of times we cycle through the methods
int nRounds = Get(s_commands.NumberOfRounds);
// how many trials per method each cycle (minibatch)
int nIter =Get(s_commands.MinibatchSize);
int nIter = Get(s_commands.MinibatchSize);
// how often to show results
bool showEvery = Get(s_commands.ShowRounds);
uint showEveryInterval = Get(s_commands.ShowRoundsInterval);
Expand Down Expand Up @@ -622,10 +622,20 @@ static void PolicyGradient(IEnumerable<Method> methods)
QVDumpDot(method, s);
}

// Dump dasm/dump if we don't have one already
// Write out dasm/dump for method with this sequence, and baseline.
// Overwrite method dumps every so often, so we see fresh likelihood computations.
// Dasm and baselines should not change so initial ones are fine.
//
bool shouldOverwriteDump = (r > 0) && (summaryInterval > 0) && (r % (4 * summaryInterval) == summaryInterval);

string cleanSequence = updateSequence.Replace(',', '_');
string dumpFile = Path.Combine(dumpDir, $"dump-{method.spmiIndex}-{cleanSequence}.d");

if (shouldOverwriteDump && File.Exists(dumpFile))
{
File.Delete(dumpFile);
}

if (!File.Exists(dumpFile))
{
List<string> dumpOptions = new List<string>(updateOptions);
Expand Down Expand Up @@ -801,7 +811,6 @@ static void PolicyGradient(IEnumerable<Method> methods)
Console.Write($" B:{MetricsParser.GetBaseLikelihoods(batchRuns[lastValidRun]),-60}");
}
}
Console.Write(batchDetails[lastValidRun]);
Console.ResetColor();
}
}
Expand Down Expand Up @@ -1022,7 +1031,7 @@ static void MCMC(IEnumerable<Method> methods)
// Show each method's summary
bool showEachCase = Get(s_commands.ShowEachMethod);
// show each particular trial result
bool showEachRun = Get(s_commands.ShowEachRun);
bool showEachRun = Get(s_commands.ShowEachMCMCRun);
// Show the Markov Chain
bool showMC = Get(s_commands.ShowMarkovChain);
// Draw the Markov Chain (tree)
Expand Down
3 changes: 3 additions & 0 deletions src/jit-rl-cse/MLCSECommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public MLCSECommands(string[] args) : base("Use ML to explore JIT CSE Heuristics
Options.Add(UseSpecificMethods);
Options.Add(UseAdditionalMethods);

Options.Add(GatherFeatures);

Options.Add(DoMCMC);
Options.Add(RememberMCMC);
Options.Add(ShowEachMethod);
Options.Add(ShowEachMCMCRun);
Expand Down