Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 3bbb1e9

Browse files
authored
Merge pull request #122 from PokhodenkoSA/update/numba-dppy
Update numba-dppy
2 parents 0ba371f + b1a8a3c commit 3bbb1e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+261
-119
lines changed

numba-dppy/MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include MANIFEST.in
2+
include README.md setup.py LICENSE
3+
4+
recursive-include numba_dppy *.cl
5+

numba-dppy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Numba + dpPy + dpCtl + dpNP = numba-dppy
44

5-
`numba-dppy` extends Numba with new backend for support compilation
5+
`numba-dppy` extends Numba with a new backend to support compilation
66
for Intel CPU and GPU architectures.
77

88
For more information about Numba, see the Numba homepage:

numba-dppy/conda-recipe/bld.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
%PYTHON% setup.py install --single-version-externally-managed --record=record.txt
2+
if errorlevel 1 exit 1
3+
4+
echo "Activating oneAPI compiler environment..."
5+
call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
6+
if errorlevel 1 exit 1
7+
REM conda uses %ERRORLEVEL% but FPGA scripts can set it. So it should be reseted.
8+
set ERRORLEVEL=
9+
10+
echo on
11+
12+
set "CC=clang.exe"
13+
14+
%CC% -flto -target spir64-unknown-unknown -c -x cl -emit-llvm -cl-std=CL2.0 -Xclang -finclude-default-header numba_dppy/ocl/atomics/atomic_ops.cl -o numba_dppy/ocl/atomics/atomic_ops.bc
15+
llvm-spirv -o numba_dppy/ocl/atomics/atomic_ops.spir numba_dppy/ocl/atomics/atomic_ops.bc
16+
xcopy numba_dppy\ocl\atomics\atomic_ops.spir %SP_DIR%\numba_dppy\ocl\atomics /E /Y

numba-dppy/conda-recipe/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
${PYTHON} setup.py install --single-version-externally-managed --record=record.txt
4+
5+
6+
if [ ! -z "${ONEAPI_ROOT}" ]; then
7+
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
8+
export CC=clang
9+
else
10+
echo "DPCPP is needed to build OpenCL kernel. Abort!"
11+
fi
12+
13+
${CC} -flto -target spir64-unknown-unknown -c -x cl -emit-llvm -cl-std=CL2.0 -Xclang -finclude-default-header numba_dppy/ocl/atomics/atomic_ops.cl -o numba_dppy/ocl/atomics/atomic_ops.bc
14+
llvm-spirv -o numba_dppy/ocl/atomics/atomic_ops.spir numba_dppy/ocl/atomics/atomic_ops.bc
15+
cp numba_dppy/ocl/atomics/atomic_ops.spir ${SP_DIR}/numba_dppy/ocl/atomics/

numba-dppy/conda-recipe/meta.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package:
2+
name: numba-dppy
3+
version: {{ GIT_DESCRIBE_TAG }}
4+
5+
source:
6+
path: ..
7+
8+
build:
9+
number: {{ GIT_DESCRIBE_NUMBER }}
10+
script_env:
11+
- ONEAPI_ROOT
12+
13+
requirements:
14+
build:
15+
- {{ compiler('cxx') }}
16+
host:
17+
- python
18+
- setuptools
19+
- cython
20+
- llvm-spirv
21+
- numba
22+
- dpctl
23+
run:
24+
- python
25+
- numba >=0.51
26+
- dpctl
27+
- spirv-tools
28+
- llvm-spirv
29+
- dpnp
30+
31+
about:
32+
home: https://github.com/IntelPython/numba-dppy
33+
license: BSD-2-Clause
34+
license_file: LICENSE
35+
summary: "Numba extension for Intel CPU and GPU backend"
36+
description: |
37+
<strong>LEGAL NOTICE: Use of this software package is subject to the
38+
software license agreement (as set forth above, in the license section of
39+
the installed Conda package and/or the README file) and all notices,
40+
disclaimers or license terms for third party or open source software
41+
included in or with the software.</strong>
42+
<br/><br/>
43+
EULA: <a href="https://opensource.org/licenses/BSD-2-Clause" target="_blank">BSD-2-Clause</a>
44+
<br/><br/>
45+
46+
extra:
47+
recipe-maintainers:
48+
- PokhodenkoSA

numba-dppy/conda-recipe/run_test.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
python -m numba.runtests -b -v -m -- numba_dppy.tests
2+
IF %ERRORLEVEL% NEQ 0 exit /B 1
3+
4+
exit /B 0

numba-dppy/conda-recipe/run_test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
python -m numba.runtests -b -v -m -- numba_dppy.tests
6+
7+
exit 0

