Skip to content

Transitioned dpctl to require DPC++ 2023, removed host related functions, fixed linker crash, enabled SyclKernel.max_sub_group_size property #1028

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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9aa8e02
Used new in DPC++ 2023 option to fix linker crash
oleksandr-pavlyk Dec 22, 2022
ca987af
Added missing include to defined __SYCL_COMPILER_VERSION
oleksandr-pavlyk Dec 23, 2022
4deadb8
Skipping check for preferred_vector_width_double without fp64 aspect.
oleksandr-pavlyk Dec 23, 2022
d24dcde
Do not exercise DPCTL_HOST backend, and DPCTL_HOST_DEVICE device type…
oleksandr-pavlyk Dec 23, 2022
d1b4d27
Adjusted test for device-specific kernel descriptor private-memory.
oleksandr-pavlyk Dec 23, 2022
1389a32
Change gen_docs.py to use Release build
oleksandr-pavlyk Dec 23, 2022
77efc73
Fixed test_cython_api
oleksandr-pavlyk Dec 23, 2022
2e54bf6
Removed 2023_SWITCHOVER
oleksandr-pavlyk Dec 23, 2022
3267ef6
Added static assert for minimum require compiler version
oleksandr-pavlyk Dec 23, 2022
b4fa9c5
Removed no longer needed include
oleksandr-pavlyk Dec 23, 2022
9259083
Removed obsolete comment
oleksandr-pavlyk Dec 23, 2022
c73190c
Implemented SyclKernel.max_sub_group_size
oleksandr-pavlyk Dec 23, 2022
72622e0
Modified test_async_submit to check status right away
oleksandr-pavlyk Dec 23, 2022
cee5afe
Removed aspect_host, select_host_device, has_host_device
oleksandr-pavlyk Dec 23, 2022
ad85e04
Removed DPCTL_HOST and DPCTL_HOST_DEVICE
oleksandr-pavlyk Dec 23, 2022
97551b6
Removed host-related functions/methods
oleksandr-pavlyk Dec 24, 2022
9aa909f
Added item about removal of Python API functions to ChangeLog
oleksandr-pavlyk Dec 24, 2022
d6ed339
Removed select_host_device instance devices from dpctl_device_selector
oleksandr-pavlyk Dec 24, 2022
8676efe
Documented addition of dpctl.program.SyclKernel.max_sub_group_size pr…
oleksandr-pavlyk Dec 24, 2022
03de8fe
Used Release build type in generate documentation workflow, it is way…
oleksandr-pavlyk Dec 24, 2022
8ca2dd5
Use -g1 for debug build to reduce size of SO with offloaded sections
oleksandr-pavlyk Dec 24, 2022
4b0f484
adjust --ignore-filename-regex to reflect changes in DPC++ 2023
oleksandr-pavlyk Dec 24, 2022
cfefca3
Corrected -ignore-filename-regex in libsyclinterface/tests/CMakeLists…
oleksandr-pavlyk Dec 25, 2022
44a8e38
More verbosity to steps of coverall uploads
oleksandr-pavlyk Dec 26, 2022
3db9c8d
Use different exclusion pattern: /tmp/icpx*
oleksandr-pavlyk Dec 26, 2022
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
13 changes: 10 additions & 3 deletions .github/workflows/generate-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,17 @@ jobs:
- name: Upload coverage data to coveralls.io
shell: bash -l {0}
run: |
echo "Processing c-api-coverage"
export DPCTL_LCOV_FN=$(find _skbuild -name dpctl.lcov)
grep "/tmp" $DPCTL_LCOV_FN
coveralls-lcov -v -n \
$(find _skbuild -name dpctl.lcov) > dpctl-c-api-coverage.json
$DPCTL_LCOV_FN > dpctl-c-api-coverage.json
echo "Processing pytest-coverage"
export DPCTL_PYTEST_LCOV=$(find . -name dpctl_pytest.lcov)
grep "/tmp" $DPCTL_PYTEST_LCOV
coveralls-lcov -v -n \
$(find . -name dpctl_pytest.lcov) > pytest-dpctl-c-api-coverage.json
# merge json files
$DPCTL_PYTEST_LCOV > pytest-dpctl-c-api-coverage.json
echo "Merging JSON files"
python -c "import json; \
fh1 = open('dpctl-c-api-coverage.json', 'r'); \
f1 = json.load(fh1); fh1.close(); \
Expand All @@ -113,6 +119,7 @@ jobs:
ls -lh dpctl-c-api-coverage.json pytest-dpctl-c-api-coverage.json \
combined-dpctl-c-api-coverage.json \
$(find _skbuild -name dpctl.lcov) $(find . -name dpctl_pytest.lcov)
echo "Merging combined files with coverage data"
coveralls --service=github --merge=combined-dpctl-c-api-coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
source /opt/intel/oneapi/setvars.sh
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz
tar xf doxyrest-2.1.2-linux-amd64.tar.xz
python setup.py develop -G Ninja --build-type=Debug \
python setup.py develop -G Ninja --build-type=Release \
-- \
-DCMAKE_C_COMPILER:PATH=$(which icx) \
-DCMAKE_CXX_COMPILER:PATH=$(which icpx) \
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added `dpctl.program.SyclKernel.max_sub_group_size` property [#1208](https://github.com/IntelPython/dpctl/pull/1028).

### Changed

* Removed `dpctl.select_host_device`, `dpctl.has_host_device`, `dpctl.SyclDevice.is_host`, and `dpctl.SyclDevice.has_aspect_host` since support for host device has been removed in DPC++ 2023 and from SYCL 2020 spec [#1208](https://github.com/IntelPython/dpctl/pull/1028).

### Fixed


Expand Down
8 changes: 4 additions & 4 deletions dpctl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ if(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox ${WARNING_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -ggdb3 -DDEBUG"
"${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -g1 -DDEBUG"
)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -ggdb3 -DDEBUG"
"${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -O0 -g1 -DDEBUG"
)
set(DPCTL_LDFLAGS "/link /NXCompat /DynamicBase")
elseif(UNIX)
Expand Down Expand Up @@ -57,10 +57,10 @@ elseif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 ${CXXFLAGS}")
set(CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -ggdb3 -DDEBUG"
"${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -O0 -g1 -DDEBUG"
)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -ggdb3 -DDEBUG"
"${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -O0 -g1 -DDEBUG"
)
set(DPCTL_LDFLAGS "-z,noexecstack,-z,relro,-z,now")
else()
Expand Down
2 changes: 0 additions & 2 deletions dpctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@
has_accelerator_devices,
has_cpu_devices,
has_gpu_devices,
has_host_device,
select_accelerator_device,
select_cpu_device,
select_default_device,
select_gpu_device,
select_host_device,
)
from ._sycl_event import SyclEvent
from ._sycl_platform import SyclPlatform, get_platforms, lsplatform
Expand Down
7 changes: 1 addition & 6 deletions dpctl/_backend.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
ctypedef enum _backend_type 'DPCTLSyclBackendType':
_ALL_BACKENDS 'DPCTL_ALL_BACKENDS'
_CUDA 'DPCTL_CUDA'
_HOST 'DPCTL_HOST'
_LEVEL_ZERO 'DPCTL_LEVEL_ZERO'
_OPENCL 'DPCTL_OPENCL'
_UNKNOWN_BACKEND 'DPCTL_UNKNOWN_BACKEND'
Expand All @@ -49,7 +48,6 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
_CPU 'DPCTL_CPU'
_CUSTOM 'DPCTL_CUSTOM'
_GPU 'DPCTL_GPU'
_HOST_DEVICE 'DPCTL_HOST_DEVICE'
_UNKNOWN_DEVICE 'DPCTL_UNKNOWN_DEVICE'

