Skip to content

Commit 72177b8

Browse files
author
Diptorup Deb
committed
Unit test for IntEnumLiteral compilation
1 parent a5409d7 commit 72177b8

File tree

1 file changed

+1
-44
lines changed

1 file changed

+1
-44
lines changed

numba_dpex/tests/experimental/IntEnumLiteral/test_compilation.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,53 +29,10 @@ def update_with_flag(a):
2929

3030
def test_compilation_of_flag_enum():
3131
"""Tests if a FlagEnum subclass can be used inside a kernel function."""
32-
a = dpnp.ones(10)
32+
a = dpnp.ones(10, dpnp.int64)
3333
exp_dpex.call_kernel(update_with_flag, Range(10), a)
3434

3535
assert a[0] == MockFlags.FLAG1
3636
assert a[1] == MockFlags.FLAG2
3737
for idx in range(2, 9):
3838
assert a[idx] == 1
39-
40-
41-
def test_compilation_of_flag_enum_as_a_literal():
42-
"""Tests if a FlagEnum subclass can be used inside a kernel function."""
43-
44-
# pylint: disable=W0613
45-
def _inspect_kernel(kernel_fn, index_space, *kernel_args):
46-
pass
47-
48-
@intrinsic
49-
def intrin_inspect_kernel(
50-
typingctx, kernel_fn, index_space, kernel_args # pylint: disable=W0613
51-
):
52-
kernel_args_list = list(kernel_args)
53-
# signature of the kernel_fn
54-
kernel_sig = types.void(*kernel_args_list)
55-
kernel_fn.dispatcher.compile(kernel_sig)
56-
kcres = kernel_fn.dispatcher.get_overload_kcres(kernel_sig)
57-
breakpoint()
58-
59-
@overload(_inspect_kernel, target="cpu")
60-
def _ol_inspect_kernel(kernel_fn, index_space, *kernel_args):
61-
def impl(kernel_fn, index_space, *kernel_args):
62-
intrin_inspect_kernel( # pylint: disable=E1120
63-
kernel_fn, index_space, kernel_args
64-
)
65-
66-
return impl
67-
68-
@dpjit
69-
def inspect_kernel(kernel_fn, index_space, *kernel_args):
70-
"""An overload that is used to compile a kernel and inspect the
71-
generated LLVM IR.
72-
"""
73-
_inspect_kernel(kernel_fn, index_space, *kernel_args)
74-
75-
a = dpnp.ones(10, dtype=dpnp.int64)
76-
inspect_kernel(update_with_flag, Range(10), a)
77-
78-
assert a[0] == MockFlags.FLAG1
79-
assert a[1] == MockFlags.FLAG2
80-
for idx in range(2, 9):
81-
assert a[idx] == 1

0 commit comments

Comments
 (0)