From 693340ba52860cf9e673e0520e8352e2ca6b8096 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Sun, 5 Jan 2025 21:39:38 -0600 Subject: [PATCH 1/5] size_t->std::size in for loop, that was added during merge --- dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp b/dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp index 654aef5b01..95df05f0b3 100644 --- a/dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp @@ -199,7 +199,7 @@ sycl::event async_smart_free(sycl::queue &exec_q, cgh.depends_on(depends); cgh.host_task([ptrs, dels]() { - for (size_t i = 0; i < ptrs.size(); ++i) { + for (std::size_t i = 0; i < ptrs.size(); ++i) { dels[i](ptrs[i]); } }); From 87e36f83fd50ec3204c93259b0e08bee9accc9aa Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 6 Jan 2025 06:29:02 -0600 Subject: [PATCH 2/5] Replaced int8_t->std::int8_t, same for other integral types Added missing `#include ` --- .../tensor/libtensor/include/kernels/clip.hpp | 2 +- .../kernels/elementwise_functions/conj.hpp | 2 +- .../include/utils/type_dispatch_building.hpp | 55 ++++++++++--------- .../source/integer_advanced_indexing.cpp | 4 +- .../source/integer_advanced_indexing.hpp | 4 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/dpctl/tensor/libtensor/include/kernels/clip.hpp b/dpctl/tensor/libtensor/include/kernels/clip.hpp index 0f6b3c502d..d808fc5bcf 100644 --- a/dpctl/tensor/libtensor/include/kernels/clip.hpp +++ b/dpctl/tensor/libtensor/include/kernels/clip.hpp @@ -113,7 +113,7 @@ class ClipContigFunctor const std::uint16_t sgSize = ndit.get_sub_group().get_local_range()[0]; const std::size_t gid = ndit.get_global_linear_id(); - const uint16_t nelems_per_sg = sgSize * nelems_per_wi; + const std::uint16_t nelems_per_sg = sgSize * nelems_per_wi; const std::size_t start = (gid / sgSize) * (nelems_per_sg - sgSize) + gid; diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp index a57a91fb17..0f41decb2b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp @@ -103,7 +103,7 @@ using ConjStridedFunctor = elementwise_common:: template struct ConjOutputType { using value_type = typename std::disjunction< - td_ns::TypeMapResultEntry, + td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, diff --git a/dpctl/tensor/libtensor/include/utils/type_dispatch_building.hpp b/dpctl/tensor/libtensor/include/utils/type_dispatch_building.hpp index 1cd378f83e..c11674cca7 100644 --- a/dpctl/tensor/libtensor/include/utils/type_dispatch_building.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_dispatch_building.hpp @@ -26,6 +26,7 @@ #pragma once #include +#include #include #include @@ -69,14 +70,14 @@ class DispatchTableBuilder { std::vector per_dstTy = { factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), - factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), + factory{}.get(), factory{}.get(), factory{}.get(), factory{}.get(), @@ -93,14 +94,14 @@ class DispatchTableBuilder void populate_dispatch_table(funcPtrT table[][_num_types]) const { const auto map_by_dst_type = {row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), - row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), + row_per_dst_type(), row_per_dst_type(), row_per_dst_type(), row_per_dst_type(), @@ -108,9 +109,9 @@ class DispatchTableBuilder row_per_dst_type>()}; assert(map_by_dst_type.size() == _num_types); int dst_id = 0; - for (auto &row : map_by_dst_type) { + for (const auto &row : map_by_dst_type) { int src_id = 0; - for (auto &fn_ptr : row) { + for (const auto &fn_ptr : row) { table[dst_id][src_id] = fn_ptr; ++src_id; } @@ -139,14 +140,14 @@ class DispatchVectorBuilder void populate_dispatch_vector(funcPtrT vector[]) const { const auto fn_map_by_type = {func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), - func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), + func_per_type(), func_per_type(), func_per_type(), func_per_type(), @@ -154,7 +155,7 @@ class DispatchVectorBuilder func_per_type>()}; assert(fn_map_by_type.size() == _num_types); int ty_id = 0; - for (auto &fn : fn_map_by_type) { + for (const auto &fn : fn_map_by_type) { vector[ty_id] = fn; ++ty_id; } diff --git a/dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp b/dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp index 6745948c5e..aa620690d3 100644 --- a/dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp +++ b/dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp @@ -245,7 +245,7 @@ usm_ndarray_take(const dpctl::tensor::usm_ndarray &src, const py::object &py_ind, const dpctl::tensor::usm_ndarray &dst, int axis_start, - uint8_t mode, + std::uint8_t mode, sycl::queue &exec_q, const std::vector &depends) { @@ -560,7 +560,7 @@ usm_ndarray_put(const dpctl::tensor::usm_ndarray &dst, const py::object &py_ind, const dpctl::tensor::usm_ndarray &val, int axis_start, - uint8_t mode, + std::uint8_t mode, sycl::queue &exec_q, const std::vector &depends) { diff --git a/dpctl/tensor/libtensor/source/integer_advanced_indexing.hpp b/dpctl/tensor/libtensor/source/integer_advanced_indexing.hpp index bee4883920..77bde0f49f 100644 --- a/dpctl/tensor/libtensor/source/integer_advanced_indexing.hpp +++ b/dpctl/tensor/libtensor/source/integer_advanced_indexing.hpp @@ -43,7 +43,7 @@ usm_ndarray_take(const dpctl::tensor::usm_ndarray &, const py::object &, const dpctl::tensor::usm_ndarray &, int, - uint8_t, + std::uint8_t, sycl::queue &, const std::vector & = {}); @@ -52,7 +52,7 @@ usm_ndarray_put(const dpctl::tensor::usm_ndarray &, const py::object &, const dpctl::tensor::usm_ndarray &, int, - uint8_t, + std::uint8_t, sycl::queue &, const std::vector & = {}); From affe2db10ea22ac71f605b4481cf01250a4a4b69 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 6 Jan 2025 07:39:43 -0600 Subject: [PATCH 3/5] Use C++ std:: qualified fixed width integral types in C++ implementation --- .../source/dpctl_sycl_queue_interface.cpp | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/libsyclinterface/source/dpctl_sycl_queue_interface.cpp b/libsyclinterface/source/dpctl_sycl_queue_interface.cpp index 3db14451ea..1c4ac2b516 100644 --- a/libsyclinterface/source/dpctl_sycl_queue_interface.cpp +++ b/libsyclinterface/source/dpctl_sycl_queue_interface.cpp @@ -31,9 +31,13 @@ #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_manager.h" #include "dpctl_sycl_type_casters.hpp" + +#include +#include + +#include #include #include -#include #include #include /* SYCL headers */ #include @@ -45,49 +49,49 @@ using namespace sycl; switch ((ARGTY)) { \ case DPCTL_INT8_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_UINT8_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_INT16_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_UINT16_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_INT32_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_UINT32_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_INT64_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ case DPCTL_UINT64_T: \ { \ - auto la = local_accessor(R, CGH); \ + auto la = local_accessor(R, CGH); \ CGH.set_arg(IDX, la); \ return true; \ } \ @@ -119,8 +123,8 @@ using namespace dpctl::syclinterface; typedef struct complex { - uint64_t real; - uint64_t imag; + std::uint64_t real; + std::uint64_t imag; } complexNumber; void set_dependent_events(handler &cgh, @@ -177,28 +181,28 @@ bool set_kernel_arg(handler &cgh, switch (ArgTy) { case DPCTL_INT8_T: - cgh.set_arg(idx, *(int8_t *)Arg); + cgh.set_arg(idx, *(std::int8_t *)Arg); break; case DPCTL_UINT8_T: - cgh.set_arg(idx, *(uint8_t *)Arg); + cgh.set_arg(idx, *(std::uint8_t *)Arg); break; case DPCTL_INT16_T: - cgh.set_arg(idx, *(int16_t *)Arg); + cgh.set_arg(idx, *(std::int16_t *)Arg); break; case DPCTL_UINT16_T: - cgh.set_arg(idx, *(uint16_t *)Arg); + cgh.set_arg(idx, *(std::uint16_t *)Arg); break; case DPCTL_INT32_T: - cgh.set_arg(idx, *(int32_t *)Arg); + cgh.set_arg(idx, *(std::int32_t *)Arg); break; case DPCTL_UINT32_T: - cgh.set_arg(idx, *(uint32_t *)Arg); + cgh.set_arg(idx, *(std::uint32_t *)Arg); break; case DPCTL_INT64_T: - cgh.set_arg(idx, *(int64_t *)Arg); + cgh.set_arg(idx, *(std::int64_t *)Arg); break; case DPCTL_UINT64_T: - cgh.set_arg(idx, *(uint64_t *)Arg); + cgh.set_arg(idx, *(std::uint64_t *)Arg); break; case DPCTL_FLOAT32_T: cgh.set_arg(idx, *(float *)Arg); From 73cd278fcedf92c096c0ac1b0cb431a391fdc0c5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 6 Jan 2025 08:40:35 -0600 Subject: [PATCH 4/5] Use qualified C++ integral types in test_sycl_queue_submit_local_accessor_arg.cpp --- .../tests/test_sycl_queue_submit.cpp | 101 +++++++++--------- ...t_sycl_queue_submit_local_accessor_arg.cpp | 76 ++++++------- 2 files changed, 90 insertions(+), 87 deletions(-) diff --git a/libsyclinterface/tests/test_sycl_queue_submit.cpp b/libsyclinterface/tests/test_sycl_queue_submit.cpp index 21aa7653e3..5cf3a941b9 100644 --- a/libsyclinterface/tests/test_sycl_queue_submit.cpp +++ b/libsyclinterface/tests/test_sycl_queue_submit.cpp @@ -32,17 +32,20 @@ #include "dpctl_sycl_queue_interface.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_sycl_usm_interface.h" + +#include + +#include #include #include #include #include -#include #include #include namespace { -constexpr size_t SIZE = 1024; +constexpr std::size_t SIZE = 1024; static_assert(SIZE % 8 == 0); using namespace dpctl::syclinterface; @@ -51,15 +54,15 @@ template void submit_kernel(DPCTLSyclQueueRef QRef, DPCTLSyclKernelBundleRef KBRef, std::vector spirvBuffer, - size_t spirvFileSize, + std::size_t spirvFileSize, DPCTLKernelArgType kernelArgTy, std::string kernelName) { T scalarVal = 3; - constexpr size_t NARGS = 4; - constexpr size_t RANGE_NDIMS_1 = 1; - constexpr size_t RANGE_NDIMS_2 = 2; - constexpr size_t RANGE_NDIMS_3 = 3; + constexpr std::size_t NARGS = 4; + constexpr std::size_t RANGE_NDIMS_1 = 1; + constexpr std::size_t RANGE_NDIMS_2 = 2; + constexpr std::size_t RANGE_NDIMS_3 = 3; ASSERT_TRUE(DPCTLKernelBundle_HasKernel(KBRef, kernelName.c_str())); auto kernel = DPCTLKernelBundle_GetKernel(KBRef, kernelName.c_str()); @@ -73,7 +76,7 @@ void submit_kernel(DPCTLSyclQueueRef QRef, ASSERT_TRUE(c != nullptr); // Create kernel args for vector_add - size_t Range[] = {SIZE}; + std::size_t Range[] = {SIZE}; void *args[NARGS] = {unwrap(a), unwrap(b), unwrap(c), (void *)&scalarVal}; DPCTLKernelArgType addKernelArgTypes[] = {DPCTL_VOID_PTR, DPCTL_VOID_PTR, @@ -84,7 +87,7 @@ void submit_kernel(DPCTLSyclQueueRef QRef, ASSERT_TRUE(E1Ref != nullptr); // Create kernel args for vector_add - size_t Range2D[] = {SIZE, 1}; + std::size_t Range2D[] = {SIZE, 1}; DPCTLSyclEventRef DepEvs[] = {E1Ref}; auto E2Ref = DPCTLQueue_SubmitRange(kernel, QRef, args, addKernelArgTypes, NARGS, @@ -92,7 +95,7 @@ void submit_kernel(DPCTLSyclQueueRef QRef, ASSERT_TRUE(E2Ref != nullptr); // Create kernel args for vector_add - size_t Range3D[] = {SIZE, 1, 1}; + std::size_t Range3D[] = {SIZE, 1, 1}; DPCTLSyclEventRef DepEvs2[] = {E1Ref, E2Ref}; auto E3Ref = DPCTLQueue_SubmitRange(kernel, QRef, args, addKernelArgTypes, NARGS, @@ -174,7 +177,7 @@ void submit_kernel( } template -void driver(size_t N) +void driver(std::size_t N) { sycl::queue q; auto *a = sycl::malloc_shared(N, q); @@ -191,19 +194,19 @@ void driver(size_t N) int main(int argc, const char **argv) { - size_t N = 0; + std::size_t N = 0; std::cout << "Enter problem size in N:\n"; std::cin >> N; std::cout << "Executing with N = " << N << std::endl; - driver(N); - driver(N); - driver(N); - driver(N); - driver(N); - driver(N); - driver(N); - driver(N); + driver(N); + driver(N); + driver(N); + driver(N); + driver(N); + driver(N); + driver(N); + driver(N); driver(N); driver(N); @@ -214,7 +217,7 @@ int main(int argc, const char **argv) struct TestQueueSubmit : public ::testing::Test { std::ifstream spirvFile; - size_t spirvFileSize_; + std::size_t spirvFileSize_; std::vector spirvBuffer_; DPCTLSyclQueueRef QRef = nullptr; DPCTLSyclKernelBundleRef KBRef = nullptr; @@ -255,7 +258,7 @@ struct TestQueueSubmit : public ::testing::Test struct TestQueueSubmitFP64 : public ::testing::Test { std::ifstream spirvFile; - size_t spirvFileSize_; + std::size_t spirvFileSize_; std::vector spirvBuffer_; DPCTLSyclDeviceRef DRef = nullptr; DPCTLSyclQueueRef QRef = nullptr; @@ -294,58 +297,58 @@ struct TestQueueSubmitFP64 : public ::testing::Test TEST_F(TestQueueSubmit, CheckForInt8) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT8_T, - "_ZTS11RangeKernelIaE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT8_T, + "_ZTS11RangeKernelIaE"); } TEST_F(TestQueueSubmit, CheckForUInt8) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT8_T, - "_ZTS11RangeKernelIhE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT8_T, + "_ZTS11RangeKernelIhE"); } TEST_F(TestQueueSubmit, CheckForInt16) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT16_T, - "_ZTS11RangeKernelIsE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT16_T, + "_ZTS11RangeKernelIsE"); } TEST_F(TestQueueSubmit, CheckForUInt16) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT16_T, - "_ZTS11RangeKernelItE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT16_T, + "_ZTS11RangeKernelItE"); } TEST_F(TestQueueSubmit, CheckForInt32) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT32_T, - "_ZTS11RangeKernelIiE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT32_T, + "_ZTS11RangeKernelIiE"); } TEST_F(TestQueueSubmit, CheckForUInt32) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT32_T, - "_ZTS11RangeKernelIjE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT32_T, + "_ZTS11RangeKernelIjE"); } TEST_F(TestQueueSubmit, CheckForInt64) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT64_T, - "_ZTS11RangeKernelIlE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT64_T, + "_ZTS11RangeKernelIlE"); } TEST_F(TestQueueSubmit, CheckForUInt64) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT64_T, - "_ZTS11RangeKernelImE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT64_T, + "_ZTS11RangeKernelImE"); } TEST_F(TestQueueSubmit, CheckForFloat) @@ -368,9 +371,9 @@ TEST_F(TestQueueSubmit, CheckForUnsupportedArgTy) { int scalarVal = 3; - size_t Range[] = {SIZE}; - size_t RANGE_NDIMS = 1; - constexpr size_t NARGS = 4; + std::size_t Range[] = {SIZE}; + std::size_t RANGE_NDIMS = 1; + constexpr std::size_t NARGS = 4; auto kernel = DPCTLKernelBundle_GetKernel(KBRef, "_ZTS11RangeKernelIdE"); void *args[NARGS] = {unwrap(nullptr), unwrap(nullptr), diff --git a/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp b/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp index 539fdbd4c5..5fd6f628b8 100644 --- a/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp +++ b/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp @@ -41,7 +41,7 @@ namespace { -constexpr size_t SIZE = 100; +constexpr std::size_t SIZE = 100; using namespace dpctl::syclinterface; @@ -49,12 +49,12 @@ template void submit_kernel(DPCTLSyclQueueRef QRef, DPCTLSyclKernelBundleRef KBRef, std::vector spirvBuffer, - size_t spirvFileSize, + std::size_t spirvFileSize, DPCTLKernelArgType kernelArgTy, std::string kernelName) { - constexpr size_t NARGS = 2; - constexpr size_t RANGE_NDIMS = 1; + constexpr std::size_t NARGS = 2; + constexpr std::size_t RANGE_NDIMS = 1; ASSERT_TRUE(DPCTLKernelBundle_HasKernel(KBRef, kernelName.c_str())); auto kernel = DPCTLKernelBundle_GetKernel(KBRef, kernelName.c_str()); @@ -70,8 +70,8 @@ void submit_kernel(DPCTLSyclQueueRef QRef, auto la1 = MDLocalAccessor{1, kernelArgTy, SIZE / 10, 1, 1}; // Create kernel args for vector_add - size_t gRange[] = {SIZE}; - size_t lRange[] = {SIZE / 10}; + std::size_t gRange[] = {SIZE}; + std::size_t lRange[] = {SIZE / 10}; void *args_1d[NARGS] = {unwrap(a), (void *)&la1}; DPCTLKernelArgType addKernelArgTypes[] = {DPCTL_VOID_PTR, DPCTL_LOCAL_ACCESSOR}; @@ -174,7 +174,7 @@ void submit_kernel(sycl::queue q, const unsigned long N, T *a) } template -void driver(size_t N) +void driver(std::size_t N) { sycl::queue q; auto *a = sycl::malloc_shared(N, q); @@ -185,7 +185,7 @@ void driver(size_t N) int main(int argc, const char **argv) { - size_t N = 0; + std::size_t N = 0; std::cout << "Enter problem size in N:\n"; std::cin >> N; std::cout << "Executing with N = " << N << std::endl; @@ -209,7 +209,7 @@ int main(int argc, const char **argv) struct TestQueueSubmitWithLocalAccessor : public ::testing::Test { std::ifstream spirvFile; - size_t spirvFileSize_; + std::size_t spirvFileSize_; std::vector spirvBuffer_; DPCTLSyclQueueRef QRef = nullptr; DPCTLSyclKernelBundleRef KBRef = nullptr; @@ -250,7 +250,7 @@ struct TestQueueSubmitWithLocalAccessor : public ::testing::Test struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test { std::ifstream spirvFile; - size_t spirvFileSize_; + std::size_t spirvFileSize_; std::vector spirvBuffer_; DPCTLSyclDeviceRef DRef = nullptr; DPCTLSyclQueueRef QRef = nullptr; @@ -289,58 +289,58 @@ struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test TEST_F(TestQueueSubmitWithLocalAccessor, CheckForInt8) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT8_T, - "_ZTS14SyclKernel_SLMIaE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT8_T, + "_ZTS14SyclKernel_SLMIaE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUInt8) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT8_T, - "_ZTS14SyclKernel_SLMIhE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT8_T, + "_ZTS14SyclKernel_SLMIhE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForInt16) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT16_T, - "_ZTS14SyclKernel_SLMIsE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT16_T, + "_ZTS14SyclKernel_SLMIsE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUInt16) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT16_T, - "_ZTS14SyclKernel_SLMItE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT16_T, + "_ZTS14SyclKernel_SLMItE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForInt32) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT32_T, - "_ZTS14SyclKernel_SLMIiE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT32_T, + "_ZTS14SyclKernel_SLMIiE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUInt32) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT32_T, - "_ZTS14SyclKernel_SLMIjE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT32_T, + "_ZTS14SyclKernel_SLMIjE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForInt64) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_INT64_T, - "_ZTS14SyclKernel_SLMIlE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_INT64_T, + "_ZTS14SyclKernel_SLMIlE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUInt64) { - submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, - DPCTLKernelArgType::DPCTL_UINT64_T, - "_ZTS14SyclKernel_SLMImE"); + submit_kernel(QRef, KBRef, spirvBuffer_, spirvFileSize_, + DPCTLKernelArgType::DPCTL_UINT64_T, + "_ZTS14SyclKernel_SLMImE"); } TEST_F(TestQueueSubmitWithLocalAccessor, CheckForFloat) @@ -361,10 +361,10 @@ TEST_F(TestQueueSubmitWithLocalAccessorFP64, CheckForDouble) TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUnsupportedArgTy) { - size_t gRange[] = {SIZE}; - size_t lRange[] = {SIZE / 10}; - size_t RANGE_NDIMS = 1; - constexpr size_t NARGS = 2; + std::size_t gRange[] = {SIZE}; + std::size_t lRange[] = {SIZE / 10}; + std::size_t RANGE_NDIMS = 1; + constexpr std::size_t NARGS = 2; auto la = MDLocalAccessor{1, DPCTL_UNSUPPORTED_KERNEL_ARG, SIZE / 10, 1, 1}; auto kernel = DPCTLKernelBundle_GetKernel(KBRef, "_ZTS14SyclKernel_SLMImE"); From 5c92afebe9fcded34d587c5cc2ace37607f49ca2 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:34:15 -0600 Subject: [PATCH 5/5] Separate include of C header from include of C++ headers by a new line --- libsyclinterface/tests/test_sycl_context_interface.cpp | 4 +++- libsyclinterface/tests/test_sycl_device_aspects.cpp | 4 +++- libsyclinterface/tests/test_sycl_device_interface.cpp | 4 +++- libsyclinterface/tests/test_sycl_device_manager.cpp | 4 +++- libsyclinterface/tests/test_sycl_device_subdevices.cpp | 5 +++-- libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp | 4 +++- libsyclinterface/tests/test_sycl_kernel_interface.cpp | 4 +++- libsyclinterface/tests/test_sycl_queue_interface.cpp | 4 +++- .../tests/test_sycl_queue_submit_local_accessor_arg.cpp | 4 +++- libsyclinterface/tests/test_sycl_usm_interface.cpp | 4 +++- 10 files changed, 30 insertions(+), 11 deletions(-) diff --git a/libsyclinterface/tests/test_sycl_context_interface.cpp b/libsyclinterface/tests/test_sycl_context_interface.cpp index 65995178db..2fda9435c0 100644 --- a/libsyclinterface/tests/test_sycl_context_interface.cpp +++ b/libsyclinterface/tests/test_sycl_context_interface.cpp @@ -29,8 +29,10 @@ #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_sycl_types.h" -#include + #include + +#include #include #include diff --git a/libsyclinterface/tests/test_sycl_device_aspects.cpp b/libsyclinterface/tests/test_sycl_device_aspects.cpp index a535a66e69..c806cff4fb 100644 --- a/libsyclinterface/tests/test_sycl_device_aspects.cpp +++ b/libsyclinterface/tests/test_sycl_device_aspects.cpp @@ -30,8 +30,10 @@ #include "dpctl_sycl_enum_types.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_utils_helper.h" -#include + #include + +#include #include #include diff --git a/libsyclinterface/tests/test_sycl_device_interface.cpp b/libsyclinterface/tests/test_sycl_device_interface.cpp index 5698752afa..5d3c4d810a 100644 --- a/libsyclinterface/tests/test_sycl_device_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_interface.cpp @@ -29,8 +29,10 @@ #include "dpctl_sycl_platform_interface.h" #include "dpctl_utils.h" #include "dpctl_utils_helper.h" -#include + #include + +#include #include using namespace sycl; diff --git a/libsyclinterface/tests/test_sycl_device_manager.cpp b/libsyclinterface/tests/test_sycl_device_manager.cpp index 745ba5ed1c..b5f1fbc725 100644 --- a/libsyclinterface/tests/test_sycl_device_manager.cpp +++ b/libsyclinterface/tests/test_sycl_device_manager.cpp @@ -30,8 +30,10 @@ #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_utils.h" #include "dpctl_utils_helper.h" -#include + #include + +#include #include using dpctl::syclinterface::dpctl_default_selector; diff --git a/libsyclinterface/tests/test_sycl_device_subdevices.cpp b/libsyclinterface/tests/test_sycl_device_subdevices.cpp index edc832982c..5d5ab7b933 100644 --- a/libsyclinterface/tests/test_sycl_device_subdevices.cpp +++ b/libsyclinterface/tests/test_sycl_device_subdevices.cpp @@ -1,4 +1,3 @@ - //===--- test_sycl_device_interface.cpp - Test cases for device interface ===// // // Data Parallel Control (dpCtl) @@ -32,8 +31,10 @@ #include "dpctl_sycl_type_casters.hpp" #include "dpctl_utils.h" #include "dpctl_utils_helper.h" -#include + #include + +#include #include using namespace sycl; diff --git a/libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp b/libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp index de755a3b23..aa35856d7f 100644 --- a/libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp +++ b/libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp @@ -33,11 +33,13 @@ #include "dpctl_sycl_kernel_bundle_interface.h" #include "dpctl_sycl_kernel_interface.h" #include "dpctl_sycl_queue_interface.h" + +#include + #include #include #include #include -#include #include using namespace sycl; diff --git a/libsyclinterface/tests/test_sycl_kernel_interface.cpp b/libsyclinterface/tests/test_sycl_kernel_interface.cpp index c2c0d8bda0..dfcbc377a6 100644 --- a/libsyclinterface/tests/test_sycl_kernel_interface.cpp +++ b/libsyclinterface/tests/test_sycl_kernel_interface.cpp @@ -32,9 +32,11 @@ #include "dpctl_sycl_kernel_interface.h" #include "dpctl_sycl_queue_interface.h" #include "dpctl_utils.h" + +#include + #include #include -#include #include using namespace sycl; diff --git a/libsyclinterface/tests/test_sycl_queue_interface.cpp b/libsyclinterface/tests/test_sycl_queue_interface.cpp index 1de3b90891..d5a5b58bd9 100644 --- a/libsyclinterface/tests/test_sycl_queue_interface.cpp +++ b/libsyclinterface/tests/test_sycl_queue_interface.cpp @@ -33,8 +33,10 @@ #include "dpctl_sycl_queue_interface.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_sycl_usm_interface.h" -#include + #include + +#include #include using namespace sycl; diff --git a/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp b/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp index 5fd6f628b8..86f37b3c51 100644 --- a/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp +++ b/libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp @@ -32,10 +32,12 @@ #include "dpctl_sycl_queue_interface.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_sycl_usm_interface.h" + +#include + #include #include #include -#include #include #include diff --git a/libsyclinterface/tests/test_sycl_usm_interface.cpp b/libsyclinterface/tests/test_sycl_usm_interface.cpp index fc54e3a411..8c3b39a2c7 100644 --- a/libsyclinterface/tests/test_sycl_usm_interface.cpp +++ b/libsyclinterface/tests/test_sycl_usm_interface.cpp @@ -31,9 +31,11 @@ #include "dpctl_sycl_queue_interface.h" #include "dpctl_sycl_type_casters.hpp" #include "dpctl_sycl_usm_interface.h" + +#include + #include #include -#include #include using namespace sycl;