Skip to content

Commit 7363b3f

Browse files
Jaime ArteagaCompute-Runtime-Automation
authored andcommitted
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 <[email protected]>
1 parent f20cdac commit 7363b3f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,9 +792,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemAdvise(ze_device_hand
792792
}
793793

794794
auto alloc = allocData->gpuAllocations.getGraphicsAllocation(deviceImp->getRootDeviceIndex());
795-
if (!memoryManager->setMemAdvise(alloc, flags, deviceImp->getRootDeviceIndex())) {
796-
return ZE_RESULT_ERROR_UNKNOWN;
797-
}
795+
memoryManager->setMemAdvise(alloc, flags, deviceImp->getRootDeviceIndex());
798796

799797
deviceImp->memAdviseSharedAllocations[allocData] = flags;
800798
return ZE_RESULT_SUCCESS;

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ TEST_F(CommandListCreate, givenNonExistingPtrThenAppendMemoryPrefetchReturnsErro
118118
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
119119
}
120120

121-
TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnError) {
121+
TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnSuccess) {
122122
size_t size = 10;
123123
size_t alignment = 1u;
124124
void *ptr = nullptr;
@@ -138,7 +138,7 @@ TEST_F(CommandListCreate, givenValidPtrWhenAppendMemAdviseFailsThenReturnError)
138138
memoryManager->failSetMemAdvise = true;
139139

140140
res = commandList->appendMemAdvise(device, ptr, size, ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION);
141-
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, res);
141+
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
142142

143143
res = context->freeMem(ptr);
144144
ASSERT_EQ(res, ZE_RESULT_SUCCESS);

0 commit comments

Comments
 (0)