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

Commit 600a1fd

Browse files
author
Diptorup Deb
committed
Rename oneapi to dppy
1 parent a44cbb4 commit 600a1fd

37 files changed

+681
-687
lines changed

build_for_conda.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
#!/bin/sh
2+
set -x
23

34
find . -name "*.so" -exec rm {} \;
45

5-
cd numba/oneapi/oneapidriver
6+
cd numba/dppy/dppy_driver
67

7-
gcc -g -DDEBUG -Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations -std=c99 -fdiagnostics-color=auto -pedantic-errors -fPIC -c numba_oneapi_glue.c -o numba_oneapi_glue.o
8+
gcc -g -DDEBUG -Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations -std=c99 -fdiagnostics-color=auto -pedantic-errors -fPIC -c opencllite.c -o opencllite.o
89
gcc_ret=$?
910
if [ $gcc_ret -ne 0 ]; then
10-
echo "numba_oneapi_glue failed to build...exiting"
11+
echo "opencllite failed to build...exiting"
1112
cd ../../..
1213
exit $gcc_ret
1314
fi
14-
ar rcs libnumbaoneapiglue.a numba_oneapi_glue.o
15+
ar rcs libdpglue.a opencllite.o
1516

16-
#gcc -L. -shared -o libnumbaoneapiglue.so -Wl,--whole-archive -lnumbaoneapiglue
17+
#gcc -L. -shared -o libdpglue.so -Wl,--whole-archive -lopencllite
1718

18-
gcc -DDEBUG -Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations -std=c99 -fdiagnostics-color=auto -pedantic-errors -shared -fPIC -o libnumbaoneapiglue_so.so numba_oneapi_glue.c
19+
gcc -DDEBUG -Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations -std=c99 -fdiagnostics-color=auto -pedantic-errors -shared -fPIC -o libdpglue_so.so opencllite.c
1920
gcc_ret=$?
2021
if [ $gcc_ret -ne 0 ]; then
21-
echo "numba_oneapi_glue_so failed to build...exiting"
22+
echo "opencllite failed to build...exiting"
2223
cd ../../..
2324
exit $gcc_ret
2425
fi
File renamed without changes.
File renamed without changes.

numba/oneapi/codegen.py renamed to numba/dppy/codegen.py

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

4343
def get_asm_str(self):
4444
# Return nothing: we can only dump assembler code when it is later
45-
# generated (in numba.oneapi.compiler).
45+
# generated (in numba.dppy.compiler).
4646
return None
4747

4848

numba/oneapi/compiler.py renamed to numba/dppy/compiler.py

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

55
from numba.typing.templates import ConcreteTemplate
66
from numba import types, compiler, ir
7-
from .oneapidriver import driver
7+
from .dppy_driver import driver
88
from numba.typing.templates import AbstractTemplate
99
from numba import ctypes_support as ctypes
10-
from numba.oneapi.oneapidriver import spirv_generator
10+
from numba.dppy.dppy_driver import spirv_generator
1111
from types import FunctionType
1212
import os
1313

14-
DEBUG=os.environ.get('NUMBA_ONEAPI_DEBUG', None)
14+
DEBUG=os.environ.get('NUMBA_DPPY_DEBUG', None)
1515

1616
def _raise_no_device_found_error():
1717
error_message = ("No OpenCL device specified. "
1818
"Usage : jit_fn[device, globalsize, localsize](...)")
1919
raise ValueError(error_message)
2020

2121

22-
def compile_with_oneapi(pyfunc, return_type, args, debug):
22+
def compile_with_dppy(pyfunc, return_type, args, debug):
2323
# First compilation will trigger the initialization of the OpenCL backend.
24-
from .descriptor import OneAPITargetDesc
24+
from .descriptor import DPPyTargetDesc
2525

26-
typingctx = OneAPITargetDesc.typingctx
27-
targetctx = OneAPITargetDesc.targetctx
26+
typingctx = DPPyTargetDesc.typingctx
27+
targetctx = DPPyTargetDesc.targetctx
2828
# TODO handle debug flag
2929
flags = compiler.Flags()
3030
# Do not compile (generate native code), just lower (to LLVM)
@@ -62,23 +62,23 @@ def compile_with_oneapi(pyfunc, return_type, args, debug):
6262
def compile_kernel(device, pyfunc, args, debug=False):
6363
if DEBUG:
6464
print("compile_kernel", args)
65-
cres = compile_with_oneapi(pyfunc, types.void, args, debug=debug)
65+
cres = compile_with_dppy(pyfunc, types.void, args, debug=debug)
6666
func = cres.library.get_function(cres.fndesc.llvm_func_name)
6767
kernel = cres.target_context.prepare_ocl_kernel(func, cres.signature.args)
68-
oclkern = OneAPIKernel(device_env=device,
69-
llvm_module=kernel.module,
70-
name=kernel.name,
71-
argtypes=cres.signature.args)
68+
oclkern = DPPyKernel(device_env=device,
69+
llvm_module=kernel.module,
70+
name=kernel.name,
71+
argtypes=cres.signature.args)
7272
return oclkern
7373

7474