ctypedef enum _arg_data_type 'DPCTLKernelArgType':
Expand Down Expand Up @@ -174,7 +172,6 @@ cdef extern from "syclinterface/dpctl_sycl_device_interface.h":
cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef)
cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef)
cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef)
cdef bool DPCTLDevice_IsHost(const DPCTLSyclDeviceRef DRef)
cdef bool DPCTLDevice_GetSubGroupIndependentForwardProgress(const DPCTLSyclDeviceRef DRef)
cdef uint32_t DPCTLDevice_GetPreferredVectorWidthChar(const DPCTLSyclDeviceRef DRef)
cdef uint32_t DPCTLDevice_GetPreferredVectorWidthShort(const DPCTLSyclDeviceRef DRef)
Expand Down Expand Up @@ -236,7 +233,6 @@ cdef extern from "syclinterface/dpctl_sycl_device_selector_interface.h":
DPCTLSyclDeviceSelectorRef DPCTLCPUSelector_Create()
DPCTLSyclDeviceSelectorRef DPCTLFilterSelector_Create(const char *)
DPCTLSyclDeviceSelectorRef DPCTLGPUSelector_Create()
DPCTLSyclDeviceSelectorRef DPCTLHostSelector_Create()
void DPCTLDeviceSelector_Delete(DPCTLSyclDeviceSelectorRef)
int DPCTLDeviceSelector_Score(DPCTLSyclDeviceSelectorRef, DPCTLSyclDeviceRef)

