File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
numba_dpex/tests/experimental/IntEnumLiteral Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # SPDX-FileCopyrightText: 2023 Intel Corporation
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ import dpnp
6
+ from numba .core import types
7
+ from numba .extending import intrinsic , overload
8
+
9
+ import numba_dpex .experimental as exp_dpex
10
+ from numba_dpex import Range , dpjit
11
+ from numba_dpex .experimental .flag_enum import FlagEnum
12
+
13
+
14
+ class MockFlags (FlagEnum ):
15
+ FLAG1 = 100
16
+ FLAG2 = 200
17
+
18
+
19
+ @exp_dpex .kernel (
20
+ release_gil = False ,
21
+ no_compile = True ,
22
+ no_cpython_wrapper = True ,
23
+ no_cfunc_wrapper = True ,
24
+ )
25
+ def update_with_flag (a ):
26
+ a [0 ] = MockFlags .FLAG1
27
+ a [1 ] = MockFlags .FLAG2
28
+
29
+
30
+ def test_compilation_of_flag_enum ():
31
+ """Tests if a FlagEnum subclass can be used inside a kernel function."""
32
+ a = dpnp .ones (10 , dtype = dpnp .int64 )
33
+ exp_dpex .call_kernel (update_with_flag , Range (10 ), a )
34
+
35
+ assert a [0 ] == MockFlags .FLAG1
36
+ assert a [1 ] == MockFlags .FLAG2
37
+ for idx in range (2 , 9 ):
38
+ assert a [idx ] == 1
You can’t perform that action at this time.
0 commit comments