diff options
author | Håvard Pettersen <havardpe@oath.com> | 2020-05-19 14:22:00 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2020-05-19 14:49:30 +0000 |
commit | cdee9f2f3471fa018eadde13e1300a882a327460 (patch) | |
tree | d9211f923e210456abbb461a680934dda3467fe1 /eval | |
parent | 89e26b2fe42a1fd88957ec76c5e1d1532d03b380 (diff) |
let compile cache use shared proton executor
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/tests/eval/compile_cache/compile_cache_test.cpp | 3 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/llvm/compile_cache.cpp | 21 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/llvm/compile_cache.h | 1 |
3 files changed, 24 insertions, 1 deletions
diff --git a/eval/src/tests/eval/compile_cache/compile_cache_test.cpp b/eval/src/tests/eval/compile_cache/compile_cache_test.cpp index 5176a4b3e94..1de56e605c9 100644 --- a/eval/src/tests/eval/compile_cache/compile_cache_test.cpp +++ b/eval/src/tests/eval/compile_cache/compile_cache_test.cpp @@ -275,6 +275,7 @@ TEST_F("compile sequentially, then run all conformance tests", test::EvalSpec()) auto t0 = steady_clock::now(); f1.each_case(test); auto t1 = steady_clock::now(); + CompileCache::wait_pending(); auto t2 = steady_clock::now(); test.verify(); auto t3 = steady_clock::now(); @@ -295,7 +296,7 @@ TEST_F("compile concurrently (8 threads), then run all conformance tests", test: auto t0 = steady_clock::now(); f1.each_case(test); auto t1 = steady_clock::now(); - executor.sync(); + CompileCache::wait_pending(); auto t2 = steady_clock::now(); test.verify(); auto t3 = steady_clock::now(); diff --git a/eval/src/vespa/eval/eval/llvm/compile_cache.cpp b/eval/src/vespa/eval/eval/llvm/compile_cache.cpp index 9a262f6dca5..4aa18d3bb65 100644 --- a/eval/src/vespa/eval/eval/llvm/compile_cache.cpp +++ b/eval/src/vespa/eval/eval/llvm/compile_cache.cpp @@ -77,6 +77,27 @@ CompileCache::compile(const Function &function, PassParams pass_params) return token; } +void +CompileCache::wait_pending() +{ + std::vector<Token::UP> pending; + { + std::lock_guard<std::mutex> guard(_lock); + for (auto entry = _cached.begin(); entry != _cached.end(); ++entry) { + if (entry->second.compiled_function.get() == nullptr) { + ++(entry->second.num_refs); + pending.push_back(std::make_unique<Token>(entry, Token::ctor_tag())); + } + } + } + { + for (const auto &token: pending) { + const CompiledFunction &fun = token->get(); + (void) fun; + } + } +} + size_t CompileCache::num_cached() { diff --git a/eval/src/vespa/eval/eval/llvm/compile_cache.h b/eval/src/vespa/eval/eval/llvm/compile_cache.h index aaadec772a5..09b5b2060f5 100644 --- a/eval/src/vespa/eval/eval/llvm/compile_cache.h +++ b/eval/src/vespa/eval/eval/llvm/compile_cache.h @@ -84,6 +84,7 @@ public: }; static Token::UP compile(const Function &function, PassParams pass_params); + static void wait_pending(); static ExecutorBinding::UP bind(Executor &executor) { return std::make_unique<ExecutorBinding>(executor, ExecutorBinding::ctor_tag()); } |