Expand Down Expand Up @@ -271,8 +267,7 @@ cdef extern from "syclinterface/dpctl_sycl_kernel_interface.h":
cdef size_t DPCTLKernel_GetPreferredWorkGroupSizeMultiple(const DPCTLSyclKernelRef KRef)
cdef size_t DPCTLKernel_GetPrivateMemSize(const DPCTLSyclKernelRef KRef)
cdef uint32_t DPCTLKernel_GetMaxNumSubGroups(const DPCTLSyclKernelRef KRef)
## Next line is commented out due to issue in DPC++ runtime
# cdef uint32_t DPCTLKernel_GetMaxSubGroupSize(const DPCTLSyclKernelRef KRef)
cdef uint32_t DPCTLKernel_GetMaxSubGroupSize(const DPCTLSyclKernelRef KRef)
cdef uint32_t DPCTLKernel_GetCompileNumSubGroups(const DPCTLSyclKernelRef KRef)
cdef uint32_t DPCTLKernel_GetCompileSubGroupSize(const DPCTLSyclKernelRef KRef)

Expand Down
37 changes: 3 additions & 34 deletions dpctl/_sycl_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ from ._backend cimport ( # noqa: E211
DPCTLDevice_IsAccelerator,
DPCTLDevice_IsCPU,
DPCTLDevice_IsGPU,
DPCTLDevice_IsHost,
DPCTLDeviceMgr_GetDeviceInfoStr,
DPCTLDeviceMgr_GetDevices,
DPCTLDeviceMgr_GetPositionInDevices,
Expand Down Expand Up @@ -162,8 +161,6 @@ cdef list _get_devices(DPCTLDeviceVectorRef DVRef):
cdef str _backend_type_to_filter_string_part(_backend_type BTy):
if BTy == _backend_type._CUDA:
return "cuda"
elif BTy == _backend_type._HOST:
return "host"
elif BTy == _backend_type._LEVEL_ZERO:
return "level_zero"
elif BTy == _backend_type._OPENCL:
Expand All @@ -181,8 +178,6 @@ cdef str _device_type_to_filter_string_part(_device_type DTy):
return "cpu"
elif DTy == _device_type._GPU:
return "gpu"
elif DTy == _device_type._HOST_DEVICE:
return "host"
else:
return "unknown"

Expand Down Expand Up @@ -222,7 +217,6 @@ cdef class SyclDevice(_SyclDevice):
:func:`dpctl.select_cpu_device()`,
:func:`dpctl.select_default_device()`,
:func:`dpctl.select_gpu_device()`,
:func:`dpctl.select_host_device()`.


:Example:
Expand Down Expand Up @@ -359,8 +353,6 @@ cdef class SyclDevice(_SyclDevice):
)
if BTy == _backend_type._CUDA:
return backend_type.cuda
elif BTy == _backend_type._HOST:
return backend_type.host
elif BTy == _backend_type._LEVEL_ZERO:
return backend_type.level_zero
elif BTy == _backend_type._OPENCL:
Expand Down Expand Up @@ -388,21 +380,9 @@ cdef class SyclDevice(_SyclDevice):
return device_type.cpu
elif DTy == _device_type._GPU:
return device_type.gpu
elif DTy == _device_type._HOST_DEVICE:
return device_type.host
else:
raise ValueError("Unknown device type.")

