Skip to content

Commit fedc71b

Browse files
Merge pull request #1302 from IntelPython/update-for-cython-3
Update for cython 3
2 parents f0bbafc + 5d95918 commit fedc71b

File tree

16 files changed

+16
-51
lines changed

16 files changed

+16
-51
lines changed

.github/workflows/generate-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: Install dpctl dependencies
8080
shell: bash -l {0}
8181
run: |
82-
pip install numpy cython"<3" setuptools pytest pytest-cov scikit-build cmake coverage[toml]
82+
pip install numpy cython setuptools pytest pytest-cov scikit-build cmake coverage[toml]
8383
8484
- name: Build dpctl with coverage
8585
shell: bash -l {0}

.github/workflows/generate-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
5050
shell: bash -l {0}
5151
run: |
52-
pip install numpy cython"<3" setuptools scikit-build cmake sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
52+
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
5353
- name: Checkout repo
5454
uses: actions/checkout@v3
5555
with:

.github/workflows/os-llvm-sycl-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- name: Install dpctl dependencies
109109
shell: bash -l {0}
110110
run: |
111-
pip install numpy cython"<3" setuptools pytest scikit-build cmake
111+
pip install numpy cython setuptools pytest scikit-build cmake
112112
113113
- name: Checkout repo
114114
uses: actions/checkout@v3

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ requirements:
2020
- cmake >=3.21
2121
- ninja
2222
- git
23-
- cython <3
23+
- cython
2424
- python
2525
- scikit-build
2626
- numpy

dpctl/_backend.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
9595
_usm_device_allocations 'usm_device_allocations',
9696
_usm_host_allocations 'usm_host_allocations',
9797
_usm_shared_allocations 'usm_shared_allocations',
98-
_usm_restricted_shared_allocations 'usm_restricted_shared_allocations',
9998
_usm_system_allocations 'usm_system_allocations',
10099
_usm_atomic_host_allocations 'usm_atomic_host_allocations',
101100
_usm_atomic_shared_allocations 'usm_atomic_shared_allocations',

dpctl/_sycl_context.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ cdef class SyclContextCreationError(Exception):
6868
pass
6969

7070

