Skip to content

Commit a33c03f

Browse files
author
Diptorup Deb
authored
Merge pull request #1072 from IntelPython/fix/jenkins_ci
Fix jenkins CI
2 parents 3f84781 + b109496 commit a33c03f

File tree

6 files changed

+59
-9
lines changed

6 files changed

+59
-9
lines changed

conda-recipe/run_test.bat

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
pytest -q -ra --disable-warnings --pyargs numba_dpex -vv
2-
IF %ERRORLEVEL% NEQ 0 exit /B 1
1+
set "ONEAPI_DEVICE_SELECTOR="
2+
3+
for /F "USEBACKQ tokens=* delims=" %%F in (
4+
`python -c "import dpctl; print(\"\n\".join([dev.backend.name+\":\"+dev.device_type.name for dev in dpctl.get_devices() if dev.device_type.name in [\"cpu\",\"gpu\"]]))"`
5+
) do (
6+
set "ONEAPI_DEVICE_SELECTOR=%%F"
7+
8+
pytest -q -ra --disable-warnings --pyargs numba_dpex -vv
9+
IF %ERRORLEVEL% NEQ 0 exit /B 1
10+
)
311

412
exit /B 0

conda-recipe/run_test.sh

100644100755
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/bin/bash
22

33
set -euxo pipefail
4+
unset ONEAPI_DEVICE_SELECTOR
45

5-
pytest -q -ra --disable-warnings --pyargs numba_dpex -vv
6+
for selector in $(python -c "import dpctl; print(\" \".join([dev.backend.name+\":\"+dev.device_type.name for dev in dpctl.get_devices() if dev.device_type.name in [\"cpu\",\"gpu\"]]))")
7+
do
8+
export "ONEAPI_DEVICE_SELECTOR=$selector"
9+
unset NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
610

7-
export NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
11+
pytest -q -ra --disable-warnings --pyargs numba_dpex -vv
812

9-
pytest -q -ra --disable-warnings -vv \
10-
--pyargs numba_dpex.tests.kernel_tests.test_atomic_op::test_atomic_fp_native
13+
export NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
14+
15+
pytest -q -ra --disable-warnings -vv \
16+
--pyargs numba_dpex.tests.kernel_tests.test_atomic_op::test_atomic_fp_native
17+
done
1118

1219
exit 0

numba_dpex/core/parfors/kernel_builder.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from numba_dpex import config
2929

3030
from ..descriptor import dpex_kernel_target
31-
from ..types.dpnp_ndarray_type import DpnpNdArray
31+
from ..types import DpnpNdArray, USMNdArray
3232
from ..utils.kernel_templates import RangeKernelTemplate
3333

3434

@@ -70,6 +70,30 @@ def _compile_kernel_parfor(
7070
func_ir, kernel_name
7171
)
7272

73+
# A cast from DpnpNdArray type to USMNdArray is needed for all arguments of
74+
# DpnpNdArray type. Although, DpnpNdArray derives from USMNdArray the two
75+
# types use different data models. USMNdArray uses the
76+
# numba_dpex.core.datamodel.models.ArrayModel data model that defines all
77+
# CPointer type members in the GLOBAL address space. The DpnpNdArray uses
78+
# Numba's default ArrayModel that does not define pointers in any specific
79+
# address space. For OpenCL HD Graphics devices, defining a kernel function
80+
# (spir_kernel calling convention) with pointer arguments that have no
81+
# address space qualifier causes a run time crash. By casting the argument
82+
# type for parfor arguments from DpnpNdArray type to the USMNdArray type the
83+
# generated kernel always has an address space qualifier, avoiding the issue
84+
# on OpenCL HD graphics devices.
85+
86+
for i, argty in enumerate(argtypes):
87+
if isinstance(argty, DpnpNdArray):
88+
new_argty = USMNdArray(
89+
ndim=argty.ndim,
90+
layout=argty.layout,
91+
dtype=argty.dtype,
92+
usm_type=argty.usm_type,
93+
queue=argty.queue,
94+
)
95+
argtypes[i] = new_argty
96+
7397
# compile the kernel
7498
kernel.compile(
7599
args=argtypes,

numba_dpex/core/types/dpnp_ndarray_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
5858
else:
5959
return
6060

61+
def __str__(self):
62+
return self.name.replace("USMNdArray", "DpnpNdarray")
63+
64+
def __repr__(self):
65+
return self.__str__()
66+
6167
def __allocate__(
6268
self,
6369
typingctx,

numba_dpex/core/types/usm_ndarray_type.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __init__(
8787
self.dtype = dtype
8888

8989
if name is None:
90-
type_name = "usm_ndarray"
90+
type_name = "USMNdArray"
9191
if readonly:
9292
type_name = "readonly " + type_name
9393
if not aligned:
@@ -116,6 +116,9 @@ def __init__(
116116
aligned=aligned,
117117
)
118118

119+
def __repr__(self):
120+
return self.name
121+
119122
def copy(
120123
self,
121124
dtype=None,

numba_dpex/tests/core/passes/test_parfor_legalize_cfd_pass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from numba_dpex import dpjit
1616
from numba_dpex.core.exceptions import ExecutionQueueInferenceError
17-
from numba_dpex.tests._helper import skip_no_opencl_gpu
17+
from numba_dpex.tests._helper import skip_no_opencl_cpu, skip_no_opencl_gpu
1818

1919
shapes = [10, (2, 5)]
2020
dtypes = [dpnp.int32, dpnp.int64, dpnp.float32, dpnp.float64]
@@ -58,6 +58,7 @@ def test_parfor_legalize_cfd_pass(shape, dtype, usm_type, device):
5858

5959

6060
@skip_no_opencl_gpu
61+
@skip_no_opencl_cpu
6162
def test_parfor_legalize_cfd_pass_raise():
6263
a = dpnp.zeros(shape=10, device="cpu")
6364
b = dpnp.ones(shape=10, device="gpu")
@@ -67,6 +68,7 @@ def test_parfor_legalize_cfd_pass_raise():
6768

6869

6970
@skip_no_opencl_gpu
71+
@skip_no_opencl_cpu
7072
def test_cfd_error_due_to_lhs():
7173
a = dpnp.zeros(shape=10, device="cpu")
7274
b = dpnp.ones(shape=10, device="cpu")

0 commit comments

Comments
 (0)