[GPU] Treat warnings C4267 as errors for Windows (#16345)

This commit is contained in:
Sergey Shlyapnikov
2023-03-28 22:56:47 +00:00
committed by GitHub
parent b82bedd648
commit 6c766a81b5
5 changed files with 11 additions and 7 deletions
-1
View File
@@ -15,7 +15,6 @@ endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# 4267 4244 conversion from 'XXX' to 'YYY', possible loss of data
ie_add_compiler_flags(/wd4244)
ie_add_compiler_flags(/wd4267)
# '<': signed/unsigned mismatch
ie_add_compiler_flags(/wd4018)
endif()
@@ -294,7 +294,7 @@ protected:
if (is_cpu())
return;
size_t total_kernels_num = std::accumulate(kernels.begin(), kernels.end(), 0,
size_t total_kernels_num = std::accumulate(kernels.begin(), kernels.end(), static_cast<size_t>(0),
[](size_t val, cldnn::kernels_cache::compiled_kernels::value_type& p) {
return (val + p.second.size());
});
@@ -132,7 +132,7 @@ static std::string GetInputBlockND(const scatter_nd_update_params& params, size_
block_nd_s[rank] = "1";
size_t input_offset = dyn_offset * 6;
for (int32_t idx = rank - 1; idx >= 0; --idx) {
for (int32_t idx = static_cast<int32_t>(rank) - 1; idx >= 0; --idx) {
block_nd[idx] = input_dims[idx] * block_nd[idx + 1];
size_t dim_offset = idx < 2 ? idx : (6 - dims.size()) + idx; // convert to 6d bfwzyx idx
@@ -61,7 +61,7 @@ void CreateGatherOpBase(Program& p, const std::shared_ptr<T>& op, const int64_t
new_axis += op->get_input_shape(0).size();
}
out_shape.push_back(1);
for (int i = out_shape.size() - 1; i > new_axis ; i--) {
for (int i = static_cast<int>(out_shape.size()) - 1; i > new_axis ; i--) {
out_shape[i] = out_shape[i-1];
}
out_shape[new_axis] = 1;
@@ -4484,7 +4484,7 @@ TEST(scatter_nd_update_gpu, dynamic_5d) {
ov::Shape input_shape,
ov::Shape indices_shape,
ov::Shape updates_shape) -> std::vector<float> {
size_t count = std::accumulate(input_shape.begin(), input_shape.end(), 1, std::multiplies<size_t>());
size_t count = std::accumulate(input_shape.begin(), input_shape.end(), static_cast<size_t>(1), std::multiplies<size_t>());
auto outputs_ref = std::vector<float>(count);
ngraph::runtime::reference::scatterNdUpdate<float, int32_t>(input.data(),
indices.data(),
@@ -4503,12 +4503,17 @@ TEST(scatter_nd_update_gpu, dynamic_5d) {
std::vector<int32_t> result;
size_t last_indices_dim = indices_shape.at(indices_shape.size() - 1);
size_t count = std::accumulate(indices_shape.begin(), indices_shape.end(), 1, std::multiplies<size_t>()) / last_indices_dim;
size_t count = std::accumulate(indices_shape.begin(),
indices_shape.end(),
static_cast<size_t>(1),
std::multiplies<size_t>()) / last_indices_dim;
while (unique_indices.size() != count) {
std::vector<int32_t> indices;
for (size_t i = 0; i < last_indices_dim; i++) {
indices.push_back(static_cast<int32_t>(generate_random_val<int>(0, data_shape[i] - 1)));
const int min = 0;
const int max = static_cast<int>(data_shape[i]) - 1;
indices.push_back(static_cast<int32_t>(generate_random_val<int>(min, max)));
}
unique_indices.insert(indices);