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

Method SetLaunchConfig

preempt/src/xqueue/async_xqueue.cpp:176–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void AsyncXQueue::SetLaunchConfig(int64_t threshold, int64_t batch_size)
177{
178 if (threshold <= 0 && batch_size <= 0) return;
179
180 // Check command threshold.
181 if (threshold <= 0) {
182 threshold = launch_worker_->GetThreshold();
183 } else {
184 XASSERT(this->GetFeatures(kQueueFeatureDynamicThreshold),
185 "AsyncXQueue does not support dynamic threshold");
186 }
187
188 // Check command batch size.
189 if (batch_size <= 0) {
190 batch_size = launch_worker_->GetBatchSize();
191 } else {
192 XASSERT(this->GetFeatures(kQueueFeatureDynamicBatchSize),
193 "AsyncXQueue does not support dynamic batch size");
194 }
195
196 // Check threshold and batch size are valid.
197 XASSERT(threshold >= batch_size,
198 "command threshold (" FMT_64D ") must not be smaller than "
199 "command batch size (" FMT_64D ")", threshold, batch_size);
200
201 // Not thread-safe.
202 // TODO: change to thread-safe
203 this->WaitAll();
204 launch_worker_->SetLaunchConfig(threshold, batch_size);
205 SchedAgent::SendEvent(std::make_shared<XQueueConfigUpdateEvent>(kHandle, kDevice, level_,
206 launch_worker_->GetThreshold(), launch_worker_->GetBatchSize()));
207}

Callers 1

XQueueSetLaunchConfigFunction · 0.45

Calls 4

WaitAllMethod · 0.95
GetThresholdMethod · 0.80
GetFeaturesMethod · 0.80
GetBatchSizeMethod · 0.80

Tested by

no test coverage detected