fix: allow empty set to be passed to clSetKernelExecInfo

Related-To: GSD-8538
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2024-04-16 13:30:26 +00:00
committed by Compute-Runtime-Automation
parent 4b4d21a5e6
commit ea057abd36
3 changed files with 18 additions and 4 deletions

View File

@@ -5123,9 +5123,9 @@ cl_int CL_API_CALL clSetKernelExecInfo(cl_kernel kernel,
case CL_KERNEL_EXEC_INFO_SVM_PTRS:
case CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL: {
if ((paramValueSize == 0) ||
if ((paramValueSize == 0 && paramValue) ||
(paramValueSize % sizeof(void *)) ||
(paramValue == nullptr)) {
(paramValueSize && paramValue == nullptr)) {
retVal = CL_INVALID_VALUE;
TRACING_EXIT(ClSetKernelExecInfo, &retVal);
return retVal;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -231,6 +231,16 @@ TEST_F(clSetKernelExecInfoTests, GivenMultipleSettingKernelInfoOperationsWhenSet
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, pMockKernel->kernelSvmGfxAllocations.size());
retVal = clSetKernelExecInfo(
pMockMultiDeviceKernel, // cl_kernel kernel
CL_KERNEL_EXEC_INFO_SVM_PTRS, // cl_kernel_exec_info param_name
0, // size_t param_value_size
nullptr // const void *param_value
);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(0u, pMockKernel->kernelSvmGfxAllocations.size());
}
}

View File

@@ -1560,7 +1560,7 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenSetKernelExecInfoWithUnifiedMemoryI
svmAllocationsManager->freeSVMAlloc(unifiedMemoryAllocation);
}
HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemoryIsCalledThenAllocationIsStoredWithinKernel) {
HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithAndWithoutUnifiedMemoryIsCalledThenAllocationIsStoredAndDeletedWithinKernel) {
REQUIRE_SVM_OR_SKIP(pClDevice);
MockKernelWithInternals mockKernel(*this->pClDevice);
@@ -1582,6 +1582,10 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor
EXPECT_EQ(1u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
EXPECT_EQ(mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations[0]->getGpuAddress(), castToUint64(unifiedMemoryAllocation2));
status = clSetKernelExecInfo(mockKernel.mockMultiDeviceKernel, CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL, 0, nullptr);
EXPECT_EQ(CL_SUCCESS, status);
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
svmAllocationsManager->freeSVMAlloc(unifiedMemoryAllocation);
svmAllocationsManager->freeSVMAlloc(unifiedMemoryAllocation2);
}