Skip to content

Fix build break with open-source intel/llvm DPC++ #876

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

Merged
merged 4 commits into from
Aug 8, 2022
Merged
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
4 changes: 3 additions & 1 deletion dpctl/_backend.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h":
cdef uint32_t DPCTLDevice_GetMaxNumSubGroups(const DPCTLSyclDeviceRef DRef)
cdef size_t DPCTLDevice_GetMaxWorkGroupSize(const DPCTLSyclDeviceRef DRef)
cdef uint32_t DPCTLDevice_GetMaxWorkItemDims(const DPCTLSyclDeviceRef DRef)
cdef size_t *DPCTLDevice_GetMaxWorkItemSizes(const DPCTLSyclDeviceRef DRef)
cdef size_t *DPCTLDevice_GetMaxWorkItemSizes1d(const DPCTLSyclDeviceRef DRef)
cdef size_t *DPCTLDevice_GetMaxWorkItemSizes2d(const DPCTLSyclDeviceRef DRef)
cdef size_t *DPCTLDevice_GetMaxWorkItemSizes3d(const DPCTLSyclDeviceRef DRef)
cdef const char *DPCTLDevice_GetName(const DPCTLSyclDeviceRef DRef)
cdef DPCTLSyclPlatformRef DPCTLDevice_GetPlatform(
const DPCTLSyclDeviceRef DRef)
Expand Down
56 changes: 53 additions & 3 deletions dpctl/_sycl_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ from ._backend cimport ( # noqa: E211
DPCTLDevice_GetMaxReadImageArgs,
DPCTLDevice_GetMaxWorkGroupSize,
DPCTLDevice_GetMaxWorkItemDims,
DPCTLDevice_GetMaxWorkItemSizes,
DPCTLDevice_GetMaxWorkItemSizes1d,
DPCTLDevice_GetMaxWorkItemSizes2d,
DPCTLDevice_GetMaxWorkItemSizes3d,
DPCTLDevice_GetMaxWriteImageArgs,
DPCTLDevice_GetName,
DPCTLDevice_GetParentDevice,
Expand Down Expand Up @@ -185,7 +187,7 @@ cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef):
device._name = DPCTLDevice_GetName(DRef)
device._driver_version = DPCTLDevice_GetDriverVersion(DRef)
device._vendor = DPCTLDevice_GetVendor(DRef)
device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes(DRef)
device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes3d(DRef)


cdef class SyclDevice(_SyclDevice):
Expand Down Expand Up @@ -263,7 +265,7 @@ cdef class SyclDevice(_SyclDevice):
self._name = DPCTLDevice_GetName(self._device_ref)
self._driver_version = DPCTLDevice_GetDriverVersion(self._device_ref)
self._max_work_item_sizes = (
DPCTLDevice_GetMaxWorkItemSizes(self._device_ref)
DPCTLDevice_GetMaxWorkItemSizes3d(self._device_ref)
)
self._vendor = DPCTLDevice_GetVendor(self._device_ref)
return 0
Expand Down Expand Up @@ -648,13 +650,61 @@ cdef class SyclDevice(_SyclDevice):
max_work_item_dims = DPCTLDevice_GetMaxWorkItemDims(self._device_ref)
return max_work_item_dims

@property
def max_work_item_sizes1d(self):
""" Returns the maximum number of work-items that are permitted in each
dimension of the work-group of the nd_range<1>. The minimum value is
`(1 )` for devices that are not of device type
``info::device_type::custom``.
"""
cdef size_t *max_work_item_sizes1d = NULL
max_work_item_sizes1d = DPCTLDevice_GetMaxWorkItemSizes1d(
self._device_ref
)
res = (max_work_item_sizes1d[0], )
DPCTLSize_t_Array_Delete(max_work_item_sizes1d)
return res

@property
def max_work_item_sizes2d(self):
""" Returns the maximum number of work-items that are permitted in each
dimension of the work-group of the nd_range<2>. The minimum value is
`(1; 1)` for devices that are not of device type
``info::device_type::custom``.
"""
cdef size_t *max_work_item_sizes2d = NULL
max_work_item_sizes2d = DPCTLDevice_GetMaxWorkItemSizes2d(
self._device_ref
)
res = (max_work_item_sizes2d[0], max_work_item_sizes2d[1],)
DPCTLSize_t_Array_Delete(max_work_item_sizes2d)
return res

@property
def max_work_item_sizes3d(self):
""" Returns the maximum number of work-items that are permitted in each
dimension of the work-group of the nd_range<3>. The minimum value is
`(1; 1; 1)` for devices that are not of device type
``info::device_type::custom``.
"""
return (
self._max_work_item_sizes[0],
self._max_work_item_sizes[1],
self._max_work_item_sizes[2],
)

@property
def max_work_item_sizes(self):
""" Returns the maximum number of work-items that are permitted in each
dimension of the work-group of the nd_range. The minimum value is
`(1; 1; 1)` for devices that are not of device type
``info::device_type::custom``.
"""
warnings.warn(
"dpctl.SyclDevice.max_work_item_sizes is deprecated, "
"use dpctl.SyclDevice.max_work_item_sizes3d instead",
DeprecationWarning,
)
return (
self._max_work_item_sizes[0],
self._max_work_item_sizes[1],
Expand Down
Loading