MCPcopy Create free account
hub / github.com/ROCm/clr / getLastQueuedCommand

Method getLastQueuedCommand

rocclr/platform/commandqueue.cpp:359–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359Command* HostQueue::getLastQueuedCommand(bool retain) {
360 if (AMD_DIRECT_DISPATCH) {
361 // The batch update must be lock protected to avoid a race condition
362 // when multiple threads submit/flush/update the batch at the same time
363 ScopedLock sl(vdev()->execution());
364 // Since the lastCmdLock_ is acquired, it is safe to read and retain the lastEnqueueCommand.
365 // It is guaranteed that the pointer will not change.
366 if (retain && lastEnqueueCommand_ != nullptr) {
367 lastEnqueueCommand_->retain();
368 }
369 return lastEnqueueCommand_;
370 } else {
371 // Get last submitted command
372 ScopedLock l(lastCmdLock_);
373
374 // Since the lastCmdLock_ is acquired, it is safe to read and retain the lastEnqueueCommand.
375 // It is guaranteed that the pointer will not change.
376 if (retain && lastEnqueueCommand_ != nullptr) {
377 lastEnqueueCommand_->retain();
378 }
379 return lastEnqueueCommand_;
380 }
381}
382
383DeviceQueue::~DeviceQueue() {
384 delete virtualDevice_;

Callers 12

WaitActiveStreamsMethod · 0.80
EnqueueCommandsMethod · 0.80
ihipMemcpyCommandFunction · 0.80
ihipMemcpyFunction · 0.80
ihipMemcpyDtoDCommandFunction · 0.80
ihipMemcpyDtoHCommandFunction · 0.80
ihipMemcpyHtoACommandFunction · 0.80
ihipMemcpyAtoHCommandFunction · 0.80
ihipMemcpyCmdEnqueueFunction · 0.80
hipStreamQuery_commonFunction · 0.80
streamCallback_commonFunction · 0.80
RunNodesMethod · 0.80

Calls 1

retainMethod · 0.45

Tested by

no test coverage detected