From f50d7a420a5ac4a4788a5cb1fb891663810c5f6f Mon Sep 17 00:00:00 2001 From: Philippe Tillet Date: Mon, 15 Jul 2019 21:16:50 -0700 Subject: [PATCH] [runtime/jit] fixed bug in multi-threaded auto-tuning --- lib/dnn/shift.cpp | 2 +- lib/runtime/jit.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dnn/shift.cpp b/lib/dnn/shift.cpp index 87aaf32cb..d06366550 100644 --- a/lib/dnn/shift.cpp +++ b/lib/dnn/shift.cpp @@ -317,7 +317,7 @@ const tunable int32 TM = {16, 32, 64, 128}; const tunable int32 TN = {16, 32, 64, 128}; const tunable int32 TK = {)" + std::to_string(TK_) + "};"; if(op_ == WGRAD) - result += "const tunable int32 GZ = {1, 4, 16};"; + result += "const tunable int32 GZ = {1};"; else result += "const tunable int32 GZ = {1};"; diff --git a/lib/runtime/jit.cpp b/lib/runtime/jit.cpp index 15d33b029..fa970653a 100644 --- a/lib/runtime/jit.cpp +++ b/lib/runtime/jit.cpp @@ -43,8 +43,8 @@ void loop_nest(std::vector const & ranges, size_t current = 0; while(true){ //Execute function -// pool.add_job([values, &f](){ f(values); }); - f(values); + pool.add_job([values, &f](){ f(values); }); +// f(values); //Increment counters while(values[i]++ == ranges[i] - 1){ 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 module(driver::module::create(driver_context_, &*ll_module)); std::unique_ptr kernel(driver::kernel::create(module.get(), name)); double perf; - perf = benchmark(kernel.get(), info); { std::lock_guard lock(mutex); + perf = benchmark(kernel.get(), info); if(perf > best.perf){ best.perf = perf; best.params = params;