mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Check for max allocation size while allocating USM.
Change-Id: I870ffd5d8716dc50ac064666b54f5fa92d8beca3 Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
16f7b9af16
commit
6646bd81a7
@@ -80,6 +80,23 @@ TEST(clUnifiedSharedMemoryTests, whenClDeviceMemAllocIntelIsCalledThenItAllocate
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenUnifiedSharedMemoryAllocationCallsAreCalledWithSizeGreaterThenMaxMemAllocSizeThenErrorIsReturned) {
|
||||
MockContext mockContext;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto maxMemAllocSize = mockContext.getDevice(0u)->getDeviceInfo().maxMemAllocSize;
|
||||
size_t requestedSize = static_cast<size_t>(maxMemAllocSize) + 1u;
|
||||
|
||||
auto unfiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(&mockContext, mockContext.getDevice(0u), nullptr, requestedSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unfiedMemoryDeviceAllocation);
|
||||
unfiedMemoryDeviceAllocation = clSharedMemAllocINTEL(&mockContext, mockContext.getDevice(0u), nullptr, requestedSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unfiedMemoryDeviceAllocation);
|
||||
unfiedMemoryDeviceAllocation = clHostMemAllocINTEL(&mockContext, nullptr, requestedSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_INVALID_BUFFER_SIZE, retVal);
|
||||
EXPECT_EQ(nullptr, unfiedMemoryDeviceAllocation);
|
||||
}
|
||||
|
||||
TEST(clUnifiedSharedMemoryTests, whenClSharedMemAllocINTELisCalledWithWrongContextThenInvalidContextErrorIsReturned) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto ptr = clSharedMemAllocINTEL(0, 0, nullptr, 0, 0, &retVal);
|
||||
|
||||
Reference in New Issue
Block a user