Skip to content

Commit

Permalink
Fixed segfault when command-queue-type does not match type at time of…
Browse files Browse the repository at this point in the history
… event recording
mikex86 committed Sep 7, 2024
1 parent 4525094 commit e456bb2
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions driverapi/internal/cmdqueue.h
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ struct CommandQueuePage {

/**
* Pointer into commandQueuePage. Commands are mem-copied in appending fashion into the command queue page and
* commandWritePtr is used to keep track of the current offset from the base pointer.
* commandWritePtr is used to keep trackFlops of the current offset from the base pointer.
*/
uint64_t commandWriteIdx = 0;

@@ -194,7 +194,7 @@ class NvCommandQueue {

libreCudaStatus_t waitForEvent(LibreCUEvent event);

libreCudaStatus_t getEventTimestamp(LibreCUEvent event, uint64_t *pTimestampOut);
static libreCudaStatus_t getEventTimestamp(LibreCUEvent event, uint64_t *pTimestampOut);

private:

4 changes: 2 additions & 2 deletions driverapi/src/cmdqueue.cpp
Original file line number Diff line number Diff line change
@@ -944,10 +944,10 @@ libreCudaStatus_t NvCommandQueue::getEventTimestamp(LibreCUEvent event, uint64_t
LIBRECUDA_VALIDATE(pTimestampOut != nullptr, LIBRECUDA_ERROR_INVALID_VALUE);
LIBRECUDA_VALIDATE(event->stream != nullptr, LIBRECUDA_ERROR_INVALID_VALUE);
LIBRECUDA_VALIDATE(event->computeSignal != nullptr || event->dmaSignal != nullptr, LIBRECUDA_ERROR_INVALID_VALUE);
if (currentQueueType == COMPUTE) {
if (event->computeSignal != nullptr) {
LIBRECUDA_VALIDATE(event->computeSignal->value == 1, LIBRECUDA_ERROR_NOT_READY); // event was not hit yet
*pTimestampOut = event->computeSignal->time_stamp;
} else if (currentQueueType == DMA) {
} else if (event->dmaSignal != nullptr) {
LIBRECUDA_VALIDATE(event->dmaSignal->value == 1, LIBRECUDA_ERROR_NOT_READY); // event was not hit yet
*pTimestampOut = event->dmaSignal->time_stamp;
}

0 comments on commit e456bb2

Please sign in to comment.