Skip to content

Commit

Permalink
[L0] skip checks in test if L0 function is not supported
Browse files Browse the repository at this point in the history
older driver versions might not implement zeCommandListGet* functions
  • Loading branch information
igchor committed Jun 27, 2024
1 parent 58ca3a3 commit 9f7d918
Showing 1 changed file with 38 additions and 22 deletions.
60 changes: 38 additions & 22 deletions test/adapters/level_zero/v2/command_list_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,30 @@ TEST_P(CommandListCacheTest, ImmediateCommandListsHaveProperAttributes) {
device->ZeDevice, IsInOrder, Ordinal, Mode, Priority, Index);

ze_device_handle_t ZeDevice;
ASSERT_EQ(
zeCommandListGetDeviceHandle(CommandList.get(), &ZeDevice),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ZeDevice, device->ZeDevice);
auto Ret =
zeCommandListGetDeviceHandle(CommandList.get(), &ZeDevice);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ZeDevice, device->ZeDevice);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

uint32_t ActualOrdinal;
ASSERT_EQ(
zeCommandListGetOrdinal(CommandList.get(), &ActualOrdinal),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ActualOrdinal, Ordinal);
Ret = zeCommandListGetOrdinal(CommandList.get(), &ActualOrdinal);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ActualOrdinal, Ordinal);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

uint32_t ActualIndex;
ASSERT_EQ(
zeCommandListImmediateGetIndex(CommandList.get(), &ActualIndex),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ActualIndex, Index);
Ret =
zeCommandListImmediateGetIndex(CommandList.get(), &ActualIndex);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ActualIndex, Index);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

// store the list back to the cache
cache.addImmediateCommandList(std::move(CommandList),
Expand All @@ -135,19 +143,27 @@ TEST_P(CommandListCacheTest, ImmediateCommandListsHaveProperAttributes) {
device->ZeDevice, IsInOrder, Ordinal, Mode, Priority, std::nullopt);

ze_device_handle_t ZeDevice;
ASSERT_EQ(zeCommandListGetDeviceHandle(CommandList.get(), &ZeDevice),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ZeDevice, device->ZeDevice);
auto Ret = zeCommandListGetDeviceHandle(CommandList.get(), &ZeDevice);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ZeDevice, device->ZeDevice);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

uint32_t ActualOrdinal;
ASSERT_EQ(zeCommandListGetOrdinal(CommandList.get(), &ActualOrdinal),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ActualOrdinal, Ordinal);
Ret = zeCommandListGetOrdinal(CommandList.get(), &ActualOrdinal);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ActualOrdinal, Ordinal);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

uint32_t ActualIndex;
ASSERT_EQ(
zeCommandListImmediateGetIndex(CommandList.get(), &ActualIndex),
ZE_RESULT_SUCCESS);
ASSERT_EQ(ActualIndex, 0);
Ret = zeCommandListImmediateGetIndex(CommandList.get(), &ActualIndex);
if (Ret == ZE_RESULT_SUCCESS) {
ASSERT_EQ(ActualIndex, 0);
} else {
ASSERT_EQ(Ret, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}
}
}

0 comments on commit 9f7d918

Please sign in to comment.