Enable AllowUnrestrictedSize debug flag on L0
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
parent
4649664e31
commit
cc2d701e9d
|
@ -55,7 +55,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
|
|||
size_t alignment,
|
||||
void **ptr) {
|
||||
|
||||
bool relaxedSizeAllowed = false;
|
||||
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
||||
if (hostDesc->pNext) {
|
||||
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(hostDesc->pNext);
|
||||
if (extendedDesc->stype == ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) {
|
||||
|
@ -102,7 +102,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
|
|||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
bool relaxedSizeAllowed = false;
|
||||
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
||||
if (deviceDesc->pNext) {
|
||||
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(deviceDesc->pNext);
|
||||
if (extendedDesc->stype == ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC) {
|
||||
|
@ -178,7 +178,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
|
|||
size_t size,
|
||||
size_t alignment,
|
||||
void **ptr) {
|
||||
bool relaxedSizeAllowed = false;
|
||||
bool relaxedSizeAllowed = NEO::DebugManager.flags.AllowUnrestrictedSize.get();
|
||||
if (deviceDesc->pNext) {
|
||||
const ze_base_desc_t *extendedDesc = reinterpret_cast<const ze_base_desc_t *>(deviceDesc->pNext);
|
||||
if (extendedDesc->stype == ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) {
|
||||
|
|
|
@ -323,6 +323,25 @@ TEST_F(MemoryRelaxedSizeTests,
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToHostAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.AllowUnrestrictedSize.set(1);
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
||||
size_t alignment = 1u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
hostDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC;
|
||||
ze_result_t result = context->allocHostMem(&hostDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToHostAllocWithLargerThanAllowedSizeAndRelaxedFlagWithIncorrectFlagThenAllocationIsNotMade) {
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
||||
|
@ -415,6 +434,29 @@ TEST_F(MemoryRelaxedSizeTests,
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToDeviceAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
||||
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.AllowUnrestrictedSize.set(1);
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
||||
size_t alignment = 1u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
deviceDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC;
|
||||
ze_result_t result = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToDeviceAllocWithLargerThanGlobalMemSizeAndRelaxedFlagThenAllocationIsNotMade) {
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().globalMemSize + 1;
|
||||
|
@ -534,6 +576,31 @@ TEST_F(MemoryRelaxedSizeTests,
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToSharedAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
|
||||
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.AllowUnrestrictedSize.set(1);
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
|
||||
size_t alignment = 1u;
|
||||
void *ptr = nullptr;
|
||||
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
deviceDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC;
|
||||
ze_host_mem_alloc_desc_t hostDesc = {};
|
||||
ze_result_t result = context->allocSharedMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
&hostDesc,
|
||||
size, alignment, &ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
|
||||
result = context->freeMem(ptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(MemoryRelaxedSizeTests,
|
||||
givenCallToSharedAllocWithLargerThanGlobalMemSizeAndRelaxedFlagThenAllocationIsNotMade) {
|
||||
size_t size = device->getNEODevice()->getDeviceInfo().globalMemSize + 1;
|
||||
|
|
Loading…
Reference in New Issue