Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenCL] Add more mappings from CL error codes to UR error codes. #975

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions source/adapters/opencl/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ ur_result_t mapCLErrorToUR(cl_int Result) {
return UR_RESULT_ERROR_OUT_OF_RESOURCES;
case CL_INVALID_MEM_OBJECT:
return UR_RESULT_ERROR_INVALID_MEM_OBJECT;
case CL_INVALID_QUEUE_PROPERTIES:
return UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES;
case CL_INVALID_BUFFER_SIZE:
return UR_RESULT_ERROR_INVALID_BUFFER_SIZE;
case CL_INVALID_IMAGE_SIZE:
return UR_RESULT_ERROR_INVALID_IMAGE_SIZE;
case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR:
case CL_INVALID_IMAGE_DESCRIPTOR:
return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR;
case CL_IMAGE_FORMAT_NOT_SUPPORTED:
return UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT;
case CL_PROFILING_INFO_NOT_AVAILABLE:
return UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE;
case CL_LINK_PROGRAM_FAILURE:
return UR_RESULT_ERROR_PROGRAM_LINK_FAILURE;
case CL_INVALID_ARG_INDEX:
return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX;
default:
return UR_RESULT_ERROR_UNKNOWN;
}
Expand Down
1 change: 0 additions & 1 deletion test/conformance/queue/queue_adapter_cuda.match
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
urQueueCreateTest.InvalidValueProperties/NVIDIA_CUDA_BACKEND___{{.*}}_
urQueueCreateTest.InvalidQueueProperties/NVIDIA_CUDA_BACKEND___{{.*}}_
urQueueCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_
urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT
Expand Down
1 change: 0 additions & 1 deletion test/conformance/queue/queue_adapter_hip.match
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
urQueueCreateTest.InvalidValueProperties/AMD_HIP_BACKEND___{{.*}}_
urQueueCreateTest.InvalidQueueProperties/AMD_HIP_BACKEND___{{.*}}_
urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE
urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_PROFILING_ENABLE
Expand Down
1 change: 0 additions & 1 deletion test/conformance/queue/queue_adapter_level_zero.match
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
urQueueCreateTest.InvalidValueProperties/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urQueueCreateTest.InvalidQueueProperties/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
{{Segmentation fault|Aborted}}
19 changes: 8 additions & 11 deletions test/conformance/queue/urQueueCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,23 @@ TEST_P(urQueueCreateTest, InvalidNullPointerQueue) {
urQueueCreate(context, device, 0, nullptr));
}

TEST_P(urQueueCreateTest, InvalidValueProperties) {
ur_queue_handle_t queue = nullptr;
TEST_P(urQueueCreateTest, InvalidQueueProperties) {
ur_queue_properties_t props = {
/*.stype =*/UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
/*.pNext =*/nullptr,
/*.flags =*/UR_QUEUE_FLAG_FORCE_UINT32,
};
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_VALUE,
urQueueCreate(context, device, &props, &queue));
}

TEST_P(urQueueCreateTest, InvalidQueueProperties) {
ur_queue_properties_t props = {
/*.stype =*/UR_STRUCTURE_TYPE_QUEUE_PROPERTIES,
/*.pNext =*/nullptr,
/*.flags =*/UR_QUEUE_FLAG_PRIORITY_HIGH | UR_QUEUE_FLAG_PRIORITY_LOW,
};
// Initial value is just not a valid enum
{
ur_queue_handle_t queue = nullptr;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES,
urQueueCreate(context, device, &props, &queue));
}
// It should be an error to specify both low/high priorities
{
ur_queue_handle_t queue = nullptr;
props.flags = UR_QUEUE_FLAG_PRIORITY_HIGH | UR_QUEUE_FLAG_PRIORITY_LOW;
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES,
urQueueCreate(context, device, &props, &queue));
}
Expand Down