Skip to content

Commit

Permalink
Merge pull request oneapi-src#1588 from steffenlarsen/steffen/fix_tim…
Browse files Browse the repository at this point in the history
…estamp_merge_mistake

[CUDA] Add back device info enums after merge mistake
  • Loading branch information
kbenzie authored and omarahmed1111 committed May 16, 2024
2 parents 7ce68e0 + cb3d945 commit aac2eeb
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 10 deletions.
24 changes: 24 additions & 0 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,30 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
// CUDA supports cubemap seamless filtering.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: {
// CUDA does support fetching 1D USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: {
// CUDA does not support fetching 1D non-USM sampled image data.
return ReturnValue(false);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: {
// CUDA does support fetching 2D USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: {
// CUDA does support fetching 2D non-USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP: {
// CUDA does not support 3D USM sampled textures
return ReturnValue(false);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: {
// CUDA does support fetching 3D non-USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP: {
// CUDA supports recording timestamp events.
return ReturnValue(true);
Expand Down
5 changes: 2 additions & 3 deletions source/adapters/cuda/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetInfo(ur_event_handle_t hEvent,
case UR_EVENT_INFO_CONTEXT:
return ReturnValue(hEvent->getContext());
default:
detail::ur::die("Event info request not implemented");
break;
}

return UR_RESULT_ERROR_INVALID_ENUMERATION;
Expand Down Expand Up @@ -207,8 +207,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo(
default:
break;
}
detail::ur::die("Event Profiling info request not implemented");
return {};
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback(ur_event_handle_t,
Expand Down
1 change: 1 addition & 0 deletions test/conformance/event/event_adapter_cuda.match
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
urEventGetProfilingInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_
urEventSetCallbackTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_
urEventSetCallbackTest.ValidateParameters/NVIDIA_CUDA_BACKEND___{{.*}}_
urEventSetCallbackTest.AllStates/NVIDIA_CUDA_BACKEND___{{.*}}_
Expand Down
1 change: 1 addition & 0 deletions test/conformance/event/event_adapter_hip.match
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
urEventGetProfilingInfoTest.Success/AMD_HIP_BACKEND___{{.*}}_
urEventSetCallbackTest.Success/AMD_HIP_BACKEND___{{.*}}_
urEventSetCallbackTest.ValidateParameters/AMD_HIP_BACKEND___{{.*}}_
urEventSetCallbackTest.AllStates/AMD_HIP_BACKEND___{{.*}}_
Expand Down
3 changes: 1 addition & 2 deletions test/conformance/event/event_adapter_level_zero.match
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{OPT}}urEventGetInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_EVENT_INFO_COMMAND_TYPE
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_QUEUED
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_SUBMIT
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
{{OPT}}{{Segmentation fault|Aborted}}
5 changes: 1 addition & 4 deletions test/conformance/event/event_adapter_native_cpu.match
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ urEventGetInfoNegativeTest.InvalidSizePropSize/SYCL_NATIVE_CPU___SYCL_Native_CPU
urEventGetInfoNegativeTest.InvalidSizePropSizeSmall/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetInfoNegativeTest.InvalidNullPointerPropValue/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetInfoNegativeTest.InvalidNullPointerPropSizeRet/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_QUEUED
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_SUBMIT
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_START
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_END
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetProfilingInfoNegativeTest.InvalidNullHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetProfilingInfoNegativeTest.InvalidEnumeration/SYCL_NATIVE_CPU___SYCL_Native_CPU_
urEventGetProfilingInfoNegativeTest.InvalidValue/SYCL_NATIVE_CPU___SYCL_Native_CPU_
Expand Down
1 change: 1 addition & 0 deletions test/conformance/event/event_adapter_opencl.match
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urEventGetProfilingInfoTest.Success/Intel_R__OpenCL___{{.*}}
51 changes: 50 additions & 1 deletion test/conformance/event/urEventGetProfilingInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,58 @@ UUR_TEST_SUITE_P(urEventGetProfilingInfoTest,
::testing::Values(UR_PROFILING_INFO_COMMAND_QUEUED,
UR_PROFILING_INFO_COMMAND_SUBMIT,
UR_PROFILING_INFO_COMMAND_START,
UR_PROFILING_INFO_COMMAND_END),
UR_PROFILING_INFO_COMMAND_END,
UR_PROFILING_INFO_COMMAND_COMPLETE),
uur::deviceTestWithParamPrinter<ur_profiling_info_t>);

using urEventGetProfilingInfoWithTimingComparisonTest = uur::event::urEventTest;

TEST_P(urEventGetProfilingInfoWithTimingComparisonTest, Success) {
uint8_t size = 8;

std::vector<uint8_t> queued_data(size);
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
UR_PROFILING_INFO_COMMAND_QUEUED,
size, queued_data.data(), nullptr));
auto queued_timing = reinterpret_cast<size_t *>(queued_data.data());
ASSERT_NE(*queued_timing, 0);

std::vector<uint8_t> submit_data(size);
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
UR_PROFILING_INFO_COMMAND_SUBMIT,
size, submit_data.data(), nullptr));
auto submit_timing = reinterpret_cast<size_t *>(submit_data.data());
ASSERT_NE(*submit_timing, 0);

std::vector<uint8_t> start_data(size);
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
UR_PROFILING_INFO_COMMAND_START,
size, start_data.data(), nullptr));
auto start_timing = reinterpret_cast<size_t *>(start_data.data());
ASSERT_NE(*start_timing, 0);

std::vector<uint8_t> end_data(size);
ASSERT_SUCCESS(urEventGetProfilingInfo(event, UR_PROFILING_INFO_COMMAND_END,
size, end_data.data(), nullptr));
auto end_timing = reinterpret_cast<size_t *>(end_data.data());
ASSERT_NE(*end_timing, 0);

std::vector<uint8_t> complete_data(size);
ASSERT_SUCCESS(
urEventGetProfilingInfo(event, UR_PROFILING_INFO_COMMAND_COMPLETE, size,
complete_data.data(), nullptr));
auto complete_timing = reinterpret_cast<size_t *>(complete_data.data());
ASSERT_NE(*complete_timing, 0);

ASSERT_LE(*queued_timing, *submit_timing);
ASSERT_LT(*submit_timing, *start_timing);
ASSERT_LT(*start_timing, *end_timing);
ASSERT_LE(*end_timing, *complete_timing);
}

UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(
urEventGetProfilingInfoWithTimingComparisonTest);

using urEventGetProfilingInfoNegativeTest = uur::event::urEventTest;

TEST_P(urEventGetProfilingInfoNegativeTest, InvalidNullHandle) {
Expand Down

0 comments on commit aac2eeb

Please sign in to comment.