File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h":
190
190
const DPCTLSyclDeviceRef DRef,
191
191
_partition_affinity_domain_type PartitionAffinityDomainTy)
192
192
cdef DPCTLSyclDeviceRef DPCTLDevice_GetParentDevice(const DPCTLSyclDeviceRef DRef)
193
+ cdef size_t DPCTLDevice_GetProfilingTimerResolution(const DPCTLSyclDeviceRef DRef)
193
194
194
195
195
196
cdef extern from " syclinterface/dpctl_sycl_device_manager.h" :
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ from ._backend cimport ( # noqa: E211
57
57
DPCTLDevice_GetPreferredVectorWidthInt,
58
58
DPCTLDevice_GetPreferredVectorWidthLong,
59
59
DPCTLDevice_GetPreferredVectorWidthShort,
60
+ DPCTLDevice_GetProfilingTimerResolution,
60
61
DPCTLDevice_GetSubGroupIndependentForwardProgress,
61
62
DPCTLDevice_GetVendor,
62
63
DPCTLDevice_HasAspect,
@@ -924,6 +925,19 @@ cdef class SyclDevice(_SyclDevice):
924
925
return None
925
926
return SyclDevice._create(pDRef)
926
927
928
+ @property
929
+ def profiling_timer_resolution (self ):
930
+ """ Profiling timer resolution.
931
+
932
+ Returns:
933
+ int: The resolution of device timer in nanoseconds.
934
+ """
935
+ cdef size_t timer_res = 0
936
+ timer_res = DPCTLDevice_GetProfilingTimerResolution(self ._device_ref)
937
+ if (timer_res == 0 ):
938
+ raise RuntimeError (" Failed to get device timer resolution." )
939
+ return timer_res
940
+
927
941
cdef cpp_bool equals(self , SyclDevice other):
928
942
""" Returns ``True`` if the :class:`dpctl.SyclDevice` argument has the
929
943
same _device_ref as this SyclDevice.
Original file line number Diff line number Diff line change @@ -485,6 +485,17 @@ def check_repr(device):
485
485
assert type (repr (device )) is str
486
486
487
487
488
+ def check_profiling_timer_resolution (device ):
489
+ try :
490
+ resol = device .profiling_timer_resolution
491
+ except Exception :
492
+ pytest .fail (
493
+ "Encountered an exception inside "
494
+ "profiling_timer_resolution property."
495
+ )
496
+ assert isinstance (resol , int ) and resol > 0
497
+
498
+
488
499
list_of_checks = [
489
500
check_get_max_compute_units ,
490
501
check_get_max_work_item_dims ,
You can’t perform that action at this time.
0 commit comments