Commit a3a12bb6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Reenable tier 2 for now

We should do a more comprehensive investigation.  Removing t2 caused
regressions on a number of benchmarks since we lost chances to do
speculations, but making t3 easier to get to caused regressions
due to the cost of our LLVM optimization set (which is pretty hefty
since it's supposed to be hard to activate).
parent fb70753e
......@@ -522,8 +522,14 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
= emitter->getBuilder()->CreateAdd(cur_call_count, getConstantInt(1, g.i64));
emitter->getBuilder()->CreateStore(new_call_count, call_count_ptr);
assert(effort == EffortLevel::MINIMAL);
int reopt_threshold = REOPT_THRESHOLD_BASELINE;
int reopt_threshold;
if (effort == EffortLevel::MINIMAL)
reopt_threshold = REOPT_THRESHOLD_BASELINE;
else if (effort == EffortLevel::MODERATE)
reopt_threshold = REOPT_THRESHOLD_T2;
else
RELEASE_ASSERT(0, "Unknown effort: %d", (int)effort);
llvm::Value* reopt_test
= emitter->getBuilder()->CreateICmpSGT(new_call_count, getConstantInt(reopt_threshold, g.i64));
......@@ -950,7 +956,7 @@ CompiledFunction* doCompile(SourceInfo* source, ParamNames* param_names, const O
irgen_us += _t2.split();
TypeAnalysis::SpeculationLevel speculation_level = TypeAnalysis::NONE;
EffortLevel min_speculation_level = EffortLevel::MAXIMAL;
EffortLevel min_speculation_level = EffortLevel::MODERATE;
if (ENABLE_SPECULATION && effort >= min_speculation_level)
speculation_level = TypeAnalysis::SOME;
TypeAnalysis* types;
......
......@@ -192,8 +192,8 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
ss << ") -> ";
ss << spec->rtn_type->debugName();
} else {
ss << "\nDoing OSR-entry partial compile of " << name << ", starting with backedge to block "
<< entry_descriptor->backedge->target->idx << '\n';
ss << "\033[34;1mDoing OSR-entry partial compile of " << name << ", starting with backedge to block "
<< entry_descriptor->backedge->target->idx;
}
ss << " at effort level " << (int)effort;
ss << "\033[0m";
......@@ -252,6 +252,13 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
num_compiles.log();
break;
}
case EffortLevel::MODERATE: {
static StatCounter us_compiling("us_compiling_2_moderate");
us_compiling.log(us);
static StatCounter num_compiles("num_compiles_2_moderate");
num_compiles.log();
break;
}
case EffortLevel::MAXIMAL: {
static StatCounter us_compiling("us_compiling_3_maximal");
us_compiling.log(us);
......@@ -420,6 +427,8 @@ extern "C" CompiledFunction* reoptCompiledFuncInternal(CompiledFunction* cf) {
if (cf->effort == EffortLevel::INTERPRETED)
new_effort = EffortLevel::MINIMAL;
else if (cf->effort == EffortLevel::MINIMAL)
new_effort = EffortLevel::MODERATE;
else if (cf->effort == EffortLevel::MODERATE)
new_effort = EffortLevel::MAXIMAL;
else
RELEASE_ASSERT(0, "unknown effort: %d", cf->effort);
......
......@@ -1751,8 +1751,15 @@ private:
llvm::Value* newcount = emitter.getBuilder()->CreateAdd(curcount, getConstantInt(1, g.i64));
emitter.getBuilder()->CreateStore(newcount, edgecount_ptr);
assert(irstate->getEffortLevel() == EffortLevel::MINIMAL);
llvm::Value* osr_test = emitter.getBuilder()->CreateICmpSGT(newcount, getConstantInt(OSR_THRESHOLD_BASELINE));
auto effort = irstate->getEffortLevel();
int osr_threshold;
if (effort == EffortLevel::MINIMAL)
osr_threshold = OSR_THRESHOLD_BASELINE;
else if (effort == EffortLevel::MODERATE)
osr_threshold = OSR_THRESHOLD_T2;
else
RELEASE_ASSERT(0, "Unknown effort: %d", (int)effort);
llvm::Value* osr_test = emitter.getBuilder()->CreateICmpSGT(newcount, getConstantInt(osr_threshold));
llvm::Metadata* md_vals[]
= { llvm::MDString::get(g.context, "branch_weights"), llvm::ConstantAsMetadata::get(getConstantInt(1)),
......
......@@ -43,7 +43,9 @@ bool USE_REGALLOC_BASIC = true;
int OSR_THRESHOLD_INTERPRETER = 200;
int REOPT_THRESHOLD_INTERPRETER = 100;
int OSR_THRESHOLD_BASELINE = 10000;
int REOPT_THRESHOLD_BASELINE = 2500;
int REOPT_THRESHOLD_BASELINE = 250;
int OSR_THRESHOLD_T2 = 10000;
int REOPT_THRESHOLD_T2 = 10000;
int SPECULATION_THRESHOLD = 100;
static bool _GLOBAL_ENABLE = 1;
......
......@@ -33,6 +33,7 @@ extern int MAX_OPT_ITERATIONS;
extern int OSR_THRESHOLD_INTERPRETER, REOPT_THRESHOLD_INTERPRETER;
extern int OSR_THRESHOLD_BASELINE, REOPT_THRESHOLD_BASELINE;
extern int OSR_THRESHOLD_T2, REOPT_THRESHOLD_T2;
extern int SPECULATION_THRESHOLD;
extern bool SHOW_DISASM, FORCE_INTERPRETER, FORCE_OPTIMIZE, PROFILE, DUMPJIT, TRAP, USE_STRIPPED_STDLIB,
......
......@@ -99,7 +99,8 @@ using gc::GCVisitor;
enum class EffortLevel {
INTERPRETED = 0,
MINIMAL = 1,
MAXIMAL = 3, // keep the old tier numbering for familiarity
MODERATE = 2,
MAXIMAL = 3,
};
class CompilerType;
......
......@@ -9,10 +9,13 @@
import subprocess
import threading
print_lock = threading.Lock()
def worker(id):
for i in xrange(100):
subprocess.check_call(["true"])
print "done"
with print_lock:
print "done"
threads = []
for i in xrange(4):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment