Skip to content

Commit 545dff2

Browse files
author
Diptorup Deb
authored
Merge pull request #1581 from IntelPython/update/dpctl_kernelargtypes
Updated the DPCTLKernelArgType enum values to be aligned with C++11 types
2 parents e69d268 + 554541f commit 545dff2

10 files changed

+535
-324
lines changed

dpctl/_backend.pxd

+10-15
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,16 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
5757
_UNKNOWN_DEVICE 'DPCTL_UNKNOWN_DEVICE'
5858

5959
ctypedef enum _arg_data_type 'DPCTLKernelArgType':
60-
_CHAR 'DPCTL_CHAR',
61-
_SIGNED_CHAR 'DPCTL_SIGNED_CHAR',
62-
_UNSIGNED_CHAR 'DPCTL_UNSIGNED_CHAR',
63-
_SHORT 'DPCTL_SHORT',
64-
_INT 'DPCTL_INT',
65-
_UNSIGNED_INT 'DPCTL_UNSIGNED_INT',
66-
_UNSIGNED_INT8 'DPCTL_UNSIGNED_INT8',
67-
_LONG 'DPCTL_LONG',
68-
_UNSIGNED_LONG 'DPCTL_UNSIGNED_LONG',
69-
_LONG_LONG 'DPCTL_LONG_LONG',
70-
_UNSIGNED_LONG_LONG 'DPCTL_UNSIGNED_LONG_LONG',
71-
_SIZE_T 'DPCTL_SIZE_T',
72-
_FLOAT 'DPCTL_FLOAT',
73-
_DOUBLE 'DPCTL_DOUBLE',
74-
_LONG_DOUBLE 'DPCTL_DOUBLE',
60+
_INT8_T 'DPCTL_INT8_T',
61+
_UINT8_T 'DPCTL_UINT8_T',
62+
_INT16_T 'DPCTL_INT16_T',
63+
_UINT16_T 'DPCTL_UINT16_T',
64+
_INT32_T 'DPCTL_INT32_T',
65+
_UINT32_T 'DPCTL_UINT32_T',
66+
_INT64_T 'DPCTL_INT64_T',
67+
_UINT64_T 'DPCTL_UINT64_T',
68+
_FLOAT 'DPCTL_FLOAT32_T',
69+
_DOUBLE 'DPCTL_FLOAT64_T',
7570
_VOID_PTR 'DPCTL_VOID_PTR'
7671

7772
ctypedef enum _queue_property_type 'DPCTLQueuePropertyType':

dpctl/_sycl_queue.pyx

+13-19
Original file line numberDiff line numberDiff line change
@@ -631,34 +631,28 @@ cdef class SyclQueue(_SyclQueue):
631631
for idx, arg in enumerate(args):
632632
if isinstance(arg, ctypes.c_char):
633633
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
634-
kargty[idx] = _arg_data_type._CHAR
635-
elif isinstance(arg, ctypes.c_int):
634+
kargty[idx] = _arg_data_type._INT8_T
635+
elif isinstance(arg, ctypes.c_uint8):
636636
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
637-
kargty[idx] = _arg_data_type._INT
638-
elif isinstance(arg, ctypes.c_uint):
637+
kargty[idx] = _arg_data_type._UINT8_T
638+
elif isinstance(arg, ctypes.c_short):
639639
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
640-
kargty[idx] = _arg_data_type._UNSIGNED_INT
641-
elif isinstance(arg, ctypes.c_uint8):
640+
kargty[idx] = _arg_data_type._INT16_T
641+
elif isinstance(arg, ctypes.c_ushort):
642642
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
643-
kargty[idx] = _arg_data_type._UNSIGNED_INT8
644-
elif isinstance(arg, ctypes.c_long):
643+
kargty[idx] = _arg_data_type._UINT16_T
644+
elif isinstance(arg, ctypes.c_int):
645645
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
646-
kargty[idx] = _arg_data_type._LONG
647-
elif isinstance(arg, ctypes.c_ulong):
646+
kargty[idx] = _arg_data_type._INT32_T
647+
elif isinstance(arg, ctypes.c_uint):
648648
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
649-
kargty[idx] = _arg_data_type._UNSIGNED_LONG
649+
kargty[idx] = _arg_data_type._UINT32_T
650650
elif isinstance(arg, ctypes.c_longlong):
651651
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
652-
kargty[idx] = _arg_data_type._LONG_LONG
652+
kargty[idx] = _arg_data_type._INT64_T
653653
elif isinstance(arg, ctypes.c_ulonglong):
654654
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
655-
kargty[idx] = _arg_data_type._UNSIGNED_LONG_LONG
656-
elif isinstance(arg, ctypes.c_short):
657-
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
658-
kargty[idx] = _arg_data_type._SHORT
659-
elif isinstance(arg, ctypes.c_size_t):
660-
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
661-
kargty[idx] = _arg_data_type._SIZE_T
655+
kargty[idx] = _arg_data_type._UINT64_T
662656
elif isinstance(arg, ctypes.c_float):
663657
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
664658
kargty[idx] = _arg_data_type._FLOAT

dpctl/enum_types.py

+19
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/dbg_build.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@
22
set +xe
33
rm -rf build
44
mkdir build
5-
pushd build
5+
pushd build || exit 1
66

7-
INSTALL_PREFIX=`pwd`/../install
7+
INSTALL_PREFIX=$(pwd)/../install
88
rm -rf ${INSTALL_PREFIX}
99

1010
cmake \
1111
-DCMAKE_BUILD_TYPE=Debug \
1212
-DCMAKE_C_COMPILER=icx \
13-
-DCMAKE_CXX_COMPILER=dpcpp \
13+
-DCMAKE_CXX_COMPILER=icpx \
14+
-DCMAKE_CXX_FLAGS=-fsycl \
1415
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
1516
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
1617
-DDPCTL_ENABLE_L0_PROGRAM_CREATION=ON \
1718
-DDPCTL_BUILD_CAPI_TESTS=ON \
18-
-DDPCTL_GENERATE_COVERAGE=ON \
1919
..
2020

2121
make V=1 -n -j 4 && make check && make install
2222

23-
# Turn on to generate coverage report html files
24-
make lcov-genhtml
23+
# Turn on to generate coverage report html files reconfigure with
24+
# -DDPCTL_GENERATE_COVERAGE=ON and then
25+
# make lcov-genhtml
2526

2627
# For more verbose tests use:
2728
# cd tests
2829
# ctest -V --progress --output-on-failure -j 4
2930
# cd ..
3031

31-
popd
32+
popd || exit 1

libsyclinterface/include/dpctl_sycl_enum_types.h

+12-16
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
/*!

0 commit comments

Comments
 (0)