Return sucess for zeCommandListAppendMemAdvise when not supported

zeCommandListAppendMemAdvise is a performance hint, so on error,
we can just return success, while at the same time ignoring it.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-10-27 23:26:26 +00:00
committed by Compute-Runtime-Automation
parent f20cdac7d3
commit 7363b3fc09
2 changed files with 3 additions and 5 deletions

View File

@@ -792,9 +792,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemAdvise(ze_device_hand
}
auto alloc = allocData->gpuAllocations.getGraphicsAllocation(deviceImp->getRootDeviceIndex());
if (!memoryManager->setMemAdvise(alloc, flags, deviceImp->getRootDeviceIndex())) {
return ZE_RESULT_ERROR_UNKNOWN;
}
memoryManager->setMemAdvise(alloc, flags, deviceImp->getRootDeviceIndex());
deviceImp->memAdviseSharedAllocations[allocData] = flags;
return ZE_RESULT_SUCCESS;

View File

@@ -118,7 +118,7 @@ TEST_F(CommandListCreate, givenNonExistingPtrThenAppendMemoryPrefetchReturnsErro
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
}
TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnError) {
TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnSuccess) {
size_t size = 10;
size_t alignment = 1u;
void *ptr = nullptr;
@@ -138,7 +138,7 @@ TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnError)
memoryManager->failSetMemAdvise = true;
res = commandList->appendMemAdvise(device, ptr, size, ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION);
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, res);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
res = context->freeMem(ptr);
ASSERT_EQ(res, ZE_RESULT_SUCCESS);