SWDEV-327967 - Fix Segmentation fault in hipFree

Queue creation and release fails during hipFree causing seg fault
if the null queue was not created until then and there is no
device memory left.

Change-Id: I118b86b58e777dac5415bc9ba0c4e23c986efa7d
This commit is contained in:
Satyanvesh Dittakavi
2022-03-21 10:57:30 +00:00
والد 02838eb236
کامیت 4a90c3ccaf
2فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
+4 -1
مشاهده پرونده
@@ -101,7 +101,10 @@ hipError_t ihipFree(void *ptr)
}
} else {
// Wait on the device, associated with the current memory object
hip::getNullStream(memory_object->getContext())->finish();
amd::HostQueue* queue = hip::getNullStream(memory_object->getContext());
if (queue != nullptr) {
queue->finish();
}
deviceID = hip::getDeviceID(memory_object->getContext());
}
hip::Stream::syncNonBlockingStreams(deviceID);
+3 -1
مشاهده پرونده
@@ -110,7 +110,9 @@ bool Stream::Create() {
queue->vdev()->profilerAttach(isProfilerAttached);
device_->SaveQueue(queue);
} else if (queue != nullptr) {
queue->release();
// Queue creation has failed, and virtual device associated with the queue may not be created.
// Just need to delete the queue instance.
delete queue;
}
return result;