Skip to content

Commit 7ceb604

Browse files
authored
RLCSE: fix MCMC and GatherFeatures, overwrite dumps (#395)
The JIT will append dumps to existing files, so using RLCSE to save dumps was creating large files (each sequence's dump is periodically updated to show the impact of the current parameters). Also I was going to make MCMC and such subcommands, but changed my mind, and forgot to hook the options back up.
1 parent 5b47b91 commit 7ceb604

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/jit-rl-cse/MLCSE.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static void PolicyGradient(IEnumerable<Method> methods)
376376
// number of times we cycle through the methods
377377
int nRounds = Get(s_commands.NumberOfRounds);
378378
// how many trials per method each cycle (minibatch)
379-
int nIter =Get(s_commands.MinibatchSize);
379+
int nIter = Get(s_commands.MinibatchSize);
380380
// how often to show results
381381
bool showEvery = Get(s_commands.ShowRounds);
382382
uint showEveryInterval = Get(s_commands.ShowRoundsInterval);
@@ -622,10 +622,20 @@ static void PolicyGradient(IEnumerable<Method> methods)
622622
QVDumpDot(method, s);
623623
}
624624

625-
// Dump dasm/dump if we don't have one already
625+
// Write out dasm/dump for method with this sequence, and baseline.
626+
// Overwrite method dumps every so often, so we see fresh likelihood computations.
627+
// Dasm and baselines should not change so initial ones are fine.
626628
//
629+
bool shouldOverwriteDump = (r > 0) && (summaryInterval > 0) && (r % (4 * summaryInterval) == summaryInterval);
630+
627631
string cleanSequence = updateSequence.Replace(',', '_');
628632
string dumpFile = Path.Combine(dumpDir, $"dump-{method.spmiIndex}-{cleanSequence}.d");
633+
634+
if (shouldOverwriteDump && File.Exists(dumpFile))
635+
{
636+
File.Delete(dumpFile);
637+
}
638+
629639
if (!File.Exists(dumpFile))
630640
{
631641
List<string> dumpOptions = new List<string>(updateOptions);
@@ -801,7 +811,6 @@ static void PolicyGradient(IEnumerable<Method> methods)
801811
Console.Write($" B:{MetricsParser.GetBaseLikelihoods(batchRuns[lastValidRun]),-60}");
802812
}
803813
}
804-
Console.Write(batchDetails[lastValidRun]);
805814
Console.ResetColor();
806815
}
807816
}
@@ -1022,7 +1031,7 @@ static void MCMC(IEnumerable<Method> methods)
10221031
// Show each method's summary
10231032
bool showEachCase = Get(s_commands.ShowEachMethod);
10241033
// show each particular trial result
1025-
bool showEachRun = Get(s_commands.ShowEachRun);
1034+
bool showEachRun = Get(s_commands.ShowEachMCMCRun);
10261035
// Show the Markov Chain
10271036
bool showMC = Get(s_commands.ShowMarkovChain);
10281037
// Draw the Markov Chain (tree)

src/jit-rl-cse/MLCSECommands.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public MLCSECommands(string[] args) : base("Use ML to explore JIT CSE Heuristics
133133
Options.Add(UseSpecificMethods);
134134
Options.Add(UseAdditionalMethods);
135135

136+
Options.Add(GatherFeatures);
137+
138+
Options.Add(DoMCMC);
136139
Options.Add(RememberMCMC);
137140
Options.Add(ShowEachMethod);
138141
Options.Add(ShowEachMCMCRun);

0 commit comments

Comments
 (0)