Skip to content
9 changes: 7 additions & 2 deletions numba_dppy/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@
import os
from numba.core.compiler import DefaultPassBuilder, CompilerBase

DEBUG=os.environ.get('NUMBA_DPPL_DEBUG', None)
DEBUG = os.environ.get('NUMBA_DPPL_DEBUG', None)
_NUMBA_DPPL_READ_ONLY = "read_only"
_NUMBA_DPPL_WRITE_ONLY = "write_only"
_NUMBA_DPPL_READ_WRITE = "read_write"


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


def _raise_invalid_kernel_enqueue_args():
error_message = ("Incorrect number of arguments for enquing dppl.kernel. "
"Usage: device_env, global size, local size. "
Expand Down Expand Up @@ -77,9 +79,11 @@ def compile_with_dppl(pyfunc, return_type, args, debug):

typingctx = dppl_target.typing_context
targetctx = dppl_target.target_context
# TODO handle debug flag

flags = compiler.Flags()
# Do not compile (generate native code), just lower (to LLVM)
if debug:
flags.set('debuginfo')
flags.set('no_compile')
flags.set('no_cpython_wrapper')
flags.unset('nrt')
Expand Down Expand Up @@ -116,6 +120,7 @@ def compile_with_dppl(pyfunc, return_type, args, debug):
def compile_kernel(sycl_queue, pyfunc, args, access_types, debug=False):
if DEBUG:
print("compile_kernel", args)
debug = True
if not sycl_queue:
# This will be get_current_queue
sycl_queue = dpctl.get_current_queue()
Expand Down
5 changes: 4 additions & 1 deletion numba_dppy/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ def sub_gen_with_global(lty):
def declare_function(self, module, fndesc):
fnty = self.call_conv.get_function_type(fndesc.restype, fndesc.argtypes)
fn = module.get_or_insert_function(fnty, name=fndesc.mangled_name)
fn.attributes.add('alwaysinline')

if not self.enable_debuginfo:
fn.attributes.add('alwaysinline')

ret = super(DPPLTargetContext, self).declare_function(module, fndesc)
# XXX: Refactor fndesc instead of this special case
if fndesc.llvm_func_name.startswith('dppl_py_devfn'):
Expand Down