7575
def compile_kernel_parfor(device, func_ir, args, debug=False):
7676
if DEBUG:
7777
print("compile_kernel_parfor", args)
78-
cres = compile_with_oneapi(func_ir, types.void, args, debug=debug)
78+
cres = compile_with_dppy(func_ir, types.void, args, debug=debug)
7979
func = cres.library.get_function(cres.fndesc.llvm_func_name)
8080
kernel = cres.target_context.prepare_ocl_kernel(func, cres.signature.args)
81-
oclkern = OneAPIKernel(device_env=device,
81+
oclkern = Kernel(device_env=device,
8282
llvm_module=kernel.module,
8383
name=kernel.name,
8484
argtypes=cres.signature.args)
@@ -97,7 +97,7 @@ def _ensure_size_or_append(val, size):
9797
val.append(1)
9898

9999

100-
class OneAPIKernelBase(object):
100+
class DPPyKernelBase(object):
101101
"""Define interface for configurable kernels
102102
"""
103103

@@ -183,13 +183,13 @@ def __getitem__(self, args):
183183
# return context, device, program, kernel
184184

185185

186-
class OneAPIKernel(OneAPIKernelBase):
186+
class DPPyKernel(DPPyKernelBase):
187187
"""
188188
A OCL kernel object
189189
"""
190190

191191
def __init__(self, device_env, llvm_module, name, argtypes):
192-
super(OneAPIKernel, self).__init__()
192+
super(DPPyKernel, self).__init__()
193193
self._llvm_module = llvm_module
194194
self.assembly = self.binary = llvm_module.__str__()
195195
self.entry_name = name
@@ -200,7 +200,7 @@ def __init__(self, device_env, llvm_module, name, argtypes):
200200
# binary=self.binary)
201201
# First-time compilation using SPIRV-Tools
202202
self.spirv_bc = spirv_generator.llvm_to_spirv(self.binary)
203-
#print("OneAPIKernel:", self.spirv_bc, type(self.spirv_bc))
203+
#print("DPPyKernel:", self.spirv_bc, type(self.spirv_bc))
204204
# create a program
205205
self.program = driver.Program(device_env, self.spirv_bc)
206206
# create a kernel
@@ -336,16 +336,16 @@ def _unpack_argument(self, ty, val, queue, retr, kernelargs):
336336
raise NotImplementedError(ty, val)
337337

338338

339-
class AutoJitOneAPIKernel(OneAPIKernelBase):
339+
class AutoJitDPPyKernel(DPPyKernelBase):
340340
def __init__(self, func):
341341

342-
super(AutoJitOneAPIKernel, self).__init__()
342+
super(AutoJitDPPyKernel, self).__init__()
343343
self.py_func = func
344344
self.definitions = {}
345345

346-
from .descriptor import OneAPITargetDesc
346+
from .descriptor import DPPyTargetDesc
347347

348-
self.typingctx = OneAPITargetDesc.typingctx
348+
self.typingctx = DPPyTargetDesc.typingctx
349349

350350
def __call__(self, *args):
351351
if self.device_env is None:

numba/oneapi/decorators.py renamed to numba/dppy/decorators.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from __future__ import print_function, absolute_import, division
22
from numba import sigutils, types
3-
from .compiler import (compile_kernel, AutoJitOneAPIKernel)
3+
from .compiler import (compile_kernel, AutoJitDPPyKernel)
44

55

66
def jit(signature=None, debug=False):
7-
"""JIT compile a python function conforming using the
8-
Numba-OneAPI backend
7+
"""JIT compile a python function conforming using the DPPy backend
98
"""
109
if signature is None:
1110
return autojit(debug=False)
@@ -23,8 +22,7 @@ def autojit(debug=False):
2322
def _kernel_jit(signature, debug):
2423
argtypes, restype = sigutils.normalize_signature(signature)
2524
if restype is not None and restype != types.void:
26-
msg = ("OneAPI/OpenCL kernel must have void return type "
27-
"but got {restype}")
25+
msg = ("DPPy kernel must have void return type but got {restype}")
2826
raise TypeError(msg.format(restype=restype))
2927

3028
def _wrapped(pyfunc):
@@ -34,4 +32,4 @@ def _wrapped(pyfunc):
3432

3533

3634
def _kernel_autojit(pyfunc):
37-
return AutoJitOneAPIKernel(pyfunc)
35+
return AutoJitDPPyKernel(pyfunc)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from __future__ import print_function, division, absolute_import
22
from numba.targets.descriptors import TargetDescriptor
33
from numba.targets.options import TargetOptions
4-
from .target import OneAPITargetContext, OneAPITypingContext
4+
from .target import DPPyTargetContext, DPPyTypingContext
55

66

77
class CPUTargetOptions(TargetOptions):
88
OPTIONS = {}
99

1010

11-
class OneAPITargetDesc(TargetDescriptor):
11+
class DPPyTargetDesc(TargetDescriptor):
1212
options = CPUTargetOptions
13-
typingctx = OneAPITypingContext()
14-
targetctx = OneAPITargetContext(typingctx)
13+
typingctx = DPPyTypingContext()
14+
targetctx = DPPyTargetContext(typingctx)

numba/oneapi/device_init.py renamed to numba/dppy/device_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
# shared,
1515
sub_group_barrier,
1616
)
17-
#from .oneapidriver.error import OneAPISupportError
17+
1818
from . import initialize
1919
from .errors import KernelRuntimeError
2020

2121
from .decorators import jit, autojit
22-
from .oneapidriver.driver import runtime
22+
from .dppy_driver.driver import runtime
2323

2424

2525
def is_available():

numba/oneapi/dispatcher.py renamed to numba/dppy/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from numba.targets.descriptors import TargetDescriptor
66
from numba.targets.options import TargetOptions
77
from numba import ocl
8-
from numba.oneapi import jit, autojit
8+
from numba.dppy import jit, autojit
99
from .descriptor import OCLTargetDesc
1010
from numba.npyufunc.deviceufunc import (UFuncMechanism, GenerializedUFunc,
1111
GUFuncCallSteps)

0 commit comments

Comments
 (0)