Skip to content

Commit

Permalink
Only test DEVICE_DEFAULT query when queue is device default.
Browse files Browse the repository at this point in the history
Some supported CL drivers return an error rather than NULL if you try
this query on a queue that wasn't created with the ON_DEVICE and
DEVICE_DEFAULT flags. This isn't correct according to the CL spec but
limiting our testing to the supported case is still preferable to adding
an exception to the match files.
  • Loading branch information
aarongreig committed May 8, 2024
1 parent 0687bf4 commit e977a04
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
9 changes: 7 additions & 2 deletions test/conformance/queue/queue_adapter_native_cpu.match
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ urQueueFinishTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urQueueFlushTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_CONTEXT
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_DEVICE
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_DEVICE_DEFAULT
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_FLAGS
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_REFERENCE_COUNT
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_SIZE
urQueueGetInfoTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_EMPTY
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_CONTEXT
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_DEVICE
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_DEVICE_DEFAULT
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_FLAGS
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_REFERENCE_COUNT
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_SIZE
urQueueGetInfoDeviceQueueTestWithInfoParam.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_QUEUE_INFO_EMPTY
urQueueGetInfoTest.InvalidSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urQueueRetainTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urQueueReleaseTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
27 changes: 16 additions & 11 deletions test/conformance/queue/urQueueGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ using urQueueGetInfoTestWithInfoParam =

UUR_TEST_SUITE_P(urQueueGetInfoTestWithInfoParam,
::testing::Values(UR_QUEUE_INFO_CONTEXT, UR_QUEUE_INFO_DEVICE,
UR_QUEUE_INFO_DEVICE_DEFAULT,
UR_QUEUE_INFO_FLAGS,
UR_QUEUE_INFO_REFERENCE_COUNT,
UR_QUEUE_INFO_EMPTY),
Expand Down Expand Up @@ -96,7 +95,8 @@ struct urQueueGetInfoDeviceQueueTestWithInfoParam
ur_queue_handle_t queue = nullptr;
ur_queue_properties_t queueProperties = {
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES, nullptr,
UR_QUEUE_FLAG_ON_DEVICE | UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE};
UR_QUEUE_FLAG_ON_DEVICE | UR_QUEUE_FLAG_ON_DEVICE_DEFAULT |
UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE};
};

UUR_TEST_SUITE_P(urQueueGetInfoDeviceQueueTestWithInfoParam,
Expand All @@ -110,17 +110,22 @@ UUR_TEST_SUITE_P(urQueueGetInfoDeviceQueueTestWithInfoParam,
TEST_P(urQueueGetInfoDeviceQueueTestWithInfoParam, Success) {
ur_queue_info_t info_type = getParam();
size_t size = 0;
ASSERT_SUCCESS(urQueueGetInfo(queue, info_type, 0, nullptr, &size));
ASSERT_NE(size, 0);
auto result = urQueueGetInfo(queue, info_type, 0, nullptr, &size);

if (const auto expected_size = queue_info_size_map.find(info_type);
expected_size != queue_info_size_map.end()) {
ASSERT_EQ(expected_size->second, size);
}
if (result == UR_RESULT_SUCCESS) {
ASSERT_NE(size, 0);

if (const auto expected_size = queue_info_size_map.find(info_type);
expected_size != queue_info_size_map.end()) {
ASSERT_EQ(expected_size->second, size);
}

std::vector<uint8_t> data(size);
ASSERT_SUCCESS(
urQueueGetInfo(queue, info_type, size, data.data(), nullptr));
std::vector<uint8_t> data(size);
ASSERT_SUCCESS(
urQueueGetInfo(queue, info_type, size, data.data(), nullptr));
} else {
ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION);
}
}

using urQueueGetInfoTest = uur::urQueueTest;
Expand Down

0 comments on commit e977a04

Please sign in to comment.