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

[GPU] Fix warnings #16196

Merged
merged 12 commits into from
Mar 16, 2023
Merged
8 changes: 4 additions & 4 deletions src/inference/dev_api/performance_heuristics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static MemBandwidthPressure MemBandwidthPressureTolerance(
const float memThresholdAssumeLimited = MemBandwidthPressure::LIMITED) {
int total_convs = 0, mem_limited_convs = 0, compute_convs = 0, total_gemms = 0, mem_limited_gemms = 0,
total_deconvs = 0, compute_deconvs = 0, mem_limited_deconvs = 0;
auto memLimitedFactor = [&](int size_data_moved, int datatype_size = 4) -> float {
auto memLimitedFactor = [&](size_t size_data_moved, int datatype_size = 4) -> float {
return (cache_size / (size_data_moved * datatype_size));
};
auto isLowPrecision = [&](ngraph::element::Type type) -> bool {
Expand Down Expand Up @@ -57,7 +57,7 @@ static MemBandwidthPressure MemBandwidthPressureTolerance(
const bool isBF16orFP16 = isHalfPrecision(type1);
const int data_type_size = isINT8 ? 1 : isBF16orFP16 ? 2 : 4;

int dataSizeInput = 0, dataSizeOutput = 0;
size_t dataSizeInput = 0, dataSizeOutput = 0;
if (!std::strcmp("MatMul", node_name)) {
const auto input0 = node->input(0);
const auto input1 = node->input(1);
Expand Down Expand Up @@ -103,7 +103,7 @@ static MemBandwidthPressure MemBandwidthPressureTolerance(
std::accumulate(shapeInput.begin(), shapeInput.end(), size_t(1), std::multiplies<size_t>());
dataSizeOutput =
std::accumulate(shapeOutput.begin(), shapeOutput.end(), size_t(1), std::multiplies<size_t>());
const auto factor = memLimitedFactor(dataSizeInput + dataSizeOutput, data_type_size);
const auto factor = memLimitedFactor(static_cast<int>(dataSizeInput + dataSizeOutput), data_type_size);
mem_limited_convs += factor < memThresholdAssumeLimited;
worst_case = std::min(factor, worst_case);
}
Expand All @@ -124,7 +124,7 @@ static MemBandwidthPressure MemBandwidthPressureTolerance(
std::accumulate(shapeInput.begin(), shapeInput.end(), size_t(1), std::multiplies<size_t>());
dataSizeOutput =
std::accumulate(shapeOutput.begin(), shapeOutput.end(), size_t(1), std::multiplies<size_t>());
const auto factor = memLimitedFactor(dataSizeInput + dataSizeOutput, data_type_size);
const auto factor = memLimitedFactor(static_cast<int>(dataSizeInput + dataSizeOutput), data_type_size);
mem_limited_deconvs += factor < memThresholdAssumeLimited;
worst_case = std::min(factor, worst_case);
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/include/intel_gpu/plugin/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Graph {
cldnn::engine& get_engine() const { return m_context->get_engine(); }
const ExecutionConfig& get_config() const { return m_config; }

int GetMaxDynamicBatchSize() const { return m_config.get_property(ov::intel_gpu::max_dynamic_batch); }
size_t GetMaxDynamicBatchSize() const { return m_config.get_property(ov::intel_gpu::max_dynamic_batch);}
const std::map<std::string, cldnn::layout>& GetInputLayouts() const { return m_program->GetInputLayouts(); }
const InferenceEngine::InputsDataMap GetNetworkInputs() const { return m_program->GetNetworkInputs(); }
const InferenceEngine::OutputsDataMap GetNetworkOutputs() const { return m_program->GetNetworkOutputs(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ struct arg_max_min : public primitive_base<arg_max_min> {
values_first == rhs_casted.values_first;
}

uint32_t get_output_nums() const { return (input_size() == 3 ? 2 : output_size()); }
size_t get_output_nums() const {
return (input_size() == 3 ? 2 : output_size());
}
bool has_second_output() const { return get_output_nums() == 2; }
bool use_multiple_outputs() const { return input_size() != 3; }

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ std::vector<layout> broadcast_inst::calc_output_layouts(broadcast_node const& /*
if (input1.is_static()) {
output_rank = input1.get_dim(0); // target shape rank is set as second input.
}
output_shapes[0] = ShapeType::dynamic(std::max(output_rank, static_cast<int>(1)));
output_shapes[0] = ShapeType::dynamic(std::max(output_rank, 1));
}

format output_format = format::adjust_to_rank(input0_layout.format, output_shapes[0].size());
Expand Down
24 changes: 12 additions & 12 deletions src/plugins/intel_gpu/src/graph/convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ layout convolution_inst::calc_output_layout(convolution_node const& node, kernel
output_type = data_types::f32;
}

uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;
auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;

uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
auto dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
auto dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
auto dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;

// TODO: Consider moving general parameter verification to arguments constructor.
CLDNN_ERROR_LESS_OR_EQUAL_THAN(desc->id,
Expand Down Expand Up @@ -249,13 +249,13 @@ std::vector<layout> convolution_inst::calc_output_layouts(convolution_node const
output_type = data_types::f32;
}

uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;
auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;

uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
auto dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
auto dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
auto dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;

// TODO: Consider moving general parameter verification to arguments constructor.
CLDNN_ERROR_LESS_OR_EQUAL_THAN(desc->id,
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/intel_gpu/src/graph/deconvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,17 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node, ke
3,
"As for now, deconvolutions with more than 3 dimensions are not supported");

int32_t x = off_factor * pad[pad.size() - 1] + (input_layout.spatial(0) - 1) * strd[strd.size() - 1] + weights_layout.spatial(0);
int32_t x = static_cast<int32_t>(
off_factor * pad[pad.size() - 1] + (input_layout.spatial(0) - 1) * strd[strd.size() - 1] + weights_layout.spatial(0));
int32_t y = 1;
if (spatial_dims > 1) {
y = off_factor * pad[pad.size() - 2] + (input_layout.spatial(1) - 1) * strd[strd.size() - 2] + weights_layout.spatial(1);
y = static_cast<int32_t>(
off_factor * pad[pad.size() - 2] + (input_layout.spatial(1) - 1) * strd[strd.size() - 2] + weights_layout.spatial(1));
}
int32_t z = 1;
if (spatial_dims > 2) {
z = off_factor * pad[pad.size() - 3] + (input_layout.spatial(2) - 1) * strd[strd.size() - 3] + weights_layout.spatial(2);
z = static_cast<int32_t>(
off_factor * pad[pad.size() - 3] + (input_layout.spatial(2) - 1) * strd[strd.size() - 3] + weights_layout.spatial(2));
}

tensor output_size(input_layout.batch(),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/fully_connected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ layout fully_connected_inst::calc_output_layout(fully_connected_node const& node

auto reshape_to_2d = [](const ov::PartialShape& shape, int64_t feature) {
auto staticShape = shape.to_shape();
size_t total = std::accumulate(staticShape.begin(), staticShape.end(), 1, std::multiplies<size_t>());
size_t total = std::accumulate(staticShape.begin(), staticShape.end(), static_cast<size_t>(1), std::multiplies<size_t>());
std::vector<int64_t> reshapeSize = { static_cast<int64_t>(total) / feature, feature };
return reshapeSize;
};
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/intel_gpu/src/graph/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ layout gather_inst::calc_output_layout(gather_node const& node, kernel_impl_para
auto desc = impl_param.typed_desc<gather>();

auto input_layout = impl_param.get_input_layout();
std::vector<tensor::value_type> dims_converted(desc->output_shape.begin(), desc->output_shape.end());
std::vector<tensor::value_type> dims_converted;
for (auto dim : desc->output_shape) {
dims_converted.push_back(static_cast<tensor::value_type>(dim));
}
// extend shape to 4d
for (size_t i = dims_converted.size(); i < 4; i++)
dims_converted.push_back(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void pre_replace_deconv::run(program& p) {
p.rename(deconv_node, rename_id);

// reshape weights
int pixel_shuffle_size = scale_factor * scale_factor;
auto pixel_shuffle_size = static_cast<tensor::value_type>(scale_factor * scale_factor);
sshlyapn marked this conversation as resolved.
Show resolved Hide resolved
int kernel_size = 5;
tensor target_weights_size = { pixel_shuffle_size, filter_layout.feature(), kernel_size, kernel_size };
auto target_weights_layout = layout{ weights_layout.data_type, weights_layout.format, target_weights_size };
Expand All @@ -252,7 +252,7 @@ void pre_replace_deconv::run(program& p) {
static_cast<int>(filter_layout.feature()),
static_cast<int>(filter_layout.spatial(0)),
static_cast<int>(filter_layout.spatial(1)),
scale_factor,
static_cast<int>(scale_factor),
subpixel_weights);

if (weights_data_type == data_types::f16) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void prepare_padding::run(program& p) {
// WA for this format. sliding window needs to be fixed --perf degradation for IncepctionV1 type models
tensor size(1);
for (size_t i = 0; i < prim->size.size(); i++) {
size.spatial[i] = prim->size[prim->size.size() - i - 1];
size.spatial[i] = static_cast<tensor::value_type>(prim->size[prim->size.size() - i - 1]);
}

if (node->get_output_layout().format == format::b_fs_yx_fsv16)
Expand Down Expand Up @@ -183,13 +183,13 @@ void prepare_padding::run(program& p) {
auto pad = conv->pad;
auto stride = conv->stride;
auto dilation = conv->dilation;
uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;
uint32_t stride_z = stride.size() >= 3 ? static_cast<uint32_t>(stride[stride.size() - 3]) : 1;
uint32_t stride_y = stride.size() >= 2 ? static_cast<uint32_t>(stride[stride.size() - 2]) : 1;
uint32_t stride_x = stride.size() >= 1 ? static_cast<uint32_t>(stride[stride.size() - 1]) : 1;

uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
uint32_t dilation_z = dilation.size() >= 3 ? static_cast<uint32_t>(dilation[dilation.size() - 3]) : 1;
uint32_t dilation_y = dilation.size() >= 2 ? static_cast<uint32_t>(dilation[dilation.size() - 2]) : 1;
uint32_t dilation_x = dilation.size() >= 1 ? static_cast<uint32_t>(dilation[dilation.size() - 1]) : 1;

tensor::value_type pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0;
tensor::value_type pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0;
Expand Down Expand Up @@ -277,9 +277,15 @@ void prepare_padding::run(program& p) {
auto padding_begin_x = std::max<tensor::value_type>(pad_x, 0);
auto padding_begin_y = std::max<tensor::value_type>(pad_y, 0);
auto padding_begin_z = std::max<tensor::value_type>(pad_z, 0);
auto padding_end_x = std::max<tensor::value_type>(input_limit_x - prev_prim_output_layout.spatial(0), 0);
auto padding_end_y = std::max<tensor::value_type>(input_limit_y - prev_prim_output_layout.spatial(1), 0);
auto padding_end_z = std::max<tensor::value_type>(input_limit_z - prev_prim_output_layout.spatial(2), 0);
auto padding_end_x = std::max<tensor::value_type>(
static_cast<tensor::value_type>(input_limit_x) - prev_prim_output_layout.spatial(0),
0);
auto padding_end_y = std::max<tensor::value_type>(
static_cast<tensor::value_type>(input_limit_y) - prev_prim_output_layout.spatial(1),
0);
auto padding_end_z = std::max<tensor::value_type>(
static_cast<tensor::value_type>(input_limit_z) - prev_prim_output_layout.spatial(2),
0);

cldnn::padding needed_padding({0, 0, padding_begin_x, padding_begin_y, padding_begin_z}, {0, 0, padding_end_x, padding_end_y, padding_end_z}, 0);
needed_padding = padding::max(prev_prim_output_layout.data_padding, needed_padding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void prepare_primitive_fusing::fuse_bias(program &p) {
for (size_t i = 0; i < const_shape.size(); ++i) {
if (const_shape[i] != 1) {
count_elements_not_one++;
idx_element_not_one = i;
idx_element_not_one = static_cast<int32_t>(i);
sshlyapn marked this conversation as resolved.
Show resolved Hide resolved
}
if (count_elements_not_one > 1)
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct arg_max_min_impl : typed_primitive_impl_ocl<arg_max_min> {
const auto& mode = primitive->mode;
const auto& sort_type = primitive->sort;
const auto& values_first = primitive->values_first;
const auto& outputs_num = (primitive->input_size() == 3 ? 2 : primitive->output_size());
const auto& outputs_num = primitive->input_size() == 3 ? 2 : primitive->output_size();

auto argm_params = get_default_params<kernel_selector::arg_max_min_params>(impl_param);
auto argm_optional_params =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ struct binary_convolution_impl : typed_primitive_impl_ocl<binary_convolution> {
uint32_t pad_x = std::max<std::ptrdiff_t>(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0);
params.padding = {pad_x, pad_y, pad_z};

uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;
uint32_t stride_z = stride.size() >= 3 ? static_cast<uint32_t>(stride[stride.size() - 3]) : 1;
uint32_t stride_y = stride.size() >= 2 ? static_cast<uint32_t>(stride[stride.size() - 2]) : 1;
uint32_t stride_x = stride.size() >= 1 ? static_cast<uint32_t>(stride[stride.size() - 1]) : 1;
params.stride = {stride_x, stride_y, stride_z};

uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
uint32_t dilation_z = dilation.size() >= 3 ? static_cast<uint32_t>(dilation[dilation.size() - 3]) : 1;
uint32_t dilation_y = dilation.size() >= 2 ? static_cast<uint32_t>(dilation[dilation.size() - 2]) : 1;
uint32_t dilation_x = dilation.size() >= 1 ? static_cast<uint32_t>(dilation[dilation.size() - 1]) : 1;
params.dilation = {dilation_x, dilation_y, dilation_z};

return {params, optional_params};
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_gpu/src/graph/impls/ocl/concatenation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace ocl {

namespace {
kernel_selector::concat_axis convert_axis(int64_t axis, size_t rank) {
unsigned cldnn_axis = axis >= 0 ? axis : axis + static_cast<int64_t>(rank);
if (cldnn_axis >= rank)
auto cldnn_axis = axis >= 0 ? axis : axis + static_cast<int64_t>(rank);
if (cldnn_axis >= static_cast<int64_t>(rank))
IE_THROW() << "Concatenation axis exceeds number of dimensions";

// Difference in dimension ordering between IE and GPU plugin,
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ struct convolution_impl : typed_primitive_impl_ocl<convolution> {
uint32_t pad_x = std::max<std::ptrdiff_t>(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0);
conv_params.padding = {pad_x, pad_y, pad_z};

uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1;
uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1;
uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1;
uint32_t stride_z = stride.size() >= 3 ? static_cast<uint32_t>(stride[stride.size() - 3]) : 1;
uint32_t stride_y = stride.size() >= 2 ? static_cast<uint32_t>(stride[stride.size() - 2]) : 1;
uint32_t stride_x = stride.size() >= 1 ? static_cast<uint32_t>(stride[stride.size() - 1]) : 1;
conv_params.stride = {stride_x, stride_y, stride_z};

uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
uint32_t dilation_z = dilation.size() >= 3 ? static_cast<uint32_t>(dilation[dilation.size() - 3]) : 1;
uint32_t dilation_y = dilation.size() >= 2 ? static_cast<uint32_t>(dilation[dilation.size() - 2]) : 1;
uint32_t dilation_x = dilation.size() >= 1 ? static_cast<uint32_t>(dilation[dilation.size() - 1]) : 1;
conv_params.dilation = {dilation_x, dilation_y, dilation_z};

if ((impl_param.input_layouts[0].data_type == data_types::u8 ||
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/ocl/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct crop_impl : typed_primitive_impl_ocl<crop> {
auto runtime_offset = convert_data_tensor(impl_param.get_input_layout(), impl_param.input_offsets[0]).GetFirstElementOffset();
kernel_selector::ScalarDescriptor s;
s.t = kernel_selector::ScalarDescriptor::Types::UINT32;
s.v.u32 = runtime_offset;
s.v.u32 = static_cast<uint32_t>(runtime_offset);
OPENVINO_ASSERT(_kernel_data.kernels[0].params.scalars.size() == 1,
"[GPU] Scalar field for runtime offset is not added for crop shape agnostic impl");
_kernel_data.kernels[0].params.scalars[0] = s;
Expand Down
Loading