tensorflow/compiler/mlir/tfrt/jit/tf_jitrt_kernels.cc
// -------------------------------------------------------------------------- //
// JIT compiled kernels use Eigen ThreadPool managed by the kernel fallback as
// an async runtime worker threads.
// -------------------------------------------------------------------------- //
JIT compiled kernels use Eigen ThreadPool managed by the kernel fallback as
an async runtime worker threads.
JIT compiled kernels use Eigen ThreadPool managed by the kernel fallback as an async runtime worker threads .
static Expected<Eigen::ThreadPoolInterface*> GetWorkerThreads(
    const ExecutionContext& exec_ctx) {
  RequestContext* req_ctx = exec_ctx.request_ctx();
  auto* fallback = req_ctx->GetDataIfExists<KernelFallbackCompatRequestState>();
  if (LLVM_UNLIKELY(!fallback))
    return MakeStringError("fallback request state was not found");
  if (LLVM_LIKELY(fallback->intra_op_threadpool()))
    return fallback->intra_op_threadpool();
  Device* host_cpu = fallback->device_manager().HostCPU();
  assert(host_cpu && "fallback state must have a valid host cpu device");
  const Eigen::ThreadPoolDevice* eigen = host_cpu->eigen_cpu_device();
  assert(eigen && "host cpu device must have a valid Eigen thread pool device");
  return eigen->getPool();
}
static Expected < Eigen :: ThreadPoolInterface * > GetWorkerThreads ( const ExecutionContext & exec_ctx ) { RequestContext * req_ctx = exec_ctx . request_ctx ( ) ; auto * fallback = req_ctx -> GetDataIfExists < KernelFallbackCompatRequestState > ( ) ; if ( LLVM_UNLIKELY ( ! fallback ) ) return MakeStringError ( " " ) ; if ( LLVM_LIKELY ( fallback -> intra_op_threadpool ( ) ) ) return fallback -> intra_op_threadpool ( ) ; Device * host_cpu = fallback -> device_manager ( ) . HostCPU ( ) ; assert ( host_cpu && " " ) ; const Eigen :: ThreadPoolDevice * eigen = host_cpu -> eigen_cpu_device ( ) ; assert ( eigen && " " ) ; return eigen -> getPool ( ) ; }
JIT compiled kernels use Eigen ThreadPool managed by the kernel fallback as
an async runtime worker threads.
JIT compiled kernels use Eigen ThreadPool managed by the kernel fallback as an async runtime worker threads .
// Return user provided intra op thread pool if it is available. // Otherwise find the default CPU device in the device manager.