Skip to content

Commit 01d1c5d

Browse files
addressed compiler warnings
1 parent c8a5343 commit 01d1c5d

File tree

8 files changed

+35
-33
lines changed

8 files changed

+35
-33
lines changed

dpnp/backend/kernels/dpnp_krnl_arraycreation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ DPCTLSyclEventRef dpnp_diag_c(DPCTLSyclQueueRef q_ref,
133133

134134
if (ndim == 1)
135135
{
136-
for (size_t i = 0; i < shape[0]; ++i)
136+
for (size_t i = 0; i < static_cast<size_t>(shape[0]); ++i)
137137
{
138138
size_t ind = (init0 + i) * res_shape[1] + init1 + i;
139139
result[ind] = v[i];
140140
}
141141
}
142142
else
143143
{
144-
for (size_t i = 0; i < res_shape[0]; ++i)
144+
for (size_t i = 0; i < static_cast<size_t>(res_shape[0]); ++i)
145145
{
146146
size_t ind = (init0 + i) * shape[1] + init1 + i;
147147
result[i] = v[ind];

dpnp/backend/kernels/dpnp_krnl_fft.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void dpnp_fft_fft_mathlib_cmplx_to_cmplx_c(DPCTLSyclQueueRef q_ref,
175175
const void* array1_in,
176176
void* result_out,
177177
const shape_elem_type* input_shape,
178-
const shape_elem_type* result_shape,
178+
const shape_elem_type*,
179179
const size_t shape_size,
180180
const size_t input_size,
181181
const size_t result_size,
@@ -504,8 +504,8 @@ DPCTLSyclEventRef dpnp_fft_rfft_c(DPCTLSyclQueueRef q_ref,
504504
const shape_elem_type* input_shape,
505505
const shape_elem_type* result_shape,
506506
size_t shape_size,
507-
long axis,
508-
long input_boundarie,
507+
long, // axis
508+
long, // input_boundary
509509
size_t inverse,
510510
const size_t norm,
511511
const DPCTLEventVectorRef dep_event_vec_ref)

dpnp/backend/kernels/dpnp_krnl_indexing.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ DPCTLSyclEventRef dpnp_diagonal_c(DPCTLSyclQueueRef q_ref,
184184

185185
if (res_ndim <= 1)
186186
{
187-
for (size_t i = 0; i < res_shape[res_ndim - 1]; ++i)
187+
for (size_t i = 0; i < static_cast<size_t>(res_shape[res_ndim - 1]); ++i)
188188
{
189189
result[i] = array_1[i * shape[res_ndim] + i + offset];
190190
}
191191
}
192192
else
193193
{
194194
std::map<size_t, std::vector<size_t>> xyz;
195-
for (size_t i = 0; i < res_shape[0]; i++)
195+
for (size_t i = 0; i < static_cast<size_t>(res_shape[0]); i++)
196196
{
197197
xyz[i] = {i};
198198
}
@@ -227,7 +227,7 @@ DPCTLSyclEventRef dpnp_diagonal_c(DPCTLSyclQueueRef q_ref,
227227
index += 1;
228228
}
229229

230-
for (size_t i = 0; i < res_shape[res_ndim - 1]; i++)
230+
for (size_t i = 0; i < static_cast<size_t>(res_shape[res_ndim - 1]); i++)
231231
{
232232
for (size_t j = 0; j < xyz.size(); j++)
233233
{
@@ -347,7 +347,7 @@ DPCTLSyclEventRef dpnp_fill_diagonal_c(DPCTLSyclQueueRef q_ref,
347347
_DataType* array_1 = result_ptr.get_ptr();
348348
_DataType* val_arr = val_ptr.get_ptr();
349349

350-
size_t min_shape = shape[0];
350+
shape_elem_type min_shape = shape[0];
351351
for (size_t i = 0; i < ndim; ++i)
352352
{
353353
if (shape[i] < min_shape)
@@ -358,7 +358,7 @@ DPCTLSyclEventRef dpnp_fill_diagonal_c(DPCTLSyclQueueRef q_ref,
358358

359359
_DataType val = val_arr[0];
360360

361-
for (size_t i = 0; i < min_shape; ++i)
361+
for (size_t i = 0; i < static_cast<size_t>(min_shape); ++i)
362362
{
363363
size_t ind = 0;
364364
size_t n = 1;
@@ -765,11 +765,12 @@ DPCTLSyclEventRef dpnp_put_along_axis_c(DPCTLSyclQueueRef q_ref,
765765
}
766766
}
767767

768-
size_t source_idx = 0;
769-
for (size_t i = 0; i < ndim; ++i)
770-
{
771-
source_idx += arr_shape_offsets[i] * source_axis[i];
772-
}
768+
// FIXME: computed, but unused. Commented out per compiler warning
769+
// size_t source_idx = 0;
770+
// for (size_t i = 0; i < static_cast<size_t>(ndim); ++i)
771+
// {
772+
// source_idx += arr_shape_offsets[i] * source_axis[i];
773+
// }
773774
}
774775

775776
for (size_t source_idx = 0; source_idx < size_arr; ++source_idx)
@@ -899,7 +900,7 @@ DPCTLSyclEventRef dpnp_take_c(DPCTLSyclQueueRef q_ref,
899900

900901
DPCTLSyclEventRef event_ref = nullptr;
901902
sycl::queue q = *(reinterpret_cast<sycl::queue*>(q_ref));
902-
903+
903904
DPNPC_ptr_adapter<_DataType> input1_ptr(q_ref, array1_in, array1_size, true);
904905
DPNPC_ptr_adapter<_IndecesType> input2_ptr(q_ref, indices1, size);
905906
_DataType* array_1 = input1_ptr.get_ptr();

dpnp/backend/kernels/dpnp_krnl_linalg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ DPCTLSyclEventRef dpnp_det_c(DPCTLSyclQueueRef q_ref,
228228
{
229229
for (size_t j = l + 1; j < n; j++)
230230
{
231-
_DataType q = -(matrix[j][l] / matrix[l][l]);
231+
_DataType quotient = -(matrix[j][l] / matrix[l][l]);
232232
for (size_t k = l + 1; k < n; k++)
233233
{
234-
matrix[j][k] += q * matrix[l][k];
234+
matrix[j][k] += quotient * matrix[l][k];
235235
}
236236
}
237237
}
@@ -576,7 +576,7 @@ DPCTLSyclEventRef dpnp_matrix_rank_c(DPCTLSyclQueueRef q_ref,
576576
_DataType* array_1 = input1_ptr.get_ptr();
577577
_DataType* result = result_ptr.get_ptr();
578578

579-
size_t elems = 1;
579+
shape_elem_type elems = 1;
580580
if (ndim > 1)
581581
{
582582
elems = shape[0];
@@ -590,7 +590,7 @@ DPCTLSyclEventRef dpnp_matrix_rank_c(DPCTLSyclQueueRef q_ref,
590590
}
591591

592592
_DataType acc = 0;
593-
for (size_t i = 0; i < elems; i++)
593+
for (size_t i = 0; i < static_cast<size_t>(elems); i++)
594594
{
595595
size_t ind = 0;
596596
for (size_t j = 0; j < ndim; j++)

dpnp/backend/kernels/dpnp_krnl_sorting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ DPCTLSyclEventRef dpnp_partition_c(DPCTLSyclQueueRef q_ref,
201201

202202
_DataType val = arr2[j * shape[ndim - 1] + k];
203203

204-
for (size_t i = 0; i < shape[ndim - 1]; ++i)
204+
for (size_t i = 0; i < static_cast<size_t>(shape[ndim - 1]); ++i)
205205
{
206206
if (result[j * shape[ndim - 1] + i] == val)
207207
{

dpnp/backend/kernels/dpnp_krnl_statistics.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ DPCTLSyclEventRef dpnp_cov_c(DPCTLSyclQueueRef q_ref,
156156
}
157157

158158
sycl::queue q = *(reinterpret_cast<sycl::queue*>(q_ref));
159-
159+
160160
DPNPC_ptr_adapter<_DataType> input1_ptr(q_ref, array1_in, nrows * ncols);
161161
_DataType* array_1 = input1_ptr.get_ptr();
162162
_DataType* result = reinterpret_cast<_DataType*>(result1);
@@ -379,12 +379,12 @@ DPCTLSyclEventRef dpnp_max_c(DPCTLSyclQueueRef q_ref,
379379
size_t res_ndim = ndim - naxis;
380380
size_t res_shape[res_ndim];
381381
int ind = 0;
382-
for (size_t i = 0; i < ndim; i++)
382+
for (size_t i = 0; i < ndim; ++i)
383383
{
384384
bool found = false;
385-
for (size_t j = 0; j < naxis; j++)
385+
for (size_t j = 0; j < naxis; ++j)
386386
{
387-
if (axis[j] == i)
387+
if (static_cast<size_t>(axis[j]) == i)
388388
{
389389
found = true;
390390
break;
@@ -442,7 +442,7 @@ DPCTLSyclEventRef dpnp_max_c(DPCTLSyclQueueRef q_ref,
442442
bool found = false;
443443
for (size_t i = 0; i < naxis; ++i)
444444
{
445-
if (axis[i] == idx)
445+
if (static_cast<size_t>(axis[i]) == idx)
446446
{
447447
found = true;
448448
break;
@@ -488,7 +488,7 @@ DPCTLSyclEventRef dpnp_max_c(DPCTLSyclQueueRef q_ref,
488488
bool found = false;
489489
for (size_t i = 0; i < naxis; ++i)
490490
{
491-
if (axis[i] == idx)
491+
if (static_cast<size_t>(axis[i]) == idx)
492492
{
493493
found = true;
494494
break;
@@ -808,7 +808,7 @@ DPCTLSyclEventRef dpnp_min_c(DPCTLSyclQueueRef q_ref,
808808
bool found = false;
809809
for (size_t j = 0; j < naxis; j++)
810810
{
811-
if (axis[j] == i)
811+
if (static_cast<size_t>(axis[j]) == i)
812812
{
813813
found = true;
814814
break;
@@ -866,7 +866,7 @@ DPCTLSyclEventRef dpnp_min_c(DPCTLSyclQueueRef q_ref,
866866
bool found = false;
867867
for (size_t i = 0; i < naxis; ++i)
868868
{
869-
if (axis[i] == idx)
869+
if (static_cast<size_t>(axis[i]) == idx)
870870
{
871871
found = true;
872872
break;
@@ -912,7 +912,7 @@ DPCTLSyclEventRef dpnp_min_c(DPCTLSyclQueueRef q_ref,
912912
bool found = false;
913913
for (size_t i = 0; i < naxis; ++i)
914914
{
915-
if (axis[i] == idx)
915+
if (static_cast<size_t>(axis[i]) == idx)
916916
{
917917
found = true;
918918
break;

dpnp/backend/src/dpnp_iterator.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class DPNP_USM_iterator final
159159
if (iteration_shape_size > 0)
160160
{
161161
long reminder = iteration_id;
162-
for (size_t it = 0; it < iteration_shape_size; ++it)
162+
for (size_t it = 0; it < static_cast<size_t>(iteration_shape_size); ++it)
163163
{
164164
const size_type axis_val = iteration_shape_strides[it];
165165
size_type xyz_id = reminder / axis_val;
@@ -436,7 +436,7 @@ class DPNPC_id final
436436

437437
axes_shape_strides = reinterpret_cast<size_type*>(dpnp_memory_alloc_c(queue_ref,
438438
iteration_shape_size_in_bytes));
439-
for (size_t i = 0; i < iteration_shape_size; ++i)
439+
for (size_t i = 0; i < static_cast<size_t>(iteration_shape_size); ++i)
440440
{
441441
axes_shape_strides[i] = input_shape_strides[axes[i]];
442442
}
@@ -558,7 +558,7 @@ class DPNPC_id final
558558
{
559559
assert(output_global_id < output_size);
560560

561-
for (size_t iit = 0, oit = 0; iit < input_shape_size; ++iit)
561+
for (size_t iit = 0, oit = 0; iit < static_cast<size_t>(input_shape_size); ++iit)
562562
{
563563
if (std::find(axes.begin(), axes.end(), iit) == axes.end())
564564
{

dpnp/backend/src/dpnp_utils.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ static inline bool
240240
*/
241241
namespace
242242
{
243+
[[maybe_unused]]
243244
std::vector<sycl::event> cast_event_vector(const DPCTLEventVectorRef event_vec_ref)
244245
{
245246
const size_t event_vec_size = DPCTLEventVector_Size(event_vec_ref);

0 commit comments

Comments
 (0)