|
20 | 20 | import os |
21 | 21 | from numba.core.compiler import DefaultPassBuilder, CompilerBase |
22 | 22 |
|
23 | | -DEBUG=os.environ.get('NUMBA_DPPY_DEBUG', None) |
| 23 | + |
| 24 | +DEBUG = os.environ.get('NUMBA_DPPY_DEBUG', None) |
24 | 25 | _NUMBA_DPPY_READ_ONLY = "read_only" |
25 | 26 | _NUMBA_DPPY_WRITE_ONLY = "write_only" |
26 | 27 | _NUMBA_DPPY_READ_WRITE = "read_write" |
27 | 28 |
|
| 29 | + |
28 | 30 | def _raise_no_device_found_error(): |
29 | 31 | error_message = ("No OpenCL device specified. " |
30 | 32 | "Usage : jit_fn[device, globalsize, localsize](...)") |
31 | 33 | raise ValueError(error_message) |
32 | 34 |
|
| 35 | + |
33 | 36 | def _raise_invalid_kernel_enqueue_args(): |
34 | 37 | error_message = ("Incorrect number of arguments for enquing dppy.kernel. " |
35 | 38 | "Usage: device_env, global size, local size. " |
@@ -78,9 +81,11 @@ def compile_with_dppy(pyfunc, return_type, args, debug): |
78 | 81 |
|
79 | 82 | typingctx = dppy_target.typing_context |
80 | 83 | targetctx = dppy_target.target_context |
81 | | - # TODO handle debug flag |
| 84 | + |
82 | 85 | flags = compiler.Flags() |
83 | 86 | # Do not compile (generate native code), just lower (to LLVM) |
| 87 | + if debug: |
| 88 | + flags.set('debuginfo') |
84 | 89 | flags.set('no_compile') |
85 | 90 | flags.set('no_cpython_wrapper') |
86 | 91 | flags.unset('nrt') |
@@ -117,6 +122,7 @@ def compile_with_dppy(pyfunc, return_type, args, debug): |
117 | 122 | def compile_kernel(sycl_queue, pyfunc, args, access_types, debug=False): |
118 | 123 | if DEBUG: |
119 | 124 | print("compile_kernel", args) |
| 125 | + debug = True |
120 | 126 | if not sycl_queue: |
121 | 127 | # This will be get_current_queue |
122 | 128 | sycl_queue = dpctl.get_current_queue() |
|
0 commit comments