From dc1497535d71f8a849a0fc9abfda710b0198f16a Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 30 Apr 2018 21:20:26 -0400 Subject: [PATCH] P4 to Git Change 1548145 by cpaquot@cpaquot-ocl-lc-lnx on 2018/04/30 21:15:56 SWDEV-145570 - [HIP] Handle hStream=nullptr case Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#7 edit --- api/hip/hip_module.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/hip/hip_module.cpp b/api/hip/hip_module.cpp index f17d5ae719..97723d52dc 100644 --- a/api/hip/hip_module.cpp +++ b/api/hip/hip_module.cpp @@ -144,8 +144,14 @@ hipError_t hipModuleLaunchKernel(hipFunction_t f, amd::Kernel* kernel = as_amd(reinterpret_cast(f)); amd::Device* device = g_context->devices()[0]; - amd::HostQueue* queue = as_amd(reinterpret_cast(hStream))->asHostQueue(); - + amd::HostQueue* queue; + if (hStream == nullptr) { + queue = new amd::HostQueue(*g_context, *device, 0, + amd::CommandQueue::RealTimeDisabled, + amd::CommandQueue::Priority::Normal); + } else { + queue = as_amd(reinterpret_cast(hStream))->asHostQueue(); + } if (!queue) { return hipErrorOutOfMemory; } @@ -194,6 +200,10 @@ hipError_t hipModuleLaunchKernel(hipFunction_t f, command->awaitCompletion(); command->release(); + if (hStream == nullptr) { + queue->release(); + } + return hipSuccess; }