Skip to content

Commit 3b52cf6

Browse files
committed
Fix pylint issue in numba_dpex/experimental/_kernel_dpcpp_spirv_overloads/_atomic_ref_overloads.py
Fix pylint issue in numba_dpex/experimental/kernel_dispatcher.py Fix pylint issues in numba_dpex/experimental/literal_intenum_type.py Fix pylint issues in numba_dpex/experimental/target.py Fix pylint issues in numba_dpex/experimental/typeof.py
1 parent d87f740 commit 3b52cf6

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

numba_dpex/experimental/_kernel_dpcpp_spirv_overloads/_atomic_ref_overloads.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def gen(context, builder, sig, args):
9494
atomic_ref_dtype,
9595
],
9696
)
97-
fn = cgutils.get_or_insert_function(
97+
func = cgutils.get_or_insert_function(
9898
builder.module,
9999
llvmir.FunctionType(retty, spirv_fn_arg_types),
100100
mangled_fn_name,
101101
)
102-
fn.calling_convention = CC_SPIR_FUNC
102+
func.calling_convention = CC_SPIR_FUNC
103103
spirv_memory_semantics_mask = get_memory_semantics_mask(
104104
atomic_ref_ty.memory_order
105105
)
@@ -112,7 +112,7 @@ def gen(context, builder, sig, args):
112112
args[1],
113113
]
114114

115-
builder.call(fn, fn_args)
115+
builder.call(func, fn_args)
116116

117117
return sig, gen
118118

numba_dpex/experimental/kernel_dispatcher.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,12 @@ def _compile_cached(
270270
cres.fndesc.llvm_func_name + ".ll",
271271
"w",
272272
encoding="UTF-8",
273-
) as f:
274-
f.write(cres.library.final_module)
273+
) as fptr:
274+
fptr.write(cres.library.final_module)
275275

276-
except errors.TypingError as e:
277-
self._failed_cache[key] = e
278-
return False, e
276+
except errors.TypingError as err:
277+
self._failed_cache[key] = err
278+
return False, err
279279

280280
return True, _KernelCompileResult(*kcres_attrs)
281281

@@ -342,18 +342,18 @@ def typeof_pyval(self, val):
342342
# Not going through the resolve_argument_type() indirection
343343
# can save a couple µs.
344344
try:
345-
tp = typeof(val, Purpose.argument)
346-
if isinstance(tp, types.Array) and not isinstance(tp, USMNdArray):
345+
typ = typeof(val, Purpose.argument)
346+
if isinstance(typ, types.Array) and not isinstance(typ, USMNdArray):
347347
raise UnsupportedKernelArgumentError(
348348
type=str(type(val)), value=val
349349
)
350350
except ValueError:
351-
tp = types.pyobject
351+
typ = types.pyobject
352352
else:
353-
if tp is None:
354-
tp = types.pyobject
355-
self._types_active_call.append(tp)
356-
return tp
353+
if typ is None:
354+
typ = types.pyobject
355+
self._types_active_call.append(typ)
356+
return typ
357357

358358
def add_overload(self, cres):
359359
args = tuple(cres.signature.args)
@@ -430,14 +430,14 @@ def cb_llvm(dur):
430430
kcres: _KernelCompileResult = compiler.compile(
431431
args, return_type
432432
)
433-
except errors.ForceLiteralArg as e:
433+
except errors.ForceLiteralArg as err:
434434

435435
def folded(args, kws):
436436
return self._compiler.fold_argument_types(
437437
args, kws
438438
)[1]
439439

440-
raise e.bind_fold_arguments(folded)
440+
raise err.bind_fold_arguments(folded)
441441
self.add_overload(kcres)
442442

443443
kcres.target_context.insert_user_function(

numba_dpex/experimental/literal_intenum_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def can_convert_to(self, typingctx, other) -> bool:
4747

4848

4949
@box(IntEnumLiteral)
50-
def box_literal_integer(typ, val, c):
50+
def box_literal_integer(typ, val, ctx):
5151
"""Defines how a Numba representation for an IntEnumLiteral object should
5252
be converted to a PyObject* object and returned back to Python.
5353
"""
54-
val = c.context.cast(c.builder, val, typ, typ.literal_type)
55-
return c.box(typ.literal_type, val)
54+
val = ctx.context.cast(ctx.builder, val, typ, typ.literal_type)
55+
return ctx.box(typ.literal_type, val)

numba_dpex/experimental/target.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,29 @@ def resolve_value_type(self, val):
5252
ValueError is raised for unsupported types.
5353
"""
5454

55-
ty = super().resolve_value_type(val)
55+
typ = super().resolve_value_type(val)
5656

57-
if isinstance(ty, IntEnumClass) and issubclass(val, FlagEnum):
58-
ty = IntEnumLiteral(val)
57+
if isinstance(typ, IntEnumClass) and issubclass(val, FlagEnum):
58+
typ = IntEnumLiteral(val)
5959

60-
return ty
60+
return typ
6161

6262
def resolve_getattr(self, typ, attr):
6363
"""
6464
Resolve getting the attribute *attr* (a string) on the Numba type.
6565
The attribute's type is returned, or None if resolution failed.
6666
"""
67-
ty = None
67+
retty = None
6868

6969
if isinstance(typ, IntEnumLiteral):
7070
try:
7171
attrval = getattr(typ.literal_value, attr).value
72-
ty = types.IntegerLiteral(attrval)
72+
retty = types.IntegerLiteral(attrval)
7373
except ValueError:
7474
pass
7575
else:
76-
ty = super().resolve_getattr(typ, attr)
77-
return ty
76+
retty = super().resolve_getattr(typ, attr)
77+
return retty
7878

7979

8080
# pylint: disable=W0223

numba_dpex/experimental/typeof.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414

1515

1616
@typeof_impl.register(AtomicRef)
17-
def typeof_atomic_ref(val: AtomicRef, c) -> AtomicRefType:
17+
def typeof_atomic_ref(val: AtomicRef, ctx) -> AtomicRefType:
1818
"""Returns a ``numba_dpex.experimental.dpctpp_types.AtomicRefType``
1919
instance for a Python AtomicRef object.
2020
2121
Args:
2222
val (AtomicRef): Instance of the AtomicRef type.
23-
c : Numba typing context used for type inference.
23+
ctx : Numba typing context used for type inference.
2424
2525
Returns: AtomicRefType object corresponding to the AtomicRef object.
2626
2727
"""
28-
dtype = typeof_impl(val.ref, c)
28+
dtype = typeof_impl(val.ref, ctx)
2929

3030
return AtomicRefType(
3131
dtype=dtype,

0 commit comments

Comments
 (0)