MCPcopy Create free account
hub / github.com/XpuOS/xsched / LaunchWorker

Method LaunchWorker

preempt/src/xqueue/launch_worker.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace xsched::preempt;
6
7LaunchWorker::LaunchWorker(std::shared_ptr<HwQueue> hwq, std::shared_ptr<CommandBuffer> buf,
8 XPreemptLevel level, int64_t threshold, int64_t batch_size)
9 : level_(level), threshold_(threshold), batch_size_(batch_size)
10 , kHwq(hwq), kCmdBuf(buf), mtx_(std::make_unique<MCSLock>())
11{
12 // In-flight commands threshold must not be smaller than command batch size.
13 // Otherwise, there could be no commands to wait if the in-flight commands reach the threshold.
14 XASSERT(threshold_ >= batch_size_, "threshold must not be smaller than command batch size");
15
16 worker_thread_ = std::make_unique<std::thread>([this](){
17 // Notify the HwQueue that an XQueue has created for it on the submitting thread.
18 // It can call platform specific APIs like cuCtxSetCurrent() in OnXQueueCreate().
19 this->kHwq->OnXQueueCreate();
20 this->WorkerLoop();
21 });
22}
23
24LaunchWorker::~LaunchWorker()
25{

Callers

nothing calls this directly

Calls 2

WorkerLoopMethod · 0.95
OnXQueueCreateMethod · 0.45

Tested by

no test coverage detected