Skip to content

Commit 472afd0

Browse files
Diptorup Deboleksandr-pavlyk
authored andcommitted
Switch DPCTLKernelArgTypes to C++11 types.
1 parent e3fb7b3 commit 472afd0

File tree

3 files changed

+49
-49
lines changed

3 files changed

+49
-49
lines changed

dpctl/enum_types.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,22 @@ class global_mem_cache_type(Enum):
113113
none = auto()
114114
read_only = auto()
115115
read_write = auto()
116+
117+
118+
class kernel_arg_type(Enum):
119+
"""
120+
An enumeration of supported kernel argument types in
121+
:func:`dpctl.SyclQueue.submit`
122+
"""
123+
124+
dpctl_int8 = auto()
125+
dpctl_uint8 = auto()
126+
dpctl_int16 = auto()
127+
dpctl_uint16 = auto()
128+
dpctl_int32 = auto()
129+
dpctl_uint32 = auto()
130+
dpctl_int64 = auto()
131+
dpctl_uint64 = auto()
132+
dpctl_float32 = auto()
133+
dpctl_float64 = auto()
134+
dpctl_void_ptr = auto()

libsyclinterface/include/dpctl_sycl_enum_types.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,18 @@ typedef enum
8787
*/
8888
typedef enum
8989
{
90-
DPCTL_CHAR,
91-
DPCTL_SIGNED_CHAR,
92-
DPCTL_UNSIGNED_CHAR,
93-
DPCTL_SHORT,
94-
DPCTL_INT,
95-
DPCTL_UNSIGNED_INT,
96-
DPCTL_UNSIGNED_INT8,
97-
DPCTL_LONG,
98-
DPCTL_UNSIGNED_LONG,
99-
DPCTL_LONG_LONG,
100-
DPCTL_UNSIGNED_LONG_LONG,
101-
DPCTL_SIZE_T,
102-
DPCTL_FLOAT,
103-
DPCTL_DOUBLE,
104-
DPCTL_LONG_DOUBLE,
105-
DPCTL_VOID_PTR
90+
DPCTL_INT8_T,
91+
DPCTL_UINT8_T,
92+
DPCTL_INT16_T,
93+
DPCTL_UINT16_T,
94+
DPCTL_INT32_T,
95+
DPCTL_UINT32_T,
96+
DPCTL_INT64_T,
97+
DPCTL_UINT64_T,
98+
DPCTL_FLOAT32_T,
99+
DPCTL_FLOAT64_T,
100+
DPCTL_VOID_PTR,
101+
DPCTL_UNSUPPORTED_KERNEL_ARG
106102
} DPCTLKernelArgType;
107103

108104
/*!

libsyclinterface/source/dpctl_sycl_queue_interface.cpp

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,51 +65,36 @@ bool set_kernel_arg(handler &cgh,
6565
bool arg_set = true;
6666

6767
switch (ArgTy) {
68-
case DPCTL_CHAR:
69-
cgh.set_arg(idx, *(char *)Arg);
68+
case DPCTL_INT8_T:
69+
cgh.set_arg(idx, *(int8_t *)Arg);
7070
break;
71-
case DPCTL_SIGNED_CHAR:
72-
cgh.set_arg(idx, *(signed char *)Arg);
73-
break;
74-
case DPCTL_UNSIGNED_CHAR:
75-
cgh.set_arg(idx, *(unsigned char *)Arg);
76-
break;
77-
case DPCTL_SHORT:
78-
cgh.set_arg(idx, *(short *)Arg);
79-
break;
80-
case DPCTL_INT:
81-
cgh.set_arg(idx, *(int *)Arg);
82-
break;
83-
case DPCTL_UNSIGNED_INT:
84-
cgh.set_arg(idx, *(unsigned int *)Arg);
85-
break;
86-
case DPCTL_UNSIGNED_INT8:
71+
case DPCTL_UINT8_T:
8772
cgh.set_arg(idx, *(uint8_t *)Arg);
8873
break;
89-
case DPCTL_LONG:
90-
cgh.set_arg(idx, *(long *)Arg);
74+
case DPCTL_INT16_T:
75+
cgh.set_arg(idx, *(int16_t *)Arg);
76+
break;
77+
case DPCTL_UINT16_T:
78+
cgh.set_arg(idx, *(uint16_t *)Arg);
9179
break;
92-
case DPCTL_UNSIGNED_LONG:
93-
cgh.set_arg(idx, *(unsigned long *)Arg);
80+
case DPCTL_INT32_T:
81+
cgh.set_arg(idx, *(int32_t *)Arg);
9482
break;
95-
case DPCTL_LONG_LONG:
96-
cgh.set_arg(idx, *(long long *)Arg);
83+
case DPCTL_UINT32_T:
84+
cgh.set_arg(idx, *(uint32_t *)Arg);
9785
break;
98-
case DPCTL_UNSIGNED_LONG_LONG:
99-
cgh.set_arg(idx, *(unsigned long long *)Arg);
86+
case DPCTL_INT64_T:
87+
cgh.set_arg(idx, *(int64_t *)Arg);
10088
break;
101-
case DPCTL_SIZE_T:
102-
cgh.set_arg(idx, *(size_t *)Arg);
89+
case DPCTL_UINT64_T:
90+
cgh.set_arg(idx, *(uint64_t *)Arg);
10391
break;
104-
case DPCTL_FLOAT:
92+
case DPCTL_FLOAT32_T:
10593
cgh.set_arg(idx, *(float *)Arg);
10694
break;
107-
case DPCTL_DOUBLE:
95+
case DPCTL_FLOAT64_T:
10896
cgh.set_arg(idx, *(double *)Arg);
10997
break;
110-
case DPCTL_LONG_DOUBLE:
111-
cgh.set_arg(idx, *(long double *)Arg);
112-
break;
11398
case DPCTL_VOID_PTR:
11499
cgh.set_arg(idx, Arg);
115100
break;

0 commit comments

Comments
 (0)