numba-dppy/numba_dppy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def foo(in, out):
164164
165165
---------------------------------------------------------------------------
166166
import numpy as np
167-
from numba import dppl
167+
import numba_dppy, numba_dppy as dppl
168168
import dpctl
169169
170170
@dppl.kernel
@@ -516,4 +516,4 @@ def test(*args, **kwargs):
516516
if not dppl_present and not is_available():
517517
dppl_error()
518518

519-
return numba.testing.test("numba.dppl.tests", *args, **kwargs)
519+
return numba.testing.test("numba_dppy.tests", *args, **kwargs)

numba-dppy/numba_dppy/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _finalize_specific(self):
4141

4242
def get_asm_str(self):
4343
# Return nothing: we can only dump assembler code when it is later
44-
# generated (in numba.dppl.compiler).
44+
# generated (in numba_dppy.compiler).
4545
return None
4646

4747

numba-dppy/numba_dppy/dispatcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#from numba.targets.descriptors import TargetDescriptor
66
#from numba.targets.options import TargetOptions
7-
#from numba import dppl
8-
from numba.dppl import kernel, autojit
7+
#import numba_dppy, numba_dppy as dppl
8+
from numba_dppy import kernel, autojit
99
from .descriptor import dppl_target
1010
#from numba.npyufunc.deviceufunc import (UFuncMechanism, GenerializedUFunc,
1111
# GUFuncCallSteps)

numba-dppy/numba_dppy/dppl_lowerer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from numba.core import (compiler, ir, types, sigutils, lowering,
1313
funcdesc, config)
1414
from numba.parfors import parfor
15-
from numba import dppl
15+
import numba_dppy, numba_dppy as dppl
1616
from numba.core.ir_utils import (add_offset_to_labels,
1717
replace_var_names,
1818
remove_dels,
@@ -40,7 +40,7 @@
4040
from .dufunc_inliner import dufunc_inliner
4141
from . import dppl_host_fn_call_gen as dppl_call_gen
4242
import dpctl
43-
from numba.dppl.target import DPPLTargetContext
43+
from numba_dppy.target import DPPLTargetContext
4444

4545

4646
def _print_block(block):
@@ -329,7 +329,7 @@ def addrspace_from(params, def_addr):
329329
return addrspaces
330330

331331
addrspaces = addrspace_from(parfor_params,
332-
numba.dppl.target.SPIR_GLOBAL_ADDRSPACE)
332+
numba_dppy.target.SPIR_GLOBAL_ADDRSPACE)
333333

334334
if config.DEBUG_ARRAY_OPT >= 1:
335335
print("parfor_params = ", parfor_params, type(parfor_params))
@@ -607,7 +607,7 @@ def print_arg_with_addrspaces(args):
607607
print('after DUFunc inline'.center(80, '-'))
608608
gufunc_ir.dump()
609609

