Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

Glow:Executor投入


いつものように、Glowのソースコードを pull していたら、見つけました。

[Runtime Add runtime Executor class]


現在は、ここにあるように、
Executor *createExecutor(const Executor::DeviceManagerMapTy &deviceManagers,
                         ExecutorKind executorKind) {
  switch (executorKind) {
  case ExecutorKind::ThreadPool:
    return new ThreadPoolExecutor(deviceManagers);
  }

  // This is to make compiler happy. It can never reach this point as the switch
  // statement above always covers all possible values.
  llvm_unreachable("unreachable");
}

にあるちょうに、ThreadPoolExecutor のみだけどね。

この Executor は、HostManagerクラスのメンバーとして、働いてくれるようです。

HostManagerクラスのコンストラクタにて、
  executor_.reset(createExecutor(devices_));
Executorを生成して、runNetworkメソッドでは、runメソッドを実行しています。
  executor_->run(roots_[networkName].get(), std::move(context), currentRun,
                 [&activeRequest = this->activeRequestCount_,
                  callback](RunIdentifierTy runID, ResultCode result,
                            std::unique_ptr<Context> context) {
                   --activeRequest;
                   callback(runID, result, std::move(context));
                 });