hipStreamAddCallback test seg faults

Change-Id: If419d2fad490d0ed50eb1315af809fc1deda1ce3
SWDEV-227875: Add a lock in streams to lock when the callback is call so we make sure things aren't moving forward in the stream


[ROCm/hip commit: 653277bd3f]
Этот коммит содержится в:
Christophe Paquot
2020-03-20 13:06:11 -07:00
родитель 7a418b2fce
Коммит 3c623309cd
2 изменённых файлов: 6 добавлений и 4 удалений
+1 -1
Просмотреть файл
@@ -129,7 +129,7 @@ namespace hip {
struct Stream {
amd::HostQueue* queue;
amd::Monitor lock;
Device* device;
amd::CommandQueue::Priority priority;
unsigned int flags;
+5 -3
Просмотреть файл
@@ -57,7 +57,7 @@ void syncStreams() {
}
Stream::Stream(hip::Device* dev, amd::CommandQueue::Priority p, unsigned int f) :
queue(nullptr), device(dev), priority(p), flags(f) {}
queue(nullptr), lock("Stream Callback lock"), device(dev), priority(p), flags(f) {}
void Stream::create() {
cl_command_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
@@ -90,10 +90,12 @@ void Stream::finish() {
};
void CL_CALLBACK ihipStreamCallback(cl_event event, cl_int command_exec_status, void* user_data) {
hipError_t status = hipSuccess;
StreamCallback* cbo = reinterpret_cast<StreamCallback*>(user_data);
cbo->callBack_(cbo->stream_, status, cbo->userData_);
{
amd::ScopedLock lock(reinterpret_cast<hip::Stream*>(cbo->stream_)->lock);
cbo->callBack_(cbo->stream_, status, cbo->userData_);
}
cbo->command_->release();
delete cbo;
}