610-
kernel_func = numba.dppl.compiler.compile_kernel_parfor(
610+
kernel_func = numba_dppy.compiler.compile_kernel_parfor(
611611
dpctl.get_current_queue(),
612612
gufunc_ir,
613613
gufunc_param_types,
@@ -975,7 +975,7 @@ def relatively_deep_copy(obj, memo):
975975
from numba.core.types.functions import Function, Dispatcher
976976
from numba.core.bytecode import FunctionIdentity
977977
from numba.core.typing.templates import Signature
978-
from numba.dppl.compiler import DPPLFunctionTemplate
978+
from numba_dppy.compiler import DPPLFunctionTemplate
979979
from numba.core.compiler import CompileResult
980980
from numba.np.ufunc.dufunc import DUFunc
981981
from ctypes import _CFuncPtr
@@ -1169,7 +1169,7 @@ def lower(self):
11691169
self.base_lower = self.gpu_lower
11701170
lowering.lower_extensions[parfor.Parfor].pop()
11711171
except Exception as e:
1172-
if numba.dppl.compiler.DEBUG:
1172+
if numba_dppy.compiler.DEBUG:
11731173
print("Failed to lower parfor on DPPL-device. Due to:\n", e)
11741174
lowering.lower_extensions[parfor.Parfor].pop()
11751175
if (lowering.lower_extensions[parfor.Parfor][-1] == numba.parfors.parfor_lowering._lower_parfor_parallel):
@@ -1195,7 +1195,7 @@ def copy_block(block):
11951195
def lower_parfor_rollback(lowerer, parfor):
11961196
try:
11971197
_lower_parfor_gufunc(lowerer, parfor)
1198-
if numba.dppl.compiler.DEBUG:
1198+
if numba_dppy.compiler.DEBUG:
11991199
msg = "Parfor lowered on DPPL-device"
12001200
print(msg, parfor.loc)
12011201
except Exception as e:

numba-dppy/numba_dppy/dppl_offload_dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class DpplOffloadDispatcher(dispatcher.Dispatcher):
88

99
def __init__(self, py_func, locals={}, targetoptions={}, impl_kind='direct', pipeline_class=compiler.Compiler):
1010
if dppl_config.dppl_present:
11-
from numba.dppl.compiler import DPPLCompiler
11+
from numba_dppy.compiler import DPPLCompiler
1212
targetoptions['parallel'] = True
1313
dispatcher.Dispatcher.__init__(self, py_func, locals=locals,
1414
targetoptions=targetoptions, impl_kind=impl_kind, pipeline_class=DPPLCompiler)

numba-dppy/numba_dppy/dppl_passes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
def dpnp_available():
3434
try:
3535
# import dpnp
36-
from numba.dppl.dpnp_glue import dpnp_fptr_interface as dpnp_glue
36+
from numba_dppy.dpnp_glue import dpnp_fptr_interface as dpnp_glue
3737
return True
3838
except:
3939
return False

numba-dppy/numba_dppy/examples/dppl_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
import numpy as np
3-
from numba import dppl
3+
import numba_dppy, numba_dppy as dppl
44
import math
55

66
import dpctl

numba-dppy/numba_dppy/examples/dppl_with_context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
2-
from numba import dppl, njit, prange
2+
from numba import njit, prange
3+
import numba_dppy, numba_dppy as dppl
34
import dpctl
45

56
@njit

numba-dppy/numba_dppy/examples/matmul.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sys
66
import numpy as np
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/pairwise_distance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import argparse
77
import timeit
88

9-
from numba import dppl
9+
import numba_dppy, numba_dppy as dppl
1010
import dpctl
1111
import dpctl._memory as dpctl_mem
1212

numba-dppy/numba_dppy/examples/sum-hybrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sys
66
import numpy as np
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/sum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sys
66
import numpy as np
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/sum2D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sys
66
import numpy as np
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/sum_ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import sys
66
import numpy as np
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/sum_reduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import math
55
import time
66

7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88
import dpctl
99

1010

numba-dppy/numba_dppy/examples/sum_reduction_ocl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
import numpy as np
3-
from numba import dppl, int32
3+
from numba import int32
4+
import numba_dppy, numba_dppy as dppl
45
import math
56

67
import dpctl

numba-dppy/numba_dppy/examples/sum_reduction_recursive_ocl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
import numpy as np
3-
from numba import dppl, int32
3+
from numba import int32
4+
import numba_dppy, numba_dppy as dppl
45
import math
56

67
import dpctl

numba-dppy/numba_dppy/initialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66

77
def init_jit():
8-
from numba.dppl.dispatcher import DPPLDispatcher
8+
from numba_dppy.dispatcher import DPPLDispatcher
99
return DPPLDispatcher
1010

1111
def initialize_all():
1212
from numba.core.registry import dispatcher_registry
13-
dispatcher_registry.ondemand['dppl'] = init_jit
13+
dispatcher_registry.ondemand['dppy'] = init_jit
1414

1515
import dpctl
1616
import glob

numba-dppy/numba_dppy/ocl/ocldecl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from numba.core.typing.templates import (AttributeTemplate, ConcreteTemplate,
55
AbstractTemplate, MacroTemplate,
66
signature, Registry)
7-
from numba import dppl
7+
import numba_dppy, numba_dppy as dppl
88

99
registry = Registry()
1010
intrinsic = registry.register

numba-dppy/numba_dppy/ocl/oclimpl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from numba.core.imputils import Registry
1212
from numba.core import cgutils, types
1313
from numba.core.itanium_mangler import mangle_c, mangle, mangle_type
14-
from numba.dppl import target
14+
from numba_dppy import target
1515
from . import stubs
16-
from numba.dppl.codegen import SPIR_DATA_LAYOUT
16+
from numba_dppy.codegen import SPIR_DATA_LAYOUT
1717

1818

1919
registry = Registry()

numba-dppy/numba_dppy/ocl/stubs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from numba.core import types, ir, typing
33
from numba.core.rewrites.macros import Macro
44

5-
from numba.dppl.target import SPIR_LOCAL_ADDRSPACE
5+
from numba_dppy.target import SPIR_LOCAL_ADDRSPACE
66

77
_stub_error = NotImplementedError("This is a stub.")
88

numba-dppy/numba_dppy/spirv_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tempfile
88

99
from numba import config
10-
from numba.dppl.target import LINK_ATOMIC
10+
from numba_dppy.target import LINK_ATOMIC
1111

1212

1313
def _raise_bad_env_path(msg, path, extra=None):

0 commit comments

Comments
 (0)