71-
cdef void _context_capsule_deleter(object o):
71+
cdef void _context_capsule_deleter(object o) noexcept:
7272
cdef DPCTLSyclContextRef CRef = NULL
7373
if pycapsule.PyCapsule_IsValid(o, "SyclContextRef"):
7474
CRef = <DPCTLSyclContextRef> pycapsule.PyCapsule_GetPointer(

dpctl/_sycl_device.pyx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -597,20 +597,6 @@ cdef class SyclDevice(_SyclDevice):
597597
cdef _aspect_type AT = _aspect_type._usm_shared_allocations
598598
return DPCTLDevice_HasAspect(self._device_ref, AT)
599599

600-
@property
601-
def has_aspect_usm_restricted_shared_allocations(self):
602-
""" Returns True if this device supports USM memory
603-
allocated as restricted USM, False otherwise.
604-
605-
Returns:
606-
bool: Indicates that the device supports USM memory allocated using
607-
``sycl::malloc_shared`` as restricted USM.
608-
609-
.. deprecated:: 0.14
610-
"""
611-
cdef _aspect_type AT = _aspect_type._usm_restricted_shared_allocations
612-
return DPCTLDevice_HasAspect(self._device_ref, AT)
613-
614600
@property
615601
def has_aspect_usm_system_allocations(self):
616602
""" Returns True if system allocator may be used instead of SYCL USM

dpctl/_sycl_event.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ cdef api SyclEvent SyclEvent_Make(DPCTLSyclEventRef ERef):
7373
return SyclEvent._create(copied_ERef)
7474

7575

76-
cdef void _event_capsule_deleter(object o):
76+
cdef void _event_capsule_deleter(object o) noexcept:
7777
cdef DPCTLSyclEventRef ERef = NULL
7878
if pycapsule.PyCapsule_IsValid(o, "SyclEventRef"):
7979
ERef = <DPCTLSyclEventRef> pycapsule.PyCapsule_GetPointer(

dpctl/_sycl_queue.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ cdef class SyclAsynchronousError(Exception):
121121
"""
122122

123123

124-
cdef void default_async_error_handler(int err) nogil except *:
124+
cdef void default_async_error_handler(int err) except * nogil:
125125
with gil:
126126
raise SyclAsynchronousError(err)
127127

@@ -159,7 +159,7 @@ cdef int _parse_queue_properties(object prop) except *:
159159
return res
160160

161161

162-
cdef void _queue_capsule_deleter(object o):
162+
cdef void _queue_capsule_deleter(object o) noexcept:
163163
cdef DPCTLSyclQueueRef QRef = NULL
164164
if pycapsule.PyCapsule_IsValid(o, "SyclQueueRef"):
165165
QRef = <DPCTLSyclQueueRef> pycapsule.PyCapsule_GetPointer(

dpctl/apis/include/dpctl_capi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
// Ordering of includes is important here. dpctl_sycl_types defines types
2929
// used by dpctl's Python C-API headers.
3030
#include "syclinterface/dpctl_sycl_types.h"
31+
#define CYTHON_EXTERN_C extern "C"
3132
#include "../_sycl_device.h"
3233
#include "../_sycl_device_api.h"
3334
#include "../_sycl_context.h"

dpctl/tensor/_dlpack.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,23 @@ def get_build_dlpack_version():
106106
return str(DLPACK_VERSION)
107107

108108

109-
cdef void _pycapsule_deleter(object dlt_capsule):
109+
cdef void _pycapsule_deleter(object dlt_capsule) noexcept:
110110
cdef DLManagedTensor *dlm_tensor = NULL
111111
if cpython.PyCapsule_IsValid(dlt_capsule, 'dltensor'):
112112
dlm_tensor = <DLManagedTensor*>cpython.PyCapsule_GetPointer(
113113
dlt_capsule, 'dltensor')
114114
dlm_tensor.deleter(dlm_tensor)
115115

116116

117-
cdef void _managed_tensor_deleter(DLManagedTensor *dlm_tensor) with gil:
117+
cdef void _managed_tensor_deleter(DLManagedTensor *dlm_tensor) noexcept with gil:
118118
if dlm_tensor is not NULL:
119119
stdlib.free(dlm_tensor.dl_tensor.shape)
120120
cpython.Py_DECREF(<usm_ndarray>dlm_tensor.manager_ctx)
121121
dlm_tensor.manager_ctx = NULL
122122
stdlib.free(dlm_tensor)
123123

124124

125-
cpdef to_dlpack_capsule(usm_ndarray usm_ary) except+:
125+
cpdef to_dlpack_capsule(usm_ndarray usm_ary):
126126
"""
127127
to_dlpack_capsule(usm_ary)
128128
@@ -288,7 +288,7 @@ cdef class _DLManagedTensorOwner:
288288
return res
289289

290290

291-
cpdef usm_ndarray from_dlpack_capsule(object py_caps) except +:
291+
cpdef usm_ndarray from_dlpack_capsule(object py_caps):
292292
"""
293293
from_dlpack_capsule(caps)
294294

dpctl/tests/_device_attributes_checks.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,6 @@ def check_has_aspect_usm_shared_allocations(device):
217217
pytest.fail("has_aspect_usm_shared_allocations call failed")
218218

219219

220-
def check_has_aspect_usm_restricted_shared_allocations(device):
221-
try:
222-
device.has_aspect_usm_restricted_shared_allocations
223-
except Exception:
224-
pytest.fail("has_aspect_usm_restricted_shared_allocations call failed")
225-
226-
227220
def check_has_aspect_usm_system_allocations(device):
228221
try:
229222
device.has_aspect_usm_system_allocations
@@ -688,7 +681,6 @@ def check_global_mem_cache_line_size(device):
688681
check_has_aspect_usm_device_allocations,
689682
check_has_aspect_usm_host_allocations,
690683
check_has_aspect_usm_shared_allocations,
691-
check_has_aspect_usm_restricted_shared_allocations,
692684
check_has_aspect_usm_system_allocations,
693685
check_has_aspect_usm_atomic_host_allocations,
694686
check_has_aspect_usm_atomic_shared_allocations,

libsyclinterface/helper/source/dpctl_utils_helper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ std::string DPCTL_AspectToStr(aspect aspectTy)
202202
case aspect::usm_shared_allocations:
203203
ss << "usm_shared_allocations";
204204
break;
205-
case aspect::usm_restricted_shared_allocations:
206-
ss << "usm_restricted_shared_allocations";
207-
break;
208205
case aspect::usm_system_allocations:
209206
ss << "usm_system_allocations";
210207
break;
@@ -271,9 +268,6 @@ aspect DPCTL_StrToAspectType(const std::string &aspectTyStr)
271268
else if (aspectTyStr == "usm_shared_allocations") {
272269
aspectTy = aspect::usm_shared_allocations;
273270
}
274-
else if (aspectTyStr == "usm_restricted_shared_allocations") {
275-
aspectTy = aspect::usm_restricted_shared_allocations;
276-
}
277271
else if (aspectTyStr == "usm_system_allocations") {
278272
aspectTy = aspect::usm_system_allocations;
279273
}
@@ -324,8 +318,6 @@ aspect DPCTL_DPCTLAspectTypeToSyclAspect(DPCTLSyclAspectType AspectTy)
324318
return aspect::usm_host_allocations;
325319
case DPCTLSyclAspectType::usm_shared_allocations:
326320
return aspect::usm_shared_allocations;
327-
case DPCTLSyclAspectType::usm_restricted_shared_allocations:
328-
return aspect::usm_restricted_shared_allocations;
329321
case DPCTLSyclAspectType::usm_system_allocations:
330322
return aspect::usm_system_allocations;
331323
case DPCTLSyclAspectType::usm_atomic_host_allocations:
@@ -370,8 +362,6 @@ DPCTLSyclAspectType DPCTL_SyclAspectToDPCTLAspectType(aspect Aspect)
370362
return DPCTLSyclAspectType::usm_host_allocations;
371363
case aspect::usm_shared_allocations:
372364
return DPCTLSyclAspectType::usm_shared_allocations;
373-
case aspect::usm_restricted_shared_allocations:
374-
return DPCTLSyclAspectType::usm_restricted_shared_allocations;
375365
case aspect::usm_system_allocations:
376366
return DPCTLSyclAspectType::usm_system_allocations;
377367
case aspect::usm_atomic_host_allocations:

libsyclinterface/include/dpctl_sycl_enum_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ typedef enum
127127
usm_device_allocations,
128128
usm_host_allocations,
129129
usm_shared_allocations,
130-
usm_restricted_shared_allocations,
131130
usm_system_allocations,
132131
usm_atomic_host_allocations,
133132
usm_atomic_shared_allocations,

libsyclinterface/tests/test_sycl_device_aspects.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ auto build_params()
117117
sycl::aspect::usm_host_allocations),
118118
std::make_pair("usm_shared_allocations",
119119
sycl::aspect::usm_shared_allocations),
120-
std::make_pair("usm_restricted_shared_allocations",
121-
sycl::aspect::usm_restricted_shared_allocations),
122120
std::make_pair("usm_system_allocations",
123121
sycl::aspect::usm_system_allocations),
124122
std::make_pair("usm_atomic_host_allocations",

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,20 @@ def _get_cmdclass():
178178
package_data={"dpctl": ["tests/*.*", "tests/helper/*.py"]},
179179
include_package_data=True,
180180
zip_safe=False,
181-
setup_requires=["Cython<3"],
181+
setup_requires=["Cython"],
182182
install_requires=[
183183
"numpy",
184184
],
185185
extras_require={
186186
"docs": [
187-
"Cython<3",
187+
"Cython",
188188
"sphinx",
189189
"sphinx_rtd_theme",
190190
"pydot",
191191
"graphviz",
192192
"sphinxcontrib-programoutput",
193193
],
194-
"coverage": ["Cython<3", "pytest", "pytest-cov", "coverage", "tomli"],
194+
"coverage": ["Cython", "pytest", "pytest-cov", "coverage", "tomli"],
195195
},
196196
keywords="dpctl",
197197
classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f],

0 commit comments

Comments
 (0)