Skip to content

Commit d87f740

Browse files
committed
Refactor config import and fix pylint issues in
numba_dpex/core/utils/kernel_launcher.py Refactor config import of numba_dpex/core/descriptor.py Refactor config import in numba_dpex/decorators.py Refactor config import in numba_dpex/tests/misc/test_warnings.py Refactor config import in tests._helper.py
1 parent d9794c1 commit d87f740

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

numba_dpex/core/descriptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from numba.core.cpu import CPUTargetOptions
99
from numba.core.descriptors import TargetDescriptor
1010

11-
from numba_dpex import config
11+
from numba_dpex.core import config
1212

1313
from .targets.dpjit_target import DPEX_TARGET_NAME, DpexTargetContext
1414
from .targets.kernel_target import (

numba_dpex/core/utils/kernel_launcher.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
from numba.core.datamodel import DataModelManager
1717
from numba.core.types.containers import UniTuple
1818

19-
from numba_dpex import config, utils
19+
from numba_dpex import utils
20+
from numba_dpex.core import config
2021
from numba_dpex.core.exceptions import UnreachableError
2122
from numba_dpex.core.runtime.context import DpexRTContext
2223
from numba_dpex.core.types import USMNdArray
@@ -165,7 +166,7 @@ def _build_array_attr_arg( # pylint: disable=too-many-arguments
165166

166167
self._build_arg(
167168
val=array_attr,
168-
ty=array_attr_ty,
169+
typ=array_attr_ty,
169170
arg_list=arg_list,
170171
args_ty_list=args_ty_list,
171172
arg_num=arg_num,
@@ -193,14 +194,14 @@ def _build_unituple_member_arg( # pylint: disable=too-many-arguments
193194
)
194195

195196
def _build_arg(
196-
self, val, ty, arg_list, args_ty_list, arg_num
197+
self, val, typ, arg_list, args_ty_list, arg_num
197198
): # pylint: disable=too-many-arguments
198199
"""Stores the kernel arguments and the kernel argument types into
199200
arrays that will be passed to DPCTLQueue_SubmitRange.
200201
201202
Args:
202203
val: An LLVM IR Value that will be stored into the arguments array
203-
ty: A Numba type that will be converted to a DPCTLKernelArgType
204+
typ: A Numba type that will be converted to a DPCTLKernelArgType
204205
enum and stored into the argument types list array
205206
arg_list: An LLVM IR Value array that stores the kernel arguments
206207
args_ty_list: An LLVM IR Value array that stores the
@@ -222,19 +223,19 @@ def _build_arg(
222223
)
223224
self.builder.store(val, kernel_arg_dst)
224225
self.builder.store(
225-
numba_type_to_dpctl_typenum(self.context, ty), kernel_arg_ty_dst
226+
numba_type_to_dpctl_typenum(self.context, typ), kernel_arg_ty_dst
226227
)
227228

228229
def _build_complex_arg(
229-
self, val, ty, arg_list, args_ty_list, arg_num
230+
self, val, typ, arg_list, args_ty_list, arg_num
230231
): # pylint: disable=too-many-arguments
231232
"""Creates a list of LLVM Values for an unpacked complex kernel
232233
argument.
233234
"""
234235
self._build_array_attr_arg(
235236
array_val=val,
236237
array_attr_pos=0,
237-
array_attr_ty=ty,
238+
array_attr_ty=typ,
238239
arg_list=arg_list,
239240
args_ty_list=args_ty_list,
240241
arg_num=arg_num,
@@ -243,7 +244,7 @@ def _build_complex_arg(
243244
self._build_array_attr_arg(
244245
array_val=val,
245246
array_attr_pos=1,
246-
array_attr_ty=ty,
247+
array_attr_ty=typ,
247248
arg_list=arg_list,
248249
args_ty_list=args_ty_list,
249250
arg_num=arg_num,
@@ -268,7 +269,7 @@ def _build_array_arg( # pylint: disable=too-many-arguments
268269
nullptr = self._build_nullptr()
269270
self._build_arg(
270271
val=nullptr,
271-
ty=types.int64,
272+
typ=types.int64,
272273
arg_list=arg_list,
273274
args_ty_list=args_ty_list,
274275
arg_num=arg_num,
@@ -278,7 +279,7 @@ def _build_array_arg( # pylint: disable=too-many-arguments
278279
nullptr = self._build_nullptr()
279280
self._build_arg(
280281
val=nullptr,
281-
ty=types.int64,
282+
typ=types.int64,
282283
arg_list=arg_list,
283284
args_ty_list=args_ty_list,
284285
arg_num=arg_num,
@@ -318,7 +319,7 @@ def _build_array_arg( # pylint: disable=too-many-arguments
318319
# kernel we always pass in a nullptr
319320
self._build_arg(
320321
val=nullptr,
321-
ty=types.int64,
322+
typ=types.int64,
322323
arg_list=arg_list,
323324
args_ty_list=args_ty_list,
324325
arg_num=arg_num,

numba_dpex/decorators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from numba.core import decorators, sigutils
99
from numba.core.target_extension import jit_registry, target_registry
1010

11+
from numba_dpex.core import config
1112
from numba_dpex.core.kernel_interface.dispatcher import JitKernel
1213
from numba_dpex.core.kernel_interface.func import (
1314
compile_func,
@@ -16,8 +17,6 @@
1617
from numba_dpex.core.pipelines.dpjit_compiler import get_compiler
1718
from numba_dpex.core.targets.dpjit_target import DPEX_TARGET_NAME
1819

19-
from .config import USE_MLIR
20-
2120

2221
def kernel(
2322
func_or_sig=None,
@@ -156,7 +155,7 @@ def dpjit(*args, **kws):
156155
)
157156
del kws["pipeline_class"]
158157

159-
use_mlir = kws.pop("use_mlir", bool(USE_MLIR))
158+
use_mlir = kws.pop("use_mlir", bool(config.USE_MLIR))
160159

161160
kws.update({"nopython": True})
162161
kws.update({"parallel": True})

numba_dpex/tests/_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import dpnp
1313
import pytest
1414

15-
from numba_dpex.core import config
1615
from numba_dpex import dpjit, numba_sem_version
16+
from numba_dpex.core import config
1717

1818

1919
@cache

numba_dpex/tests/misc/test_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
import numba_dpex as dpex
11-
import numba_dpex.config as config
11+
from numba_dpex.core import config
1212

1313

1414
@dpex.kernel(enable_cache=False)

0 commit comments

Comments
 (0)