Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport gh-1581 to 0.16.x maintenance branch #1609

Merged
merged 6 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions dpctl/_backend.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,16 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
_UNKNOWN_DEVICE 'DPCTL_UNKNOWN_DEVICE'

ctypedef enum _arg_data_type 'DPCTLKernelArgType':
_CHAR 'DPCTL_CHAR',
_SIGNED_CHAR 'DPCTL_SIGNED_CHAR',
_UNSIGNED_CHAR 'DPCTL_UNSIGNED_CHAR',
_SHORT 'DPCTL_SHORT',
_INT 'DPCTL_INT',
_UNSIGNED_INT 'DPCTL_UNSIGNED_INT',
_UNSIGNED_INT8 'DPCTL_UNSIGNED_INT8',
_LONG 'DPCTL_LONG',
_UNSIGNED_LONG 'DPCTL_UNSIGNED_LONG',
_LONG_LONG 'DPCTL_LONG_LONG',
_UNSIGNED_LONG_LONG 'DPCTL_UNSIGNED_LONG_LONG',
_SIZE_T 'DPCTL_SIZE_T',
_FLOAT 'DPCTL_FLOAT',
_DOUBLE 'DPCTL_DOUBLE',
_LONG_DOUBLE 'DPCTL_DOUBLE',
_INT8_T 'DPCTL_INT8_T',
_UINT8_T 'DPCTL_UINT8_T',
_INT16_T 'DPCTL_INT16_T',
_UINT16_T 'DPCTL_UINT16_T',
_INT32_T 'DPCTL_INT32_T',
_UINT32_T 'DPCTL_UINT32_T',
_INT64_T 'DPCTL_INT64_T',
_UINT64_T 'DPCTL_UINT64_T',
_FLOAT 'DPCTL_FLOAT32_T',
_DOUBLE 'DPCTL_FLOAT64_T',
_VOID_PTR 'DPCTL_VOID_PTR'

ctypedef enum _queue_property_type 'DPCTLQueuePropertyType':
Expand Down
32 changes: 13 additions & 19 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -631,34 +631,28 @@ cdef class SyclQueue(_SyclQueue):
for idx, arg in enumerate(args):
if isinstance(arg, ctypes.c_char):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._CHAR
elif isinstance(arg, ctypes.c_int):
kargty[idx] = _arg_data_type._INT8_T
elif isinstance(arg, ctypes.c_uint8):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._INT
elif isinstance(arg, ctypes.c_uint):
kargty[idx] = _arg_data_type._UINT8_T
elif isinstance(arg, ctypes.c_short):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._UNSIGNED_INT
elif isinstance(arg, ctypes.c_uint8):
kargty[idx] = _arg_data_type._INT16_T
elif isinstance(arg, ctypes.c_ushort):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._UNSIGNED_INT8
elif isinstance(arg, ctypes.c_long):
kargty[idx] = _arg_data_type._UINT16_T
elif isinstance(arg, ctypes.c_int):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._LONG
elif isinstance(arg, ctypes.c_ulong):
kargty[idx] = _arg_data_type._INT32_T
elif isinstance(arg, ctypes.c_uint):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._UNSIGNED_LONG
kargty[idx] = _arg_data_type._UINT32_T
elif isinstance(arg, ctypes.c_longlong):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._LONG_LONG
kargty[idx] = _arg_data_type._INT64_T
elif isinstance(arg, ctypes.c_ulonglong):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._UNSIGNED_LONG_LONG
elif isinstance(arg, ctypes.c_short):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._SHORT
elif isinstance(arg, ctypes.c_size_t):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._SIZE_T
kargty[idx] = _arg_data_type._UINT64_T
elif isinstance(arg, ctypes.c_float):
kargs[idx] = <void*><size_t>(ctypes.addressof(arg))
kargty[idx] = _arg_data_type._FLOAT
Expand Down
19 changes: 19 additions & 0 deletions dpctl/enum_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,22 @@ class global_mem_cache_type(Enum):
none = auto()
read_only = auto()
read_write = auto()


class kernel_arg_type(Enum):
"""
An enumeration of supported kernel argument types in
:func:`dpctl.SyclQueue.submit`
"""

dpctl_int8 = auto()
dpctl_uint8 = auto()
dpctl_int16 = auto()
dpctl_uint16 = auto()
dpctl_int32 = auto()
dpctl_uint32 = auto()
dpctl_int64 = auto()
dpctl_uint64 = auto()
dpctl_float32 = auto()
dpctl_float64 = auto()
dpctl_void_ptr = auto()
15 changes: 8 additions & 7 deletions libsyclinterface/dbg_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@
set +xe
rm -rf build
mkdir build
pushd build
pushd build || exit 1

INSTALL_PREFIX=`pwd`/../install
INSTALL_PREFIX=$(pwd)/../install
rm -rf ${INSTALL_PREFIX}

cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=icx \
-DCMAKE_CXX_COMPILER=dpcpp \
-DCMAKE_CXX_COMPILER=icpx \
-DCMAKE_CXX_FLAGS=-fsycl \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
-DDPCTL_ENABLE_L0_PROGRAM_CREATION=ON \
-DDPCTL_BUILD_CAPI_TESTS=ON \
-DDPCTL_GENERATE_COVERAGE=ON \
..

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

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

# For more verbose tests use:
# cd tests
# ctest -V --progress --output-on-failure -j 4
# cd ..

popd
popd || exit 1
28 changes: 12 additions & 16 deletions libsyclinterface/include/dpctl_sycl_enum_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,18 @@ typedef enum
*/
typedef enum
{
DPCTL_CHAR,
DPCTL_SIGNED_CHAR,
DPCTL_UNSIGNED_CHAR,
DPCTL_SHORT,
DPCTL_INT,
DPCTL_UNSIGNED_INT,
DPCTL_UNSIGNED_INT8,
DPCTL_LONG,
DPCTL_UNSIGNED_LONG,
DPCTL_LONG_LONG,
DPCTL_UNSIGNED_LONG_LONG,
DPCTL_SIZE_T,
DPCTL_FLOAT,
DPCTL_DOUBLE,
DPCTL_LONG_DOUBLE,
DPCTL_VOID_PTR
DPCTL_INT8_T,
DPCTL_UINT8_T,
DPCTL_INT16_T,
DPCTL_UINT16_T,
DPCTL_INT32_T,
DPCTL_UINT32_T,
DPCTL_INT64_T,
DPCTL_UINT64_T,
DPCTL_FLOAT32_T,
DPCTL_FLOAT64_T,
DPCTL_VOID_PTR,
DPCTL_UNSUPPORTED_KERNEL_ARG
} DPCTLKernelArgType;

/*!
Expand Down
Loading