Skip to content

Commit ffee895

Browse files
author
Diptorup Deb
authored
Merge pull request #1096 from IntelPython/main
Merge tag 0.21.1 into gold/2021
2 parents c37e360 + a421647 commit ffee895

27 files changed

+781
-317
lines changed

.github/workflows/docker.yml

Lines changed: 121 additions & 73 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.21.1] - 2023-07-17
8+
9+
### Changed
10+
* Improved support for `queue` keyword in dpnp array constructor overloads (#1083)
11+
* Improved reduction kernel example (#1089)
12+
13+
### Fixed
14+
* Update Itanium CXX ABI Mangler reference (#1080)
15+
* Update sourceware references in docstrings (#1081)
16+
* Typo in error messages of kernel interface (#1082)
17+
718
## [0.21.0] - 2023-06-17
819

920
### Added

Dockerfile

Lines changed: 97 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
11
# syntax=docker/dockerfile:1.3
22
# NB: at least 1.3 is needed to benefit from ARG expansion in bind mount arguments
3-
ARG PYTHON_VERSION=3.9.16
3+
ARG PYTHON_VERSION=3.9.17
44

55
# Driver args
6-
# print on gpu is broken for 22.43.24595.30 + igc-1.0.12812.26
7-
ARG CR_TAG=22.43.24595.30
8-
ARG IGC_TAG=igc-1.0.12504.5
6+
# print on gpu is broken for 22.43.24595.30 + igc-1.0.12812.26 refer to these
7+
# versions for testing (all tests pass on them):
8+
# ARG CR_TAG=22.43.24595.30
9+
# ARG IGC_TAG=igc-1.0.12504.5
10+
# ARG CR_TAG=latest
11+
# ARG IGC_TAG=latest
12+
ARG CR_TAG=23.13.26032.30
13+
ARG IGC_TAG=igc-1.0.13700.14
914
ARG CM_TAG=latest
15+
# level-zero v1.10.0+ depends on libstdc++6 (>= 11); however bullseye is based
16+
# on gcc 10
17+
# ARG L0_TAG=v1.9.9
1018
ARG L0_TAG=latest
1119

1220
# ONEAPI
13-
ARG ONEAPI_INSTALLER_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/19079
14-
ARG ONEAPI_VERSION=2023.0.0
15-
ARG ONEAPI_INSTALL_BINARY_NAME=l_BaseKit_p_$ONEAPI_VERSION.25537.sh
21+
ARG ONEAPI_INSTALLER_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7deeaac4-f605-4bcf-a81b-ea7531577c61
22+
ARG ONEAPI_VERSION=2023.1.0.46401
23+
ARG ONEAPI_INSTALL_BINARY_NAME=l_BaseKit_p_$ONEAPI_VERSION.sh
1624
ARG ONEAPI_INSTALL_DIR=/opt/intel/oneapi
1725

1826
# Versions of the intel python packages
19-
ARG DPCTL_GIT_BRANCH=0.14.2
27+
ARG DPCTL_GIT_BRANCH=0.14.4
2028
ARG DPCTL_GIT_URL=https://github.com/IntelPython/dpctl.git
2129

22-
ARG DPNP_GIT_BRANCH=0.11.1
30+
ARG DPNP_GIT_BRANCH=0.12.0
2331
ARG DPNP_GIT_URL=https://github.com/IntelPython/dpnp.git
2432

25-
ARG NUMBA_DPEX_GIT_BRANCH=0.20.0
33+
ARG DPCPP_LLVM_SPIRV_GIT_BRANCH=main
34+
ARG DPCPP_LLVM_SPIRV_GIT_URL=https://github.com/IntelPython/dpcpp-llvm-spirv.git
35+
36+
ARG NUMBA_DPEX_GIT_BRANCH=0.22.0
2637
ARG NUMBA_DPEX_GIT_URL=https://github.com/IntelPython/numba-dpex.git
2738

2839
# CMAKE
29-
ARG CMAKE_VERSION=3.25
30-
ARG CMAKE_VERSION_BUILD=3
40+
ARG CMAKE_VERSION=3.26
41+
ARG CMAKE_VERSION_BUILD=4
3142

3243
# Python
33-
ARG INTEL_NUMPY_VERSION="==1.22.3"
34-
ARG INTEL_NUMBA_VERSION="==0.56.4"
35-
ARG SCIKIT_BUILD_VERSION="==0.16.7"
44+
ARG INTEL_NUMPY_VERSION="==1.24.3"
45+
ARG INTEL_NUMBA_VERSION="==0.57.0"
46+
ARG CYTHON_VERSION="==0.29.35"
47+
ARG SCIKIT_BUILD_VERSION="==0.17.6"
3648

3749
# If you are have access to the internet via proxy.
3850
# It is required for loading packages.
@@ -45,11 +57,12 @@ ARG GITHUB_USER=''
4557
ARG GITHUB_PASSWORD=''
4658

4759
# Image names used in multistage build
48-
ARG BASE_IMAGE=python:$PYTHON_VERSION-slim-bullseye
60+
ARG BASE_IMAGE=python:$PYTHON_VERSION-slim-bookworm
4961
ARG RUNTIME_BASE_IMAGE=runtime-base
5062
ARG BUILDER_IMAGE=builder
5163
ARG DPCTL_BUILDER_IMAGE=dpctl-builder
5264
ARG DPNP_BUILDER_IMAGE=dpnp-builder
65+
ARG DPCPP_LLVM_SPIRV_BUILDER_IMAGE=dpcpp-llvm-spirv-builder
5366
ARG NUMBA_DPEX_BUILDER_IMAGE=numba-dpex-builder
5467
ARG TOOLKIT_IMAGE=toolkit
5568
ARG NUMBA_DPEX_BUILDER_RUNTIME_IMAGE=numba-dpex-builder-runtime
@@ -283,37 +296,33 @@ RUN \
283296
&& pip install -U \
284297
numba${INTEL_NUMBA_VERSION} \
285298
numpy${INTEL_NUMPY_VERSION} \
299+
cython${CYTHON_VERSION} \
286300
scikit-build${SCIKIT_BUILD_VERSION}
287301

288302

289303
FROM $BUILDER_IMAGE AS dpctl-builder
290-
ARG ONEAPI_INSTALL_DIR
291304
ARG DPCTL_GIT_BRANCH
292305
ARG DPCTL_GIT_URL
293306
ARG DPCTL_BUILD_DIR=/build
294307
ARG DPCTL_DIST_DIR=/dist
295308
ARG SKBUILD_ARGS="-- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx"
296-
ARG SKBUILD_CACHE=/root/.cache/_skbuild/
297309
ARG http_proxy
298310
ARG https_proxy
299311

300312
RUN \
301-
export http_proxy=$http_proxy https_proxy=$https_proxy \
302-
&& mkdir -p $DPCTL_BUILD_DIR \
303-
&& mkdir $DPCTL_DIST_DIR \
304-
&& cd $DPCTL_BUILD_DIR \
305-
&& cd $DPCTL_BUILD_DIR \
306-
&& git clone --recursive -b $DPCTL_GIT_BRANCH --depth 1 $DPCTL_GIT_URL . \
307-
&& find $DPCTL_BUILD_DIR -type f -exec sed -i 's/inserter/_inserter/g' {} + `TODO: remove once fixed` \
308-
&& python setup.py bdist_wheel ${SKBUILD_ARGS} \
309-
&& cp dist/dpctl*.whl $DPCTL_DIST_DIR
313+
export http_proxy=$http_proxy https_proxy=$https_proxy \
314+
&& mkdir -p $DPCTL_BUILD_DIR \
315+
&& mkdir $DPCTL_DIST_DIR \
316+
&& cd $DPCTL_BUILD_DIR \
317+
&& git clone --recursive -b $DPCTL_GIT_BRANCH --depth 1 $DPCTL_GIT_URL . \
318+
&& python setup.py bdist_wheel ${SKBUILD_ARGS} \
319+
&& cp dist/dpctl*.whl $DPCTL_DIST_DIR
310320

311321

312322
FROM $DPCTL_BUILDER_IMAGE AS dpctl-builder-dist
313323

314324

315325
FROM $BUILDER_IMAGE AS dpnp-builder
316-
ARG ONEAPI_INSTALL_DIR
317326
ARG DPNP_BUILD_DIR=/build
318327
ARG DPNP_DIST_DIR=/dist
319328
ARG DPNP_GIT_BRANCH
@@ -331,17 +340,42 @@ RUN \
331340
&& mkdir -p $DPNP_DIST_DIR \
332341
&& cd $DPNP_BUILD_DIR \
333342
&& git clone --recursive -b $DPNP_GIT_BRANCH --depth 1 $DPNP_GIT_URL . \
334-
&& export DPLROOT=$ONEAPI_ROOT/dpl/latest \
335-
&& python setup.py build_clib \
336-
&& export CC=dpcpp \
337-
&& python setup.py build_ext \
338-
&& python setup.py bdist_wheel \
343+
&& export DPCTL_MODULE_PATH=$(python -m dpctl --cmakedir) \
344+
&& export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$DPCTL_MODULE_PATH \
345+
# && python setup.py build_clib ${SKBUILD_ARGS} \
346+
# # && python setup.py build_ext ${SKBUILD_ARGS} \
347+
&& python setup.py bdist_wheel ${SKBUILD_ARGS} \
339348
&& cp dist/dpnp*.whl $DPNP_DIST_DIR
340349

341350

342351
FROM $DPNP_BUILDER_IMAGE AS dpnp-builder-dist
343352

344353

354+
FROM $BUILDER_IMAGE AS dpcpp-llvm-spirv-builder
355+
356+
ARG ONEAPI_INSTALL_DIR
357+
ARG DPCPP_LLVM_SPIRV_GIT_BRANCH
358+
ARG DPCPP_LLVM_SPIRV_GIT_URL
359+
ARG DPCPP_LLVM_SPIRV_BUILD_DIR=/build
360+
ARG DPCPP_LLVM_SPIRV_DIST_DIR=/dist
361+
ARG http_proxy
362+
ARG https_proxy
363+
364+
RUN \
365+
export http_proxy=$http_proxy https_proxy=$https_proxy \
366+
&& mkdir -p $DPCPP_LLVM_SPIRV_BUILD_DIR \
367+
&& mkdir $DPCPP_LLVM_SPIRV_DIST_DIR \
368+
&& cd $DPCPP_LLVM_SPIRV_BUILD_DIR \
369+
&& cd $DPCPP_LLVM_SPIRV_BUILD_DIR \
370+
&& git clone --recursive -b $DPCPP_LLVM_SPIRV_GIT_BRANCH --depth 1 $DPCPP_LLVM_SPIRV_GIT_URL . \
371+
&& cd pkg \
372+
&& python setup.py bdist_wheel \
373+
&& cp dist/dpcpp_llvm_spirv*.whl $DPCPP_LLVM_SPIRV_DIST_DIR
374+
375+
376+
FROM $DPCPP_LLVM_SPIRV_BUILDER_IMAGE AS dpcpp-llvm-spirv-dist
377+
378+
345379
FROM $BUILDER_IMAGE AS numba-dpex-builder-runtime
346380
ARG ONEAPI_INSTALL_DIR
347381
ARG NUMBA_DPEX_BUILD_DIR=/build
@@ -354,17 +388,19 @@ ARG http_proxy
354388
ARG https_proxy
355389

356390
RUN \
357-
--mount=type=bind,target=/mnt/dpctl,source=/dist,from=dpctl-builder-dist \
358-
--mount=type=bind,target=/mnt/dpnp,source=/dist,from=dpnp-builder-dist \
359-
--mount=type=cache,target=/root/.cache/pip/ \
360-
export http_proxy=$http_proxy https_proxy=$https_proxy \
361-
&& pip install -U \
362-
/mnt/dpctl/dpctl*.whl /mnt/dpnp/dpnp*.whl \
363-
&& mkdir -p $NUMBA_DPEX_BUILD_DIR \
364-
&& mkdir $NUMBA_DPEX_DIST_DIR \
365-
&& cd $NUMBA_DPEX_BUILD_DIR \
366-
&& git clone --recursive -b $NUMBA_DPEX_GIT_BRANCH --depth 1 $NUMBA_DPEX_GIT_URL .
367-
391+
--mount=type=bind,target=/mnt/dpctl,source=/dist,from=dpctl-builder-dist \
392+
--mount=type=bind,target=/mnt/dpnp,source=/dist,from=dpnp-builder-dist \
393+
--mount=type=bind,target=/mnt/dpcpp_llvm_spirv,source=/dist,from=dpcpp-llvm-spirv-dist \
394+
--mount=type=cache,target=/root/.cache/pip/ \
395+
export http_proxy=$http_proxy https_proxy=$https_proxy \
396+
&& pip install -U \
397+
/mnt/dpctl/dpctl*.whl /mnt/dpnp/dpnp*.whl \
398+
/mnt/dpcpp_llvm_spirv/dpcpp_llvm_spirv*.whl \
399+
&& ln -s /usr/local/bin/llvm-spirv /usr/local/lib/python*/site-packages/dpcpp_llvm_spirv/ \
400+
&& mkdir -p $NUMBA_DPEX_BUILD_DIR \
401+
&& mkdir $NUMBA_DPEX_DIST_DIR \
402+
&& cd $NUMBA_DPEX_BUILD_DIR \
403+
&& git clone --recursive -b $NUMBA_DPEX_GIT_BRANCH --depth 1 $NUMBA_DPEX_GIT_URL .
368404

369405
FROM $NUMBA_DPEX_BUILDER_RUNTIME_IMAGE AS numba-dpex-builder
370406
ARG NUMBA_DPEX_DIST_DIR=/dist
@@ -407,19 +443,23 @@ COPY --from=dpnp-builder-dist /build/tests /opt/dpnp/tests
407443

408444
# runtime python packages
409445
RUN \
410-
--mount=type=bind,target=/mnt/dpctl,source=/dist,from=dpctl-builder-dist \
411-
--mount=type=bind,target=/mnt/dpnp,source=/dist,from=dpnp-builder-dist \
412-
--mount=type=bind,target=/mnt/numba_dpex,source=/dist,from=numba-dpex-builder \
413-
--mount=type=cache,target=/root/.cache/pip/ \
414-
export http_proxy=$http_proxy https_proxy=$https_proxy \
415-
&& pip install -U \
416-
numpy${INTEL_NUMPY_VERSION} \
417-
numba${INTEL_NUMBA_VERSION} \
418-
/mnt/dpctl/dpctl*.whl \
419-
/mnt/dpnp/dpnp*.whl \
420-
/mnt/numba_dpex/numba_dpex*.whl \
421-
&& fdupes -qio name /usr/local/lib/python*/site-packages/dpctl/ | \
422-
awk '{if ($0=="") ln=""; else if (ln=="") ln = $0; else system("rm " $0 ";\tln -s " ln " " $0) }'
446+
--mount=type=bind,target=/mnt/dpctl,source=/dist,from=dpctl-builder-dist \
447+
--mount=type=bind,target=/mnt/dpnp,source=/dist,from=dpnp-builder-dist \
448+
--mount=type=bind,target=/mnt/dpcpp_llvm_spirv,source=/dist,from=dpcpp-llvm-spirv-dist \
449+
--mount=type=bind,target=/mnt/numba_dpex,source=/dist,from=numba-dpex-builder \
450+
--mount=type=cache,target=/root/.cache/pip/ \
451+
export http_proxy=$http_proxy https_proxy=$https_proxy \
452+
&& pip install -U \
453+
numpy${INTEL_NUMPY_VERSION} \
454+
cython${CYTHON_VERSION} \
455+
numba${INTEL_NUMBA_VERSION} \
456+
/mnt/dpctl/dpctl*.whl \
457+
/mnt/dpnp/dpnp*.whl \
458+
/mnt/dpcpp_llvm_spirv/dpcpp_llvm_spirv*.whl \
459+
/mnt/numba_dpex/numba_dpex*.whl \
460+
&& ln -s /usr/local/bin/llvm-spirv /usr/local/lib/python*/site-packages/dpcpp_llvm_spirv/ \
461+
&& fdupes -qio name /usr/local/lib/python*/site-packages/dpctl/ | \
462+
awk '{if ($0=="") ln=""; else if (ln=="") ln = $0; else system("rm " $0 ";\tln -s " ln " " $0) }'
423463

424464
# Create an user
425465
# TODO: there is no access to gpu with non root user. Same issue on intel/llvm docker.

docs/user_guides/debugging/backtrace.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ Example 2:
3232
See also:
3333

3434
- `Backtraces in GDB*
35-
<https://sourceware.org/gdb/current/onlinedocs/gdb/Backtrace.html#Backtrace>`_
35+
<https://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html#Backtrace>`_

docs/user_guides/debugging/breakpoints.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You have several ways to set breakpoints:
1717
See also:
1818
- `Breakpoints in GDB*`_.
1919

20-
.. _Breakpoints in GDB*: https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Breaks.html#Set-Breaks
20+
.. _Breakpoints in GDB*: https://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html#Set-Breaks
2121

2222
Consider the following numba-dpex kernel code (refer
2323
``numba_dpex/examples/debug/simple_sum.py`` for full example):

docs/user_guides/debugging/stepping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ a single line without interference, set the scheduler-locking setting to `on` or
7272

7373
See also:
7474

75-
- `Continuing and Stepping in GDB* <https://sourceware.org/gdb/current/onlinedocs/gdb/Continuing-and-Stepping.html#Continuing-and-Stepping>`_
75+
- `Continuing and Stepping in GDB* <https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html#Continuing-and-Stepping>`_

numba_dpex/core/datamodel/models.py

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
from numba.core import datamodel, types
6-
from numba.core.datamodel.models import ArrayModel as DpnpNdArrayModel
76
from numba.core.datamodel.models import PrimitiveModel, StructModel
87
from numba.core.extending import register_model
98

9+
from numba_dpex.core.exceptions import UnreachableError
1010
from numba_dpex.utils import address_space
1111

1212
from ..types import Array, DpctlSyclQueue, DpnpNdArray, USMNdArray
@@ -23,7 +23,7 @@ def __init__(self, dmm, fe_type):
2323
super(GenericPointerModel, self).__init__(dmm, fe_type, be_type)
2424

2525

26-
class ArrayModel(StructModel):
26+
class USMArrayModel(StructModel):
2727
"""A data model to represent a Dpex's array types in LLVM IR.
2828
2929
Dpex's ArrayModel is based on Numba's ArrayModel for NumPy arrays. The
@@ -40,18 +40,75 @@ def __init__(self, dmm, fe_type):
4040
),
4141
(
4242
"parent",
43-
types.CPointer(fe_type.dtype, addrspace=fe_type.addrspace),
43+
types.CPointer(types.pyobject, addrspace=fe_type.addrspace),
4444
),
4545
("nitems", types.intp),
4646
("itemsize", types.intp),
4747
(
4848
"data",
4949
types.CPointer(fe_type.dtype, addrspace=fe_type.addrspace),
5050
),
51+
(
52+
"sycl_queue",
53+
types.CPointer(types.void, addrspace=fe_type.addrspace),
54+
),
55+
("shape", types.UniTuple(types.intp, ndim)),
56+
("strides", types.UniTuple(types.intp, ndim)),
57+
]
58+
super(USMArrayModel, self).__init__(dmm, fe_type, members)
59+
60+
61+
class DpnpNdArrayModel(StructModel):
62+
"""Data model for the DpnpNdArray type.
63+
64+
DpnpNdArrayModel is used by the numba_dpex.types.DpnpNdArray type and
65+
abstracts the usmarystruct_t C type defined in
66+
numba_dpex.core.runtime._usmarraystruct.h.
67+
68+
The DpnpNdArrayModel differs from numba's ArrayModel by including an extra
69+
member sycl_queue that maps to _usmarraystruct.sycl_queue pointer. The
70+
_usmarraystruct.sycl_queue pointer stores the C++ sycl::queue pointer that
71+
was used to allocate the data for the dpnp.ndarray represented by an
72+
instance of _usmarraystruct.
73+
"""
74+
75+
def __init__(self, dmm, fe_type):
76+
ndim = fe_type.ndim
77+
members = [
78+
("meminfo", types.MemInfoPointer(fe_type.dtype)),
79+
("parent", types.pyobject),
80+
("nitems", types.intp),
81+
("itemsize", types.intp),
82+
("data", types.CPointer(fe_type.dtype)),
83+
("sycl_queue", types.voidptr),
5184
("shape", types.UniTuple(types.intp, ndim)),
5285
("strides", types.UniTuple(types.intp, ndim)),
5386
]
54-
super(ArrayModel, self).__init__(dmm, fe_type, members)
87+
super(DpnpNdArrayModel, self).__init__(dmm, fe_type, members)
88+
89+
@property
90+
def flattened_field_count(self):
91+
"""Return the number of fields in an instance of a DpnpNdArrayModel."""
92+
flattened_member_count = 0
93+
members = self._members
94+
for member in members:
95+
if isinstance(member, types.UniTuple):
96+
flattened_member_count += member.count
97+
elif isinstance(
98+
member,
99+
(
100+
types.scalars.Integer,
101+
types.misc.PyObject,
102+
types.misc.RawPointer,
103+
types.misc.CPointer,
104+
types.misc.MemInfoPointer,
105+
),
106+
):
107+
flattened_member_count += 1
108+
else:
109+
raise UnreachableError
110+
111+
return flattened_member_count
55112

56113

57114
class SyclQueueModel(StructModel):
@@ -84,7 +141,7 @@ def __init__(self, dmm, fe_type):
84141
def _init_data_model_manager():
85142
dmm = datamodel.default_manager.copy()
86143
dmm.register(types.CPointer, GenericPointerModel)
87-
dmm.register(Array, ArrayModel)
144+
dmm.register(Array, USMArrayModel)
88145
return dmm
89146

90147

@@ -103,8 +160,8 @@ def _init_data_model_manager():
103160
# object.
104161

105162
# Register the USMNdArray type with the dpex ArrayModel
106-
register_model(USMNdArray)(ArrayModel)
107-
dpex_data_model_manager.register(USMNdArray, ArrayModel)
163+
register_model(USMNdArray)(USMArrayModel)
164+
dpex_data_model_manager.register(USMNdArray, USMArrayModel)
108165

109166
# Register the DpnpNdArray type with the Numba ArrayModel
110167
register_model(DpnpNdArray)(DpnpNdArrayModel)

0 commit comments

Comments
 (0)