40 static const int kDefaultNumThreadpoolThreads = 1;
51 const int target_num_threads =
53 _ruy_context->set_max_num_threads(target_num_threads);
56 ruy::Context *
ruy_context()
const {
return _ruy_context.get(); }
59 void initPerThreadState()
62 const int thread_count = _ruy_context->max_num_threads();
63 auto ctx = ruy::get_ctx(_ruy_context.get());
64 ctx->EnsureThreadSpecificResources(thread_count);
65 for (
int i = 0; i < thread_count; i++)
67 ctx->GetThreadSpecificTuningResolver(i)->SetTuning(ctx->explicit_tuning());
72 const std::unique_ptr<ruy::Context> _ruy_context;
const int kDefaultNumThreadpoolThreads
ruy::Context * ruy_context() const
void setMaxNumThreads(int max_num_threads)