Skip to content

Commit ead772d

Browse files
authored
Merge pull request #1103 from IntelPython/feature/remove_atomic_emulation
Remove atomic emulation
2 parents a861a50 + 167def8 commit ead772d

File tree

17 files changed

+48
-530
lines changed

17 files changed

+48
-530
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ RUN \
199199
--mount=type=bind,target=/opt/toolkit,source=/opt/toolkit,from=toolkit-dist \
200200
export http_proxy=$http_proxy https_proxy=$https_proxy \
201201
&& apt-get update && apt-get install -y \
202-
spirv-tools spirv-headers \
202+
spirv-headers \
203203
rsync \
204204
&& rm -rf /var/lib/apt/lists/* \
205205
&& rsync -a /opt/toolkit/bin/ /usr/local/bin/ \

conda-recipe/run_test.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ unset ONEAPI_DEVICE_SELECTOR
55

66
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\"]]))")
77
do
8-
export "ONEAPI_DEVICE_SELECTOR=$selector"
9-
unset NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
10-
8+
ONEAPI_DEVICE_SELECTOR=$selector \
119
pytest -q -ra --disable-warnings --pyargs numba_dpex -vv
12-
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
1710
done
1811

1912
exit 0

docs/backups/user_guides/getting_started.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Numba-dpex depends on following components:
1111
* dpnp 0.10.1 (`Intel Python DPNP`_)
1212
* `dpcpp-llvm-spirv`_ (SPIRV generation from LLVM IR)
1313
* `llvmdev`_ (LLVM IR generation)
14-
* `spirv-tools`_
1514
* `packaging`_
1615
* `scipy`_ (for testing)
1716
* `pytest`_ (for testing)
@@ -59,7 +58,7 @@ installed in conda environment:
5958
.. code-block:: bash
6059
6160
export ONEAPI_ROOT=/opt/intel/oneapi
62-
conda create -n numba-dpex-env -c ${ONEAPI_ROOT}/conda_channel python=3.7 dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest
61+
conda create -n numba-dpex-env -c ${ONEAPI_ROOT}/conda_channel python=3.7 dpctl dpnp numba dpcpp-llvm-spirv llvmdev pytest
6362
conda activate numba-dpex-env
6463
6564
Activate DPC++ compiler:
@@ -150,7 +149,6 @@ Refer to :ref:`Docker <docker>` section for more options.
150149
.. _`Intel Python dpnp`: https://github.com/IntelPython/dpnp
151150
.. _`dpcpp-llvm-spirv`: https://github.com/IntelPython/dpcpp-llvm-spirv
152151
.. _`llvmdev`: https://anaconda.org/intel/llvmdev
153-
.. _`spirv-tools`: https://anaconda.org/intel/spirv-tools
154152
.. _`packaging`: https://packaging.pypa.io/
155153
.. _`scipy`: https://anaconda.org/intel/scipy
156154
.. _`pytest`: https://docs.pytest.org

docs/backups/user_guides/kernel_programming_guide/atomic-operations.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ Example usage of atomic operations
2121
The ``numba_dpex.atomic.add`` function is analogous to The
2222
``numba.cuda.atomic.add`` provided by the ``numba.cuda`` backend.
2323

24-
Generating Native FP Atomics
25-
----------------------------
26-
Numba-dpex supports generating native floating-point atomics.
27-
This feature is experimental. Users will need to provide
28-
the following environment variables to activate it.
29-
30-
NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
31-
32-
Example command:
33-
34-
.. code-block:: bash
35-
36-
NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1 \
37-
python program.py
38-
3924
Full examples
4025
-------------
4126

docs/source/getting_started.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ to get the latest production releases.
1919
.. code-block:: bash
2020
2121
conda create -n numba-dpex-env \
22-
numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools \
22+
numba-dpex dpnp dpctl dpcpp-llvm-spirv \
2323
-c intel -c conda-forge
2424
2525
To try out the bleeding edge, the latest packages built from tip of the main
@@ -28,7 +28,7 @@ source trunk can be installed from the ``dppy/label/dev`` conda channel.
2828
.. code-block:: bash
2929
3030
conda create -n numba-dpex-env \
31-
numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools \
31+
numba-dpex dpnp dpctl dpcpp-llvm-spirv \
3232
-c dppy/label/dev -c intel -c conda-forge
3333
3434
@@ -70,7 +70,7 @@ first step.
7070
7171
# Create a conda environment that hass needed dependencies installed
7272
conda create -n numba-dpex-env \
73-
dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest \
73+
dpctl dpnp numba dpcpp-llvm-spirv llvmdev pytest \
7474
-c intel -c conda-forge
7575
# Activate the environment
7676
conda activate numba-dpex-env

docs/source/user_guide/kernel_programming/atomic-operations.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,6 @@ Example usage of atomic operations
2121
The ``numba_dpex.atomic.add`` function is analogous to The
2222
``numba.cuda.atomic.add`` provided by the ``numba.cuda`` backend.
2323

24-
Generating Native FP Atomics
25-
----------------------------
26-
Numba-dpex supports generating native floating-point atomics.
27-
This feature is experimental. Users will need to provide
28-
the following environment variables to activate it.
29-
30-
NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1
31-
NUMBA_DPEX_LLVM_SPIRV_ROOT=/path/to/dpcpp/provided/llvm_spirv
32-
33-
Example command:
34-
35-
.. code-block:: bash
36-
37-
NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE=1 \
38-
NUMBA_DPEX_LLVM_SPIRV_ROOT=/path/to/dpcpp/provided/llvm_spirv \
39-
python program.py
40-
4124
Full examples
4225
-------------
4326

environment/coverage.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313
- numba=0.57
1414
- dpctl
1515
- dpnp
16-
- spirv-tools
1716
- dpcpp-llvm-spirv
1817
- opencl_rt
1918
- coverage

environment/docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313
- numba=0.57
1414
- dpctl
1515
- dpnp
16-
- spirv-tools
1716
- dpcpp-llvm-spirv
1817
- opencl_rt
1918
- pip

numba_dpex/config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def __getattr__(name):
5353
# Dump offload diagnostics
5454
OFFLOAD_DIAGNOSTICS = _readenv("NUMBA_DPEX_OFFLOAD_DIAGNOSTICS", int, 0)
5555

56-
# Activate Native floating point atomcis support for supported devices.
57-
# Requires llvm-spirv supporting the FP atomics extension
58-
NATIVE_FP_ATOMICS = _readenv("NUMBA_DPEX_ACTIVATE_ATOMICS_FP_NATIVE", int, 0)
5956
# Emit debug info
6057
DEBUG = _readenv("NUMBA_DPEX_DEBUG", int, config.DEBUG)
6158
DEBUGINFO_DEFAULT = _readenv(

numba_dpex/examples/kernel/atomic_op.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,28 @@
88

99

1010
@ndpx.kernel
11-
def atomic_reduction(a):
11+
def atomic_reduction(a, res):
12+
"""Summarize all the items in a and writes it into res using atomic.add.
13+
14+
:param a: array of values to get sum
15+
:param res: result where to add all the items from a array. It must be preset to 0.
16+
"""
1217
idx = ndpx.get_global_id(0)
13-
ndpx.atomic.add(a, 0, a[idx])
18+
ndpx.atomic.add(res, 0, a[idx])
1419

1520

1621
def main():
1722
N = 10
18-
a = np.arange(N)
23+
24+
# We are storing sum to the first element
25+
a = np.arange(0, N)
26+
res = np.zeros(1, dtype=a.dtype)
1927

2028
print("Using device ...")
2129
print(a.device)
2230

23-
atomic_reduction[ndpx.Range(N)](a)
24-
print("Reduction sum =", a[0])
31+
atomic_reduction[ndpx.Range(N)](a, res)
32+
print("Reduction sum =", res[0])
2533

2634
print("Done...")
2735

numba_dpex/ocl/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
5-
from .atomics import atomic_support_present

numba_dpex/ocl/atomics/__init__.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,3 @@
11
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
5-
import os
6-
import os.path
7-
8-
9-
def atomic_support_present():
10-
if os.path.isfile(
11-
os.path.join(os.path.dirname(__file__), "atomic_ops.spir")
12-
):
13-
return True
14-
else:
15-
return False
16-
17-
18-
def get_atomic_spirv_path():
19-
if atomic_support_present():
20-
return os.path.join(os.path.dirname(__file__), "atomic_ops.spir")
21-
else:
22-
return None
23-
24-
25-
def read_atomic_spirv_file():
26-
path = get_atomic_spirv_path()
27-
if path:
28-
with open(path, "rb") as fin:
29-
spirv = fin.read()
30-
return spirv
31-
else:
32-
return None

numba_dpex/ocl/atomics/atomic_ops.cl

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)