Skip to content

Commit 1eebdf2

Browse files
Merge pull request #1955 from IntelPython/additional-qualified-cpp-types
Additional qualified cpp types
2 parents 64ec889 + 5c92afe commit 1eebdf2

18 files changed

+178
-151
lines changed

dpctl/tensor/libtensor/include/kernels/clip.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ClipContigFunctor
113113
const std::uint16_t sgSize =
114114
ndit.get_sub_group().get_local_range()[0];
115115
const std::size_t gid = ndit.get_global_linear_id();
116-
const uint16_t nelems_per_sg = sgSize * nelems_per_wi;
116+
const std::uint16_t nelems_per_sg = sgSize * nelems_per_wi;
117117

118118
const std::size_t start =
119119
(gid / sgSize) * (nelems_per_sg - sgSize) + gid;

dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ using ConjStridedFunctor = elementwise_common::
103103
template <typename T> struct ConjOutputType
104104
{
105105
using value_type = typename std::disjunction<
106-
td_ns::TypeMapResultEntry<T, bool, int8_t>,
106+
td_ns::TypeMapResultEntry<T, bool, std::int8_t>,
107107
td_ns::TypeMapResultEntry<T, std::uint8_t>,
108108
td_ns::TypeMapResultEntry<T, std::uint16_t>,
109109
td_ns::TypeMapResultEntry<T, std::uint32_t>,

dpctl/tensor/libtensor/include/utils/sycl_alloc_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ sycl::event async_smart_free(sycl::queue &exec_q,
199199
cgh.depends_on(depends);
200200

201201
cgh.host_task([ptrs, dels]() {
202-
for (size_t i = 0; i < ptrs.size(); ++i) {
202+
for (std::size_t i = 0; i < ptrs.size(); ++i) {
203203
dels[i](ptrs[i]);
204204
}
205205
});

dpctl/tensor/libtensor/include/utils/type_dispatch_building.hpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#pragma once
2727

2828
#include <complex>
29+
#include <cstdint>
2930
#include <type_traits>
3031

3132
#include <sycl/sycl.hpp>
@@ -69,14 +70,14 @@ class DispatchTableBuilder
6970
{
7071
std::vector<funcPtrT> per_dstTy = {
7172
factory<funcPtrT, dstTy, bool>{}.get(),
72-
factory<funcPtrT, dstTy, int8_t>{}.get(),
73-
factory<funcPtrT, dstTy, uint8_t>{}.get(),
74-
factory<funcPtrT, dstTy, int16_t>{}.get(),
75-
factory<funcPtrT, dstTy, uint16_t>{}.get(),
76-
factory<funcPtrT, dstTy, int32_t>{}.get(),
77-
factory<funcPtrT, dstTy, uint32_t>{}.get(),
78-
factory<funcPtrT, dstTy, int64_t>{}.get(),
79-
factory<funcPtrT, dstTy, uint64_t>{}.get(),
73+
factory<funcPtrT, dstTy, std::int8_t>{}.get(),
74+
factory<funcPtrT, dstTy, std::uint8_t>{}.get(),
75+
factory<funcPtrT, dstTy, std::int16_t>{}.get(),
76+
factory<funcPtrT, dstTy, std::uint16_t>{}.get(),
77+
factory<funcPtrT, dstTy, std::int32_t>{}.get(),
78+
factory<funcPtrT, dstTy, std::uint32_t>{}.get(),
79+
factory<funcPtrT, dstTy, std::int64_t>{}.get(),
80+
factory<funcPtrT, dstTy, std::uint64_t>{}.get(),
8081
factory<funcPtrT, dstTy, sycl::half>{}.get(),
8182
factory<funcPtrT, dstTy, float>{}.get(),
8283
factory<funcPtrT, dstTy, double>{}.get(),
@@ -93,24 +94,24 @@ class DispatchTableBuilder
9394
void populate_dispatch_table(funcPtrT table[][_num_types]) const
9495
{
9596
const auto map_by_dst_type = {row_per_dst_type<bool>(),
96-
row_per_dst_type<int8_t>(),
97-
row_per_dst_type<uint8_t>(),
98-
row_per_dst_type<int16_t>(),
99-
row_per_dst_type<uint16_t>(),
100-
row_per_dst_type<int32_t>(),
101-
row_per_dst_type<uint32_t>(),
102-
row_per_dst_type<int64_t>(),
103-
row_per_dst_type<uint64_t>(),
97+
row_per_dst_type<std::int8_t>(),
98+
row_per_dst_type<std::uint8_t>(),
99+
row_per_dst_type<std::int16_t>(),
100+
row_per_dst_type<std::uint16_t>(),
101+
row_per_dst_type<std::int32_t>(),
102+
row_per_dst_type<std::uint32_t>(),
103+
row_per_dst_type<std::int64_t>(),
104+
row_per_dst_type<std::uint64_t>(),
104105
row_per_dst_type<sycl::half>(),
105106
row_per_dst_type<float>(),
106107
row_per_dst_type<double>(),
107108
row_per_dst_type<std::complex<float>>(),
108109
row_per_dst_type<std::complex<double>>()};
109110
assert(map_by_dst_type.size() == _num_types);
110111
int dst_id = 0;
111-
for (auto &row : map_by_dst_type) {
112+
for (const auto &row : map_by_dst_type) {
112113
int src_id = 0;
113-
for (auto &fn_ptr : row) {
114+
for (const auto &fn_ptr : row) {
114115
table[dst_id][src_id] = fn_ptr;
115116
++src_id;
116117
}
@@ -139,22 +140,22 @@ class DispatchVectorBuilder
139140
void populate_dispatch_vector(funcPtrT vector[]) const
140141
{
141142
const auto fn_map_by_type = {func_per_type<bool>(),
142-
func_per_type<int8_t>(),
143-
func_per_type<uint8_t>(),
144-
func_per_type<int16_t>(),
145-
func_per_type<uint16_t>(),
146-
func_per_type<int32_t>(),
147-
func_per_type<uint32_t>(),
148-
func_per_type<int64_t>(),
149-
func_per_type<uint64_t>(),
143+
func_per_type<std::int8_t>(),
144+
func_per_type<std::uint8_t>(),
145+
func_per_type<std::int16_t>(),
146+
func_per_type<std::uint16_t>(),
147+
func_per_type<std::int32_t>(),
148+
func_per_type<std::uint32_t>(),
149+
func_per_type<std::int64_t>(),
150+
func_per_type<std::uint64_t>(),
150151
func_per_type<sycl::half>(),
151152
func_per_type<float>(),
152153
func_per_type<double>(),
153154
func_per_type<std::complex<float>>(),
154155
func_per_type<std::complex<double>>()};
155156
assert(fn_map_by_type.size() == _num_types);
156157
int ty_id = 0;
157-
for (auto &fn : fn_map_by_type) {
158+
for (const auto &fn : fn_map_by_type) {
158159
vector[ty_id] = fn;
159160
++ty_id;
160161
}

dpctl/tensor/libtensor/source/integer_advanced_indexing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ usm_ndarray_take(const dpctl::tensor::usm_ndarray &src,
245245
const py::object &py_ind,
246246
const dpctl::tensor::usm_ndarray &dst,
247247
int axis_start,
248-
uint8_t mode,
248+
std::uint8_t mode,
249249
sycl::queue &exec_q,
250250
const std::vector<sycl::event> &depends)
251251
{
@@ -560,7 +560,7 @@ usm_ndarray_put(const dpctl::tensor::usm_ndarray &dst,
560560
const py::object &py_ind,
561561
const dpctl::tensor::usm_ndarray &val,
562562
int axis_start,
563-
uint8_t mode,
563+
std::uint8_t mode,
564564
sycl::queue &exec_q,
565565
const std::vector<sycl::event> &depends)
566566
{

dpctl/tensor/libtensor/source/integer_advanced_indexing.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ usm_ndarray_take(const dpctl::tensor::usm_ndarray &,
4343
const py::object &,
4444
const dpctl::tensor::usm_ndarray &,
4545
int,
46-
uint8_t,
46+
std::uint8_t,
4747
sycl::queue &,
4848
const std::vector<sycl::event> & = {});
4949

@@ -52,7 +52,7 @@ usm_ndarray_put(const dpctl::tensor::usm_ndarray &,
5252
const py::object &,
5353
const dpctl::tensor::usm_ndarray &,
5454
int,
55-
uint8_t,
55+
std::uint8_t,
5656
sycl::queue &,
5757
const std::vector<sycl::event> & = {});
5858

libsyclinterface/source/dpctl_sycl_queue_interface.cpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
#include "dpctl_sycl_device_interface.h"
3232
#include "dpctl_sycl_device_manager.h"
3333
#include "dpctl_sycl_type_casters.hpp"
34+
35+
#include <stddef.h>
36+
#include <stdint.h>
37+
38+
#include <cstdint>
3439
#include <exception>
3540
#include <sstream>
36-
#include <stddef.h>
3741
#include <stdexcept>
3842
#include <sycl/sycl.hpp> /* SYCL headers */
3943
#include <utility>
@@ -45,49 +49,49 @@ using namespace sycl;
4549
switch ((ARGTY)) { \
4650
case DPCTL_INT8_T: \
4751
{ \
48-
auto la = local_accessor<int8_t, NDIM>(R, CGH); \
52+
auto la = local_accessor<std::int8_t, NDIM>(R, CGH); \
4953
CGH.set_arg(IDX, la); \
5054
return true; \
5155
} \
5256
case DPCTL_UINT8_T: \
5357
{ \
54-
auto la = local_accessor<uint8_t, NDIM>(R, CGH); \
58+
auto la = local_accessor<std::uint8_t, NDIM>(R, CGH); \
5559
CGH.set_arg(IDX, la); \
5660
return true; \
5761
} \
5862
case DPCTL_INT16_T: \
5963
{ \
60-
auto la = local_accessor<int16_t, NDIM>(R, CGH); \
64+
auto la = local_accessor<std::int16_t, NDIM>(R, CGH); \
6165
CGH.set_arg(IDX, la); \
6266
return true; \
6367
} \
6468
case DPCTL_UINT16_T: \
6569
{ \
66-
auto la = local_accessor<uint16_t, NDIM>(R, CGH); \
70+
auto la = local_accessor<std::uint16_t, NDIM>(R, CGH); \
6771
CGH.set_arg(IDX, la); \
6872
return true; \
6973
} \
7074
case DPCTL_INT32_T: \
7175
{ \
72-
auto la = local_accessor<int32_t, NDIM>(R, CGH); \
76+
auto la = local_accessor<std::int32_t, NDIM>(R, CGH); \
7377
CGH.set_arg(IDX, la); \
7478
return true; \
7579
} \
7680
case DPCTL_UINT32_T: \
7781
{ \
78-
auto la = local_accessor<uint32_t, NDIM>(R, CGH); \
82+
auto la = local_accessor<std::uint32_t, NDIM>(R, CGH); \
7983
CGH.set_arg(IDX, la); \
8084
return true; \
8185
} \
8286
case DPCTL_INT64_T: \
8387
{ \
84-
auto la = local_accessor<int64_t, NDIM>(R, CGH); \
88+
auto la = local_accessor<std::int64_t, NDIM>(R, CGH); \
8589
CGH.set_arg(IDX, la); \
8690
return true; \
8791
} \
8892
case DPCTL_UINT64_T: \
8993
{ \
90-
auto la = local_accessor<uint64_t, NDIM>(R, CGH); \
94+
auto la = local_accessor<std::uint64_t, NDIM>(R, CGH); \
9195
CGH.set_arg(IDX, la); \
9296
return true; \
9397
} \
@@ -119,8 +123,8 @@ using namespace dpctl::syclinterface;
119123

120124
typedef struct complex
121125
{
122-
uint64_t real;
123-
uint64_t imag;
126+
std::uint64_t real;
127+
std::uint64_t imag;
124128
} complexNumber;
125129

126130
void set_dependent_events(handler &cgh,
@@ -177,28 +181,28 @@ bool set_kernel_arg(handler &cgh,
177181

178182
switch (ArgTy) {
179183
case DPCTL_INT8_T:
180-
cgh.set_arg(idx, *(int8_t *)Arg);
184+
cgh.set_arg(idx, *(std::int8_t *)Arg);
181185
break;
182186
case DPCTL_UINT8_T:
183-
cgh.set_arg(idx, *(uint8_t *)Arg);
187+
cgh.set_arg(idx, *(std::uint8_t *)Arg);
184188
break;
185189
case DPCTL_INT16_T:
186-
cgh.set_arg(idx, *(int16_t *)Arg);
190+
cgh.set_arg(idx, *(std::int16_t *)Arg);
187191
break;
188192
case DPCTL_UINT16_T:
189-
cgh.set_arg(idx, *(uint16_t *)Arg);
193+
cgh.set_arg(idx, *(std::uint16_t *)Arg);
190194
break;
191195
case DPCTL_INT32_T:
192-
cgh.set_arg(idx, *(int32_t *)Arg);
196+
cgh.set_arg(idx, *(std::int32_t *)Arg);
193197
break;
194198
case DPCTL_UINT32_T:
195-
cgh.set_arg(idx, *(uint32_t *)Arg);
199+
cgh.set_arg(idx, *(std::uint32_t *)Arg);
196200
break;
197201
case DPCTL_INT64_T:
198-
cgh.set_arg(idx, *(int64_t *)Arg);
202+
cgh.set_arg(idx, *(std::int64_t *)Arg);
199203
break;
200204
case DPCTL_UINT64_T:
201-
cgh.set_arg(idx, *(uint64_t *)Arg);
205+
cgh.set_arg(idx, *(std::uint64_t *)Arg);
202206
break;
203207
case DPCTL_FLOAT32_T:
204208
cgh.set_arg(idx, *(float *)Arg);

libsyclinterface/tests/test_sycl_context_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
#include "dpctl_sycl_device_interface.h"
3030
#include "dpctl_sycl_device_selector_interface.h"
3131
#include "dpctl_sycl_types.h"
32-
#include <gtest/gtest.h>
32+
3333
#include <stddef.h>
34+
35+
#include <gtest/gtest.h>
3436
#include <sycl/sycl.hpp>
3537
#include <vector>
3638

libsyclinterface/tests/test_sycl_device_aspects.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
#include "dpctl_sycl_enum_types.h"
3131
#include "dpctl_sycl_type_casters.hpp"
3232
#include "dpctl_utils_helper.h"
33-
#include <gtest/gtest.h>
33+
3434
#include <stddef.h>
35+
36+
#include <gtest/gtest.h>
3537
#include <sycl/sycl.hpp>
3638
#include <utility>
3739

libsyclinterface/tests/test_sycl_device_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
#include "dpctl_sycl_platform_interface.h"
3030
#include "dpctl_utils.h"
3131
#include "dpctl_utils_helper.h"
32-
#include <gtest/gtest.h>
32+
3333
#include <stddef.h>
34+
35+
#include <gtest/gtest.h>
3436
#include <sycl/sycl.hpp>
3537

3638
using namespace sycl;

libsyclinterface/tests/test_sycl_device_manager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
#include "dpctl_sycl_device_selector_interface.h"
3131
#include "dpctl_utils.h"
3232
#include "dpctl_utils_helper.h"
33-
#include <gtest/gtest.h>
33+
3434
#include <stddef.h>
35+
36+
#include <gtest/gtest.h>
3537
#include <string>
3638

3739
using dpctl::syclinterface::dpctl_default_selector;

libsyclinterface/tests/test_sycl_device_subdevices.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
//===--- test_sycl_device_interface.cpp - Test cases for device interface ===//
32
//
43
// Data Parallel Control (dpCtl)
@@ -32,8 +31,10 @@
3231
#include "dpctl_sycl_type_casters.hpp"
3332
#include "dpctl_utils.h"
3433
#include "dpctl_utils_helper.h"
35-
#include <gtest/gtest.h>
34+
3635
#include <stddef.h>
36+
37+
#include <gtest/gtest.h>
3738
#include <sycl/sycl.hpp>
3839

3940
using namespace sycl;

libsyclinterface/tests/test_sycl_kernel_bundle_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@
3333
#include "dpctl_sycl_kernel_bundle_interface.h"
3434
#include "dpctl_sycl_kernel_interface.h"
3535
#include "dpctl_sycl_queue_interface.h"
36+
37+
#include <stddef.h>
38+
3639
#include <array>
3740
#include <filesystem>
3841
#include <fstream>
3942
#include <gtest/gtest.h>
40-
#include <stddef.h>
4143
#include <sycl/sycl.hpp>
4244

4345
using namespace sycl;

libsyclinterface/tests/test_sycl_kernel_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
#include "dpctl_sycl_kernel_interface.h"
3333
#include "dpctl_sycl_queue_interface.h"
3434
#include "dpctl_utils.h"
35+
36+
#include <stddef.h>
37+
3538
#include <array>
3639
#include <gtest/gtest.h>
37-
#include <stddef.h>
3840
#include <sycl/sycl.hpp>
3941

4042
using namespace sycl;

libsyclinterface/tests/test_sycl_queue_interface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
#include "dpctl_sycl_queue_interface.h"
3434
#include "dpctl_sycl_type_casters.hpp"
3535
#include "dpctl_sycl_usm_interface.h"
36-
#include <gtest/gtest.h>
36+
3737
#include <stddef.h>
38+
39+
#include <gtest/gtest.h>
3840
#include <sycl/sycl.hpp>
3941

4042
using namespace sycl;

0 commit comments

Comments
 (0)