From 208d124f54cd98ab45869e70269bb941c102379b Mon Sep 17 00:00:00 2001 From: "Arandjelovic, Marko" Date: Thu, 14 Aug 2025 20:08:53 +0200 Subject: [PATCH] SWDEV-547453 Release the kernel command if the operation returns an error (#807) * SWDEV-547453 Release the kernel command if the operation returns an error * SWDEV-547453 - Initialize parameters_ to default value * SWDEV-547453 - Run clang-format [ROCm/clr commit: a15957fee9e18e10c282ca3e2e2d9b2f98c3223a] --- projects/clr/hipamd/src/hip_module.cpp | 1 + projects/clr/rocclr/platform/command.cpp | 29 ++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/projects/clr/hipamd/src/hip_module.cpp b/projects/clr/hipamd/src/hip_module.cpp index 81fb24209f..8cef77d990 100644 --- a/projects/clr/hipamd/src/hip_module.cpp +++ b/projects/clr/hipamd/src/hip_module.cpp @@ -380,6 +380,7 @@ hipError_t ihipLaunchKernelCommand(amd::Command*& command, hipFunction_t f, assert(kernelParams == nullptr); if (extra[0] != HIP_LAUNCH_PARAM_BUFFER_POINTER || extra[2] != HIP_LAUNCH_PARAM_BUFFER_SIZE || extra[4] != HIP_LAUNCH_PARAM_END) { + kernelCommand->release(); return hipErrorInvalidValue; } kernargs = reinterpret_cast
(extra[1]); diff --git a/projects/clr/rocclr/platform/command.cpp b/projects/clr/rocclr/platform/command.cpp index d9361703e7..945f756d0d 100644 --- a/projects/clr/rocclr/platform/command.cpp +++ b/projects/clr/rocclr/platform/command.cpp @@ -421,20 +421,21 @@ const Context& Command::context() const { return queue_->context(); } NDRangeKernelCommand::NDRangeKernelCommand(HostQueue& queue, const EventWaitList& eventWaitList, Kernel& kernel, const NDRangeContainer& sizes, uint32_t sharedMemBytes, uint32_t extraParam, - uint32_t gridId, uint32_t numGrids, - uint64_t prevGridSum, uint64_t allGridSum, - uint32_t firstDevice, bool forceProfiling) : - Command(queue, CL_COMMAND_NDRANGE_KERNEL, eventWaitList, AMD_SERIALIZE_KERNEL | - (HIP_LAUNCH_BLOCKING << 1)), - kernel_(kernel), - sizes_(sizes), - sharedMemBytes_(sharedMemBytes), - extraParam_(extraParam), - gridId_(gridId), - numGrids_(numGrids), - prevGridSum_(prevGridSum), - allGridSum_(allGridSum), - firstDevice_(firstDevice) { + uint32_t gridId, uint32_t numGrids, uint64_t prevGridSum, + uint64_t allGridSum, uint32_t firstDevice, + bool forceProfiling) + : Command(queue, CL_COMMAND_NDRANGE_KERNEL, eventWaitList, + AMD_SERIALIZE_KERNEL | (HIP_LAUNCH_BLOCKING << 1)), + kernel_(kernel), + sizes_(sizes), + sharedMemBytes_(sharedMemBytes), + extraParam_(extraParam), + gridId_(gridId), + numGrids_(numGrids), + prevGridSum_(prevGridSum), + allGridSum_(allGridSum), + firstDevice_(firstDevice), + parameters_(nullptr) { auto& device = queue.device(); auto devKernel = const_cast(kernel.getDeviceKernel(device)); if (cooperativeGroups()) {