Skip to content

Commit 56df1cf

Browse files
Added Python API for new descriptors
SyclDevice.max_clock_frequency: returns in MHz as type int SyclDevice.max_mem_alloc_size: returns in bytes as type int
1 parent c6f1b4f commit 56df1cf

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

dpctl/_backend.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h":
216216
cdef size_t *DPCTLDevice_GetSubGroupSizes(const DPCTLSyclDeviceRef DRef,
217217
size_t *res_len)
218218
cdef uint32_t DPCTLDevice_GetPartitionMaxSubDevices(const DPCTLSyclDeviceRef DRef)
219+
cdef uint32_t DPCTLDevice_GetMaxClockFrequency(const DPCTLSyclDeviceRef DRef)
220+
cdef uint64_t DPCTLDevice_GetMaxMemAllocSize(const DPCTLSyclDeviceRef DRef)
219221

220222

221223
cdef extern from "syclinterface/dpctl_sycl_device_manager.h":

dpctl/_sycl_device.pyx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ from ._backend cimport ( # noqa: E211
4444
DPCTLDevice_GetImage3dMaxHeight,
4545
DPCTLDevice_GetImage3dMaxWidth,
4646
DPCTLDevice_GetLocalMemSize,
47+
DPCTLDevice_GetMaxClockFrequency,
4748
DPCTLDevice_GetMaxComputeUnits,
49+
DPCTLDevice_GetMaxMemAllocSize,
4850
DPCTLDevice_GetMaxNumSubGroups,
4951
DPCTLDevice_GetMaxReadImageArgs,
5052
DPCTLDevice_GetMaxWorkGroupSize,
@@ -1294,6 +1296,30 @@ cdef class SyclDevice(_SyclDevice):
12941296
raise RuntimeError("Failed to get device timer resolution.")
12951297
return timer_res
12961298

1299+
@property
1300+
def max_clock_frequency(self):
1301+
""" Maximal clock frequency in MHz.
1302+
1303+
Returns:
1304+
int: Frequency in MHz
1305+
"""
1306+
cdef uint32_t clock_fr = DPCTLDevice_GetMaxClockFrequency(
1307+
self._device_ref
1308+
)
1309+
return clock_fr
1310+
1311+
@property
1312+
def max_mem_alloc_size(self):
1313+
""" Maximum size of memory object than can be allocated.
1314+
1315+
Returns:
1316+
int: Maximum size of memory object in bytes
1317+
"""
1318+
cdef uint64_t max_alloc_sz = DPCTLDevice_GetMaxMemAllocSize(
1319+
self._device_ref
1320+
)
1321+
return max_alloc_sz
1322+
12971323
@property
12981324
def global_mem_cache_type(self):
12991325
""" Global device cache memory type.

0 commit comments

Comments
 (0)