Skip to content

Commit a2005dd

Browse files
authored
Merge pull request #1598 from omarahmed1111/Add-event-tests-that-match-e2e-event-tests
Add more output validation for urEventGetProfilingInfo test
2 parents 31ee5d5 + 84b93ab commit a2005dd

File tree

7 files changed

+62
-5
lines changed

7 files changed

+62
-5
lines changed

source/adapters/cuda/event.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetInfo(ur_event_handle_t hEvent,
176176
case UR_EVENT_INFO_CONTEXT:
177177
return ReturnValue(hEvent->getContext());
178178
default:
179-
detail::ur::die("Event info request not implemented");
179+
break;
180180
}
181181

182182
return UR_RESULT_ERROR_INVALID_ENUMERATION;
@@ -207,8 +207,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo(
207207
default:
208208
break;
209209
}
210-
detail::ur::die("Event Profiling info request not implemented");
211-
return {};
210+
return UR_RESULT_ERROR_INVALID_ENUMERATION;
212211
}
213212

214213
UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback(ur_event_handle_t,

source/adapters/opencl/event.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ convertURProfilingInfoToCL(const ur_profiling_info_t PropName) {
4646
return CL_PROFILING_COMMAND_SUBMIT;
4747
case UR_PROFILING_INFO_COMMAND_START:
4848
return CL_PROFILING_COMMAND_START;
49-
// TODO(ur) add UR_PROFILING_INFO_COMMAND_COMPLETE once spec has been updated
49+
case UR_PROFILING_INFO_COMMAND_COMPLETE:
50+
return CL_PROFILING_COMMAND_COMPLETE;
5051
case UR_PROFILING_INFO_COMMAND_END:
5152
return CL_PROFILING_COMMAND_END;
5253
default:

test/conformance/event/event_adapter_cuda.match

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
urEventGetProfilingInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_PROFILING_INFO_COMMAND_COMPLETE
2+
urEventGetProfilingInfoWithTimingComparisonTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_
13
urEventSetCallbackTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_
24
urEventSetCallbackTest.ValidateParameters/NVIDIA_CUDA_BACKEND___{{.*}}_
35
urEventSetCallbackTest.AllStates/NVIDIA_CUDA_BACKEND___{{.*}}_

test/conformance/event/event_adapter_hip.match

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
urEventGetProfilingInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_PROFILING_INFO_COMMAND_COMPLETE
2+
urEventGetProfilingInfoWithTimingComparisonTest.Success/AMD_HIP_BACKEND___{{.*}}_
13
urEventSetCallbackTest.Success/AMD_HIP_BACKEND___{{.*}}_
24
urEventSetCallbackTest.ValidateParameters/AMD_HIP_BACKEND___{{.*}}_
35
urEventSetCallbackTest.AllStates/AMD_HIP_BACKEND___{{.*}}_
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{{OPT}}urEventGetInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_EVENT_INFO_COMMAND_TYPE
22
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_QUEUED
33
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_SUBMIT
4+
{{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_COMPLETE
5+
{{OPT}}urEventGetProfilingInfoWithTimingComparisonTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
46
{{OPT}}{{Segmentation fault|Aborted}}

test/conformance/event/event_adapter_native_cpu.match

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFI
1313
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_SUBMIT
1414
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_START
1515
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_END
16+
urEventGetProfilingInfoTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU___UR_PROFILING_INFO_COMMAND_COMPLETE
17+
urEventGetProfilingInfoWithTimingComparisonTest.Success/SYCL_NATIVE_CPU___SYCL_Native_CPU_
1618
urEventGetProfilingInfoNegativeTest.InvalidNullHandle/SYCL_NATIVE_CPU___SYCL_Native_CPU_
1719
urEventGetProfilingInfoNegativeTest.InvalidEnumeration/SYCL_NATIVE_CPU___SYCL_Native_CPU_
1820
urEventGetProfilingInfoNegativeTest.InvalidValue/SYCL_NATIVE_CPU___SYCL_Native_CPU_

test/conformance/event/urEventGetProfilingInfo.cpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,58 @@ UUR_TEST_SUITE_P(urEventGetProfilingInfoTest,
3030
::testing::Values(UR_PROFILING_INFO_COMMAND_QUEUED,
3131
UR_PROFILING_INFO_COMMAND_SUBMIT,
3232
UR_PROFILING_INFO_COMMAND_START,
33-
UR_PROFILING_INFO_COMMAND_END),
33+
UR_PROFILING_INFO_COMMAND_END,
34+
UR_PROFILING_INFO_COMMAND_COMPLETE),
3435
uur::deviceTestWithParamPrinter<ur_profiling_info_t>);
3536

37+
using urEventGetProfilingInfoWithTimingComparisonTest = uur::event::urEventTest;
38+
39+
TEST_P(urEventGetProfilingInfoWithTimingComparisonTest, Success) {
40+
uint8_t size = 8;
41+
42+
std::vector<uint8_t> queued_data(size);
43+
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
44+
UR_PROFILING_INFO_COMMAND_QUEUED,
45+
size, queued_data.data(), nullptr));
46+
auto queued_timing = reinterpret_cast<size_t *>(queued_data.data());
47+
ASSERT_NE(*queued_timing, 0);
48+
49+
std::vector<uint8_t> submit_data(size);
50+
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
51+
UR_PROFILING_INFO_COMMAND_SUBMIT,
52+
size, submit_data.data(), nullptr));
53+
auto submit_timing = reinterpret_cast<size_t *>(submit_data.data());
54+
ASSERT_NE(*submit_timing, 0);
55+
56+
std::vector<uint8_t> start_data(size);
57+
ASSERT_SUCCESS(urEventGetProfilingInfo(event,
58+
UR_PROFILING_INFO_COMMAND_START,
59+
size, start_data.data(), nullptr));
60+
auto start_timing = reinterpret_cast<size_t *>(start_data.data());
61+
ASSERT_NE(*start_timing, 0);
62+
63+
std::vector<uint8_t> end_data(size);
64+
ASSERT_SUCCESS(urEventGetProfilingInfo(event, UR_PROFILING_INFO_COMMAND_END,
65+
size, end_data.data(), nullptr));
66+
auto end_timing = reinterpret_cast<size_t *>(end_data.data());
67+
ASSERT_NE(*end_timing, 0);
68+
69+
std::vector<uint8_t> complete_data(size);
70+
ASSERT_SUCCESS(
71+
urEventGetProfilingInfo(event, UR_PROFILING_INFO_COMMAND_COMPLETE, size,
72+
complete_data.data(), nullptr));
73+
auto complete_timing = reinterpret_cast<size_t *>(complete_data.data());
74+
ASSERT_NE(*complete_timing, 0);
75+
76+
ASSERT_LE(*queued_timing, *submit_timing);
77+
ASSERT_LT(*submit_timing, *start_timing);
78+
ASSERT_LT(*start_timing, *end_timing);
79+
ASSERT_LE(*end_timing, *complete_timing);
80+
}
81+
82+
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(
83+
urEventGetProfilingInfoWithTimingComparisonTest);
84+
3685
using urEventGetProfilingInfoNegativeTest = uur::event::urEventTest;
3786

3887
TEST_P(urEventGetProfilingInfoNegativeTest, InvalidNullHandle) {

0 commit comments

Comments
 (0)