From 46652f12a295865e762c55141a2e48fb78d916aa Mon Sep 17 00:00:00 2001 From: victzhan Date: Thu, 16 Feb 2023 12:41:20 -0500 Subject: [PATCH] SWDEV-376995 - Fixed misplaced checking Change-Id: Ia3bddabfa7fc76066541fb81723136ae6cffb0a4 [ROCm/clr commit: d6a08403d8c74852981760fcd4cfe715c41ff704] --- projects/clr/hipamd/src/hip_module.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/clr/hipamd/src/hip_module.cpp b/projects/clr/hipamd/src/hip_module.cpp index 76821cfe38..41b9038d0c 100644 --- a/projects/clr/hipamd/src/hip_module.cpp +++ b/projects/clr/hipamd/src/hip_module.cpp @@ -340,10 +340,6 @@ hipError_t ihipLaunchKernelCommand(amd::Command*& command, hipFunction_t f, return hipErrorOutOfMemory; } - if (kernelCommand->status() == CL_INVALID_OPERATION) { - kernelCommand->release(); - return hipErrorIllegalState; - } command = kernelCommand; return hipSuccess; @@ -398,6 +394,12 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, hip::Event* eStop = reinterpret_cast(stopEvent); eStop->BindCommand(*command, false); } + + if (command->status() == CL_INVALID_OPERATION) { + command->release(); + return hipErrorIllegalState; + } + command->release(); return hipSuccess;