mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
fix: return error for 0 size usm allocations
according to both level zero and opencl specs, usm allocations with size=0 should return invalid/unsupported buffer size errors Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
08f7e7be18
commit
239831f097
@@ -25,6 +25,17 @@ TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocINTELisCalledWithoutContextTh
|
||||
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocIntelIsCalledWithSizeZeroThenInvalidBufferSizeIsReturned) {
|
||||
MockContext mockContext;
|
||||
auto device = mockContext.getDevice(0u);
|
||||
REQUIRE_SVM_OR_SKIP(device);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(&mockContext, nullptr, 0u, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unifiedMemoryHostAllocation);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClHostMemAllocIntelIsCalledThenItAllocatesHostUnifiedMemoryAllocation) {
|
||||
MockContext mockContext;
|
||||
auto device = mockContext.getDevice(0u);
|
||||
@@ -128,6 +139,17 @@ TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocINTELisCalledWithWrongConte
|
||||
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocIntelIsCalledWithSizeZeroThenItInvalidBufferSizeIsReturned) {
|
||||
MockContext mockContext;
|
||||
auto device = mockContext.getDevice(0u);
|
||||
REQUIRE_SVM_OR_SKIP(device);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto unifiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(&mockContext, mockContext.getDevice(0u), nullptr, 0u, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unifiedMemoryDeviceAllocation);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocIntelIsCalledThenItAllocatesDeviceUnifiedMemoryAllocation) {
|
||||
MockContext mockContext;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
@@ -186,6 +208,17 @@ TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocINTELisCalledWithWrongConte
|
||||
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocIntelIsCalledWithSizeZeroThenInvalidBufferSizeIsReturned) {
|
||||
MockContext mockContext;
|
||||
auto device = mockContext.getDevice(0u);
|
||||
REQUIRE_SVM_OR_SKIP(device);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto unifiedMemorySharedAllocation = clSharedMemAllocINTEL(&mockContext, mockContext.getDevice(0u), nullptr, 0u, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unifiedMemorySharedAllocation);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocINTELisCalledWithWrongDeviceThenInvalidDeviceErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
MockContext context0;
|
||||
@@ -1145,7 +1178,7 @@ TEST(clUnifiedSharedMemoryTests, givenInvalidMemPropertiesWhenClSharedMemAllocIn
|
||||
EXPECT_EQ(nullptr, unifiedMemorySharedAllocation);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocationSizeGreaterThanMaxMemAllocSizeAndClMemAllowUnrestrictedSizeFlagWhenCreateAllocationThenSuccesIsReturned) {
|
||||
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocationSizeGreaterThanMaxMemAllocSizeAndClMemAllowUnrestrictedSizeFlagWhenCreateAllocationThenSuccessIsReturned) {
|
||||
MockContext mockContext;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_mem_properties_intel properties[] = {CL_MEM_FLAGS, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL, 0};
|
||||
@@ -1188,7 +1221,7 @@ TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocationSizeGreaterThanMaxM
|
||||
}
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocationSizeGreaterThanMaxMemAllocSizeAndDebugFlagSetWhenCreateAllocationThenSuccesIsReturned) {
|
||||
TEST(clUnifiedSharedMemoryTests, givenUnifiedMemoryAllocationSizeGreaterThanMaxMemAllocSizeAndDebugFlagSetWhenCreateAllocationThenSuccessIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.AllowUnrestrictedSize.set(1);
|
||||
MockContext mockContext;
|
||||
|
||||
@@ -766,7 +766,7 @@ TEST_F(EnqueueSvmTest, GivenNullSvmPtrWhenFillingMemoryThenInvalidValueErrorIsRe
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueSvmTest, givenSvmAllocWhenEnqueueSvmFillThenSuccesIsReturnedAndAddressIsProperlyAligned) {
|
||||
HWTEST_F(EnqueueSvmTest, givenSvmAllocWhenEnqueueSvmFillThenSuccessIsReturnedAndAddressIsProperlyAligned) {
|
||||
const float pattern[1] = {1.2345f};
|
||||
const size_t patternSize = sizeof(pattern);
|
||||
MockCommandQueueHw<FamilyType> myCmdQ(context, pClDevice, 0);
|
||||
|
||||
Reference in New Issue
Block a user