[runtime/jit] fixed bug in multi-threaded auto-tuning

This commit is contained in:
Philippe Tillet
2019-07-15 21:16:50 -07:00
parent aa8bcf6bde
commit f50d7a420a
2 changed files with 4 additions and 4 deletions

View File

@@ -317,7 +317,7 @@ const tunable int32 TM = {16, 32, 64, 128};
const tunable int32 TN = {16, 32, 64, 128}; const tunable int32 TN = {16, 32, 64, 128};
const tunable int32 TK = {)" + std::to_string(TK_) + "};"; const tunable int32 TK = {)" + std::to_string(TK_) + "};";
if(op_ == WGRAD) if(op_ == WGRAD)
result += "const tunable int32 GZ = {1, 4, 16};"; result += "const tunable int32 GZ = {1};";
else else
result += "const tunable int32 GZ = {1};"; result += "const tunable int32 GZ = {1};";

View File

@@ -43,8 +43,8 @@ void loop_nest(std::vector<size_t> const & ranges,
size_t current = 0; size_t current = 0;
while(true){ while(true){
//Execute function //Execute function
// pool.add_job([values, &f](){ f(values); }); pool.add_job([values, &f](){ f(values); });
f(values); // f(values);
//Increment counters //Increment counters
while(values[i]++ == ranges[i] - 1){ while(values[i]++ == ranges[i] - 1){
if(i == 0) if(i == 0)
@@ -210,9 +210,9 @@ jit::tune_res_t jit::autotune(const char *name, const char *src, benchmark_t ben
std::unique_ptr<driver::module> module(driver::module::create(driver_context_, &*ll_module)); std::unique_ptr<driver::module> module(driver::module::create(driver_context_, &*ll_module));
std::unique_ptr<driver::kernel> kernel(driver::kernel::create(module.get(), name)); std::unique_ptr<driver::kernel> kernel(driver::kernel::create(module.get(), name));
double perf; double perf;
perf = benchmark(kernel.get(), info);
{ {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
perf = benchmark(kernel.get(), info);
if(perf > best.perf){ if(perf > best.perf){
best.perf = perf; best.perf = perf;
best.params = params; best.params = params;