| 5 | using namespace xsched::preempt; |
| 6 | |
| 7 | LaunchWorker::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 | |
| 24 | LaunchWorker::~LaunchWorker() |
| 25 | { |
nothing calls this directly
no test coverage detected