@property
def has_aspect_host(self):
""" Returns True if this device is a host device, False otherwise.

Returns:
bool: Indicates if the device is a host device.
"""
cdef _aspect_type AT = _aspect_type._host
return DPCTLDevice_HasAspect(self._device_ref, AT)

@property
def has_aspect_cpu(self):
""" Returns True if this device is a CPU device, False otherwise.
Expand Down Expand Up @@ -729,15 +709,6 @@ cdef class SyclDevice(_SyclDevice):
"""
return DPCTLDevice_IsGPU(self._device_ref)

@property
def is_host(self):
""" Returns True if the SyclDevice instance is a SYCL host device.

Returns:
bool: True if the SyclDevice is a SYCL host device, else False.
"""
return DPCTLDevice_IsHost(self._device_ref)

@property
def max_work_item_dims(self):
""" Returns the maximum dimensions that specify the global and local
Expand Down Expand Up @@ -866,11 +837,9 @@ cdef class SyclDevice(_SyclDevice):
int: The maximum number of sub-groups support per work-group by
the device.
"""
cdef uint32_t max_num_sub_groups = 0
if (not self.is_host):
max_num_sub_groups = (
DPCTLDevice_GetMaxNumSubGroups(self._device_ref)
)
cdef uint32_t max_num_sub_groups = (
DPCTLDevice_GetMaxNumSubGroups(self._device_ref)
)
return max_num_sub_groups

@property
Expand Down
2 changes: 0 additions & 2 deletions dpctl/_sycl_device_factory.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ cpdef SyclDevice select_accelerator_device()
cpdef SyclDevice select_cpu_device()
cpdef SyclDevice select_default_device()
cpdef SyclDevice select_gpu_device()
cpdef SyclDevice select_host_device()
cpdef list get_devices(backend=*, device_type=*)
cpdef int get_num_devices(backend=*, device_type=*)
cpdef cpp_bool has_gpu_devices()
cpdef cpp_bool has_cpu_devices()
cpdef cpp_bool has_accelerator_devices()
cpdef cpp_bool has_host_device()
44 changes: 0 additions & 44 deletions dpctl/_sycl_device_factory.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ from ._backend cimport ( # noqa: E211
DPCTLDeviceVector_Size,
DPCTLDeviceVectorRef,
DPCTLGPUSelector_Create,
DPCTLHostSelector_Create,
DPCTLSyclDeviceRef,
DPCTLSyclDeviceSelectorRef,
_backend_type,
Expand All @@ -56,12 +55,10 @@ __all__ = [
"select_cpu_device",
"select_default_device",
"select_gpu_device",
"select_host_device",
"get_num_devices",
"has_cpu_devices",
"has_gpu_devices",
"has_accelerator_devices",
"has_host_device",
]


Expand All @@ -71,8 +68,6 @@ cdef _backend_type _string_to_dpctl_sycl_backend_ty(str backend_str):
return _backend_type._ALL_BACKENDS
elif backend_str == "cuda":
return _backend_type._CUDA
elif backend_str == "host":
return _backend_type._HOST
elif backend_str == "level_zero":
return _backend_type._LEVEL_ZERO
elif backend_str == "opencl":
Expand All @@ -95,8 +90,6 @@ cdef _device_type _string_to_dpctl_sycl_device_ty(str dty_str):
return _device_type._CUSTOM
elif dty_str == "gpu":
return _device_type._GPU
elif dty_str == "host":
return _device_type._HOST_DEVICE
else:
return _device_type._UNKNOWN_DEVICE

Expand All @@ -106,8 +99,6 @@ cdef _backend_type _enum_to_dpctl_sycl_backend_ty(BTy):
return _backend_type._ALL_BACKENDS
elif BTy == backend_type.cuda:
return _backend_type._CUDA
elif BTy == backend_type.host:
return _backend_type._HOST
elif BTy == backend_type.level_zero:
return _backend_type._LEVEL_ZERO
elif BTy == backend_type.opencl:
Expand All @@ -129,8 +120,6 @@ cdef _device_type _enum_to_dpctl_sycl_device_ty(DTy):
return _device_type._CUSTOM
elif DTy == device_type_t.gpu:
return _device_type._GPU
elif DTy == device_type_t.host:
return _device_type._HOST_DEVICE
else:
return _device_type._UNKNOWN_DEVICE

Expand Down Expand Up @@ -288,19 +277,6 @@ cpdef cpp_bool has_accelerator_devices():
return <cpp_bool>num_accelerator_dev


cpdef cpp_bool has_host_device():
""" A helper function to check if there are any SYCL Host devices available.

Returns:
bool: ``True`` if ``sycl::device_type::host`` devices are present,
``False`` otherwise.
"""
cdef int num_host_dev = DPCTLDeviceMgr_GetNumDevices(
_device_type._HOST_DEVICE
)
return <cpp_bool>num_host_dev


cpdef SyclDevice select_accelerator_device():
""" A wrapper for SYCL's ``accelerator_selector`` class.

Expand Down Expand Up @@ -379,23 +355,3 @@ cpdef SyclDevice select_gpu_device():
raise SyclDeviceCreationError("Device unavailable.")
Device = SyclDevice._create(DRef)
return Device


cpdef SyclDevice select_host_device():
""" A wrapper for SYCL's ``host_selector`` class.

Returns:
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
returned by the SYCL ``host_selector``.
Raises:
dpctl.SyclDeviceCreationError: If the SYCL ``host_selector`` is
unable to select a ``device``.
"""
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLHostSelector_Create()
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)
# Free up the device selector
DPCTLDeviceSelector_Delete(DSRef)
if DRef is NULL:
raise SyclDeviceCreationError("Host device is unavailable.")
Device = SyclDevice._create(DRef)
return Device
2 changes: 0 additions & 2 deletions dpctl/_sycl_event.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,6 @@ cdef class SyclEvent(_SyclEvent):
return backend_type.opencl
elif BE == _backend_type._LEVEL_ZERO:
return backend_type.level_zero
elif BE == _backend_type._HOST:
return backend_type.host
elif BE == _backend_type._CUDA:
return backend_type.cuda
else:
Expand Down
2 changes: 0 additions & 2 deletions dpctl/_sycl_platform.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ cdef class SyclPlatform(_SyclPlatform):
)
if BTy == _backend_type._CUDA:
return backend_type.cuda
elif BTy == _backend_type._HOST:
return backend_type.host
elif BTy == _backend_type._LEVEL_ZERO:
return backend_type.level_zero
elif BTy == _backend_type._OPENCL:
Expand Down
2 changes: 0 additions & 2 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,6 @@ cdef class SyclQueue(_SyclQueue):
return backend_type.opencl
elif BE == _backend_type._LEVEL_ZERO:
return backend_type.level_zero
elif BE == _backend_type._HOST:
return backend_type.host
elif BE == _backend_type._CUDA:
return backend_type.cuda
else:
Expand Down
2 changes: 0 additions & 2 deletions dpctl/enum_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class device_type(Enum):
cpu = auto()
custom = auto()
gpu = auto()
host = auto()


class backend_type(Enum):
Expand All @@ -74,7 +73,6 @@ class backend_type(Enum):

all = auto()
cuda = auto()
host = auto()
level_zero = auto()
opencl = auto()

Expand Down
Loading