diff --git a/projects/hip/api/hip/hip_stream.cpp b/projects/hip/api/hip/hip_stream.cpp index 1c007edf1d..7cb359b1b9 100644 --- a/projects/hip/api/hip/hip_stream.cpp +++ b/projects/hip/api/hip/hip_stream.cpp @@ -32,15 +32,15 @@ static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int fl amd::CommandQueue::RealTimeDisabled, amd::CommandQueue::Priority::Normal); + if (queue == nullptr || !queue->create()) { + return hipErrorOutOfMemory; + } + if (!(flags & hipStreamNonBlocking)) { hip::syncStreams(); streamSet.insert(queue); } - if (queue == nullptr) { - return hipErrorOutOfMemory; - } - *stream = reinterpret_cast(as_cl(queue)); return hipSuccess; @@ -101,10 +101,8 @@ hipError_t hipStreamDestroy(hipStream_t stream) { } amd::HostQueue* hostQueue = as_amd(reinterpret_cast(stream))->asHostQueue(); - - streamSet.erase(hostQueue); - hostQueue->release(); + streamSet.erase(hostQueue); return hipSuccess; }