[GPU] Coverity fixes (#17241)
This commit is contained in:
@@ -50,7 +50,7 @@ private:
|
||||
memory::ptr _result;
|
||||
stream::ptr _stream;
|
||||
layout _layout;
|
||||
network_output(event::ptr evt, memory::ptr mem, stream::ptr stream, layout layout) : _event(evt), _result(mem), _stream(stream), _layout(layout) {}
|
||||
network_output(event::ptr evt, memory::ptr mem, stream::ptr stream, const layout& layout) : _event(evt), _result(mem), _stream(stream), _layout(layout) {}
|
||||
friend struct network;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
const std::shared_ptr<InferenceEngine::IAllocator> &getAllocator() const noexcept;
|
||||
void *getHandle() const noexcept { return _handle; }
|
||||
|
||||
void reinterpret(cldnn::layout new_layout);
|
||||
void reinterpret(const cldnn::layout& new_layout);
|
||||
|
||||
bool is_allocated() const noexcept;
|
||||
bool is_locked() const noexcept;
|
||||
|
||||
@@ -75,7 +75,8 @@ struct activation_additional_params {
|
||||
struct activation : public primitive_base<activation> {
|
||||
CLDNN_DECLARE_PRIMITIVE(activation)
|
||||
|
||||
activation() : primitive_base("", {}) {}
|
||||
activation() : primitive_base("", {}),
|
||||
activation_function(activation_func::none) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -22,7 +22,12 @@ namespace cldnn {
|
||||
struct arg_max_min : public primitive_base<arg_max_min> {
|
||||
CLDNN_DECLARE_PRIMITIVE(arg_max_min)
|
||||
|
||||
arg_max_min() : primitive_base("", {}) {}
|
||||
arg_max_min() : primitive_base("", {}),
|
||||
mode(ov::op::TopKMode::MAX),
|
||||
top_k(0),
|
||||
axis(0),
|
||||
sort(ov::op::TopKSortType::NONE),
|
||||
values_first(false) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace cldnn {
|
||||
struct loop : public primitive_base<loop> {
|
||||
CLDNN_DECLARE_PRIMITIVE(loop)
|
||||
|
||||
loop() : primitive_base("", {}) {}
|
||||
loop() : primitive_base("", {}),
|
||||
max_iteration(0) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
@@ -67,16 +68,15 @@ struct loop : public primitive_base<loop> {
|
||||
/// @param start Index where the iteration starts from. Applies only when axis >=0.
|
||||
/// @param end Index where iteration ends. Negative value means counting indexes from the end. Applies only when axis >=0.
|
||||
/// @param stride Step of iteration. Negative value means backward iteration. Applies only when axis >=0.
|
||||
io_primitive_map(primitive_id external_id, primitive_id internal_id,
|
||||
io_primitive_map(primitive_id external_id = "", primitive_id internal_id = "",
|
||||
int64_t axis = -1, int64_t start = 0, int64_t end = -1, int64_t stride = 1) :
|
||||
external_id(external_id),
|
||||
internal_id(internal_id),
|
||||
axis(axis),
|
||||
start(start),
|
||||
end(end),
|
||||
stride(stride)
|
||||
{}
|
||||
io_primitive_map() {}
|
||||
stride(stride) {}
|
||||
|
||||
primitive_id external_id;
|
||||
primitive_id internal_id;
|
||||
int64_t axis;
|
||||
|
||||
@@ -191,7 +191,8 @@ protected:
|
||||
struct lstm_gemm : public primitive_base<lstm_gemm> {
|
||||
CLDNN_DECLARE_PRIMITIVE(lstm_gemm)
|
||||
|
||||
lstm_gemm() : primitive_base("", {}) {}
|
||||
lstm_gemm() : primitive_base("", {}),
|
||||
direction(0) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ namespace cldnn {
|
||||
struct non_max_suppression : public primitive_base<non_max_suppression> {
|
||||
CLDNN_DECLARE_PRIMITIVE(non_max_suppression)
|
||||
|
||||
non_max_suppression() : primitive_base("", {}) {}
|
||||
non_max_suppression() : primitive_base("", {}),
|
||||
selected_indices_num(0),
|
||||
center_point_box(false),
|
||||
sort_result_descending(false) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -17,7 +17,25 @@ namespace cldnn {
|
||||
struct proposal : public primitive_base<proposal> {
|
||||
CLDNN_DECLARE_PRIMITIVE(proposal)
|
||||
|
||||
proposal() : primitive_base("", {}) {}
|
||||
proposal() : primitive_base("", {}),
|
||||
max_proposals(0),
|
||||
iou_threshold(0.0f),
|
||||
base_bbox_size(16),
|
||||
min_bbox_size(0),
|
||||
feature_stride(0),
|
||||
pre_nms_topn(0),
|
||||
post_nms_topn(0),
|
||||
coordinates_offset(1.0f),
|
||||
box_coordinate_scale(1.0f),
|
||||
box_size_scale(1.0f),
|
||||
for_deformable(false),
|
||||
swap_xy(false),
|
||||
initial_clip(false),
|
||||
clip_before_nms(true),
|
||||
clip_after_nms(false),
|
||||
round_ratios(true),
|
||||
shift_anchors(false),
|
||||
normalize(false) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ enum class reorder_mean_mode {
|
||||
struct reorder : public primitive_base<reorder> {
|
||||
CLDNN_DECLARE_PRIMITIVE(reorder)
|
||||
|
||||
reorder() : primitive_base("", {}), output_format(format::any) {}
|
||||
reorder() : primitive_base("", {}),
|
||||
output_format(format::any),
|
||||
mean_mode(reorder_mean_mode::subtract) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -13,7 +13,19 @@ namespace cldnn {
|
||||
struct roi_pooling : public primitive_base<roi_pooling> {
|
||||
CLDNN_DECLARE_PRIMITIVE(roi_pooling)
|
||||
|
||||
roi_pooling() : primitive_base("", {}) {}
|
||||
roi_pooling() : primitive_base("", {}),
|
||||
mode(pooling_mode::max),
|
||||
position_sensitive(false),
|
||||
pooled_width(0),
|
||||
pooled_height(0),
|
||||
spatial_scale(0.0f),
|
||||
trans_std(0.0f),
|
||||
no_trans(false),
|
||||
output_dim(0),
|
||||
part_size(0),
|
||||
group_size(0),
|
||||
spatial_bins_x(1),
|
||||
spatial_bins_y(1) {}
|
||||
|
||||
DECLARE_OBJECT_TYPE_SERIALIZATION
|
||||
|
||||
|
||||
@@ -495,8 +495,8 @@ struct layout {
|
||||
bool is_dynamic() const;
|
||||
|
||||
bool has_upper_bound() const {
|
||||
for (auto i : size) {
|
||||
if (i.get_max_length() == -1)
|
||||
for (const auto& dim : size) {
|
||||
if (dim.get_max_length() == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -30,7 +30,7 @@ void basic_memory_dependencies::run(program& p) {
|
||||
continue;
|
||||
|
||||
// add my dependencies to restriction list (can't share input.output buffers)
|
||||
for (auto it : node->get_dependencies()) {
|
||||
for (const auto& it : node->get_dependencies()) {
|
||||
add_memory_dependency(node, it.first);
|
||||
add_memory_dependency(it.first, node);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void eltwise_remove_stride::conv_stride_extend(program& p, program_node& node, c
|
||||
// make sure this is conv 1x1
|
||||
if (filter_size.spatial[0] == 1 && filter_size.spatial[1] == 1) {
|
||||
auto deps = node.get_dependencies();
|
||||
for (auto dep : deps) {
|
||||
for (const auto& dep : deps) {
|
||||
if (dep.first->is_type<convolution>()) {
|
||||
conv_stride_extend(p, *dep.first, tensor);
|
||||
dep.first->recalc_output_layout(true);
|
||||
|
||||
@@ -91,9 +91,9 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
||||
|
||||
bool is_onednn_impl = false;
|
||||
|
||||
for (auto& input : node.get_dependencies()) {
|
||||
for (const auto& input : node.get_dependencies()) {
|
||||
if (input.first->get_preferred_impl_type() == impl_types::onednn) {
|
||||
for (auto& fused_op : input.first->get_fused_primitives()) {
|
||||
for (const auto& fused_op : input.first->get_fused_primitives()) {
|
||||
auto add_type = onednn_add_fusing_helpers::get_add_fusing_type(*input.first, fused_op);
|
||||
if (add_type == add_fusing_type::sum)
|
||||
return false;
|
||||
@@ -141,7 +141,7 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
||||
auto def_fmt = format::get_default_format(node.get_output_layout().get_rank());
|
||||
|
||||
size_t idx = 0;
|
||||
for (auto& input : node.get_dependencies()) {
|
||||
for (const auto& input : node.get_dependencies()) {
|
||||
if (input.first->is_type<reshape>())
|
||||
// reshapes should be optimized out.
|
||||
return false;
|
||||
@@ -178,7 +178,7 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
||||
|
||||
// check if concatenation in place can be applied for inputs set
|
||||
idx = 0;
|
||||
for (auto input : node.get_dependencies()) {
|
||||
for (const auto& input : node.get_dependencies()) {
|
||||
// reverted condition - if any of this node's inputs is used by more than one primitive
|
||||
// and is not optimized concatenation then do not fuse buffers
|
||||
// todo: we need add padding support for all optimized kernels to remove this condition
|
||||
@@ -279,7 +279,7 @@ void concat_in_place_optimization::optimize_cascade(concatenation_node& node, st
|
||||
upper_padd[concat_axis_legacy] += out_layout.get_dims()[concat_axis];
|
||||
|
||||
// apply concatenation in place optimization
|
||||
for (auto input : node.get_dependencies()) {
|
||||
for (const auto& input : node.get_dependencies()) {
|
||||
auto input_length = input.first->get_output_layout().get_dims()[concat_axis];
|
||||
|
||||
if (input.first->is_type<concatenation>() && input.first->can_be_optimized())
|
||||
|
||||
@@ -67,7 +67,7 @@ void prepare_primitive_fusing::remove_redundant_reshape(program &p) {
|
||||
while (node_itr != p.get_processing_order().end()) {
|
||||
auto node = (*node_itr++);
|
||||
program_helpers::do_for_types<reshape>(*node, [&p](reshape_node& node) {
|
||||
for (auto prev : node.get_dependencies()) {
|
||||
for (const auto& prev : node.get_dependencies()) {
|
||||
if (!prev.first->is_type<reshape>())
|
||||
return;
|
||||
if (prev.first->get_users().size() > 1 || prev.first->get_dependencies().size() > 1)
|
||||
|
||||
@@ -713,9 +713,6 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
|
||||
// Remove sub operations from the graph and set correct users for zero points and inputs
|
||||
if (asymmetric_data) {
|
||||
if (!new_a_zp || !new_input)
|
||||
CLDNN_ERROR_MESSAGE(new_conv_node.id(), "Unexpected nullptr in asymmetric quantization for activations optimization");
|
||||
|
||||
auto& zp_users = new_a_zp->users;
|
||||
auto& in_users = new_input->users;
|
||||
// Erase sub node from input and zero point users...
|
||||
@@ -735,9 +732,6 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
}
|
||||
|
||||
if (asymmetric_weights) {
|
||||
if (!new_w_zp || !new_weights)
|
||||
CLDNN_ERROR_MESSAGE(new_conv_node.id(), "Unexpected nullptr in asymmetric quantization for weights optimization");
|
||||
|
||||
auto& zp_users = new_w_zp->users;
|
||||
auto& wei_users = new_weights->users;
|
||||
// Erase sub node from weights and zero point users...
|
||||
|
||||
@@ -97,10 +97,10 @@ struct travel_direction_wrapper {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T& first(T& current, T& /*next*/) { return current; }
|
||||
static const T& first(const T& current, const T& /*next*/) { return current; }
|
||||
|
||||
template <typename T>
|
||||
static T& second(T& /*current*/, T& next) { return next; }
|
||||
static const T& second(const T& /*current*/, const T& next) { return next; }
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -110,10 +110,10 @@ struct travel_direction_wrapper<direction_e::backwards> {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T& first(T& /*current*/, T& next) { return next; }
|
||||
static const T& first(const T& /*current*/, const T& next) { return next; }
|
||||
|
||||
template <typename T>
|
||||
static T& second(T& current, T& /*next*/) { return current; }
|
||||
static const T& second(const T& current, const T& /*next*/) { return current; }
|
||||
};
|
||||
|
||||
static format get_target_output_format(layout_optimizer& lo, const std::map<program_node*, format::type>& fmt_map, program_node *node, program_node *next) {
|
||||
@@ -246,7 +246,7 @@ bool can_propagate_formats_rec<direction_e::backwards>(
|
||||
if (reverse_reorders > 0)
|
||||
return false;
|
||||
|
||||
for (auto next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
for (const auto& next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
if (!can_propagate_formats_rec<direction_e::backwards>(fmt_map, lo, node, next.first, fmt))
|
||||
@@ -315,7 +315,7 @@ void propagate_formats_rec<direction_e::backwards>(std::map<program_node*, forma
|
||||
fmt_map.at(node) = fmt;
|
||||
GPU_DEBUG_LOG << "Propagate_formats_rec: " << node->id() << " - " << fmt_to_str(fmt) << std::endl;
|
||||
|
||||
for (auto next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
for (const auto& next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
propagate_formats_rec<direction_e::backwards>(fmt_map, lo, node, next.first, fmt);
|
||||
@@ -348,14 +348,14 @@ void propagate_formats_in_dir<direction_e::backwards>(std::map<program_node*, fo
|
||||
program_node* node) {
|
||||
auto fmt = fmt_map.at(node);
|
||||
|
||||
for (auto next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
for (const auto& next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
if (!can_propagate_formats_rec<direction_e::backwards>(fmt_map, lo, node, next.first, fmt))
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
for (const auto& next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
propagate_formats_rec<direction_e::backwards>(fmt_map, lo, node, next.first, fmt);
|
||||
@@ -415,7 +415,7 @@ reorder_cnt count_reorders_in_dir<direction_e::backwards>(const std::map<program
|
||||
size_t cnt = 0;
|
||||
size_t size = 0;
|
||||
|
||||
for (auto next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
for (const auto& next : travel_direction_wrapper<direction_e::backwards>::next_nodes(node)) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
|
||||
@@ -459,7 +459,7 @@ void minimize_local_reorders(program& p, std::map<program_node*, format::type>&
|
||||
for (auto user : node->get_users()) {
|
||||
io_formats.insert(fmt_map.at(user));
|
||||
}
|
||||
for (auto dep : node->get_dependencies()) {
|
||||
for (const auto& dep : node->get_dependencies()) {
|
||||
if (!dep.first->is_in_data_flow())
|
||||
continue;
|
||||
io_formats.insert(fmt_map.at(dep.first));
|
||||
@@ -496,7 +496,7 @@ void minimize_local_reorders(program& p, std::map<program_node*, format::type>&
|
||||
}
|
||||
}
|
||||
|
||||
for (auto dep : node->get_dependencies()) {
|
||||
for (const auto& dep : node->get_dependencies()) {
|
||||
if (!dep.first->is_in_data_flow())
|
||||
continue;
|
||||
|
||||
@@ -595,7 +595,7 @@ void insert_reorders_in_dir<direction_e::backwards>(program& p, const std::map<p
|
||||
auto fmt = fmt_map.at(node);
|
||||
|
||||
auto next_cpy = travel_direction_wrapper<direction_e::backwards>::next_nodes(node);
|
||||
for (auto next : next_cpy) {
|
||||
for (const auto& next : next_cpy) {
|
||||
if (!next.first->is_in_data_flow())
|
||||
continue;
|
||||
|
||||
@@ -715,7 +715,7 @@ void reorder_inputs::run(program& p, layout_optimizer& lo, reorder_factory& rf)
|
||||
for (auto node_ptr : p.get_processing_order()) {
|
||||
if (fmt_map.count(node_ptr) == 0 || fmt_map.at(node_ptr) == format::any)
|
||||
continue;
|
||||
for (auto prev_ptr : travel_direction_wrapper<direction_e::backwards>::next_nodes(node_ptr)) {
|
||||
for (const auto& prev_ptr : travel_direction_wrapper<direction_e::backwards>::next_nodes(node_ptr)) {
|
||||
if (!prev_ptr.first->is_in_data_flow() || fmt_map.at(prev_ptr.first) == fmt_map.at(node_ptr))
|
||||
continue;
|
||||
if (lo.can_fuse_reorder(*prev_ptr.first, *node_ptr, fmt_map.at(prev_ptr.first), fmt_map.at(node_ptr))) {
|
||||
|
||||
@@ -144,7 +144,6 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
public:
|
||||
typed_primitive_inst(network& network, convolution_node const& node);
|
||||
|
||||
memory::ptr weights_memory() const {
|
||||
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
if (node->id() == dep->id()) {
|
||||
return;
|
||||
}
|
||||
for (auto subdep : dep->get_dependencies()) {
|
||||
for (const auto& subdep : dep->get_dependencies()) {
|
||||
add_memory_dependency(node, subdep.first);
|
||||
add_memory_dependency(subdep.first, node);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ protected:
|
||||
for (auto u : _node->get_users())
|
||||
users.push_back(u->id());
|
||||
|
||||
for (auto u : _network.get_primitives(users)) {
|
||||
for (const auto& u : _network.get_primitives(users)) {
|
||||
if (u->need_reset_input_memory())
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace cldnn {
|
||||
class QuantizeFuseParams : public NodeFuseParams {
|
||||
public:
|
||||
QuantizeFuseParams(layout out_layout,
|
||||
QuantizeFuseParams(const layout& out_layout,
|
||||
bool scale_shift_opt,
|
||||
bool need_post_scale,
|
||||
bool need_post_shift,
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace cldnn {
|
||||
|
||||
class ReorderFuseParams : public NodeFuseParams {
|
||||
public:
|
||||
ReorderFuseParams(layout in, layout out) : NodeFuseParams(reorder::type_id()), _in(in), _out(out) {}
|
||||
ReorderFuseParams(const layout& in, const layout& out) : NodeFuseParams(reorder::type_id()), _in(in), _out(out) {}
|
||||
|
||||
layout _in;
|
||||
layout _out;
|
||||
|
||||
@@ -53,7 +53,7 @@ std::string mutable_data_inst::to_string(mutable_data_node const& node) {
|
||||
void mutable_data_inst::set_output_memory(memory::ptr mem_new, bool check, size_t idx) {
|
||||
if (_node != nullptr) {
|
||||
auto& eng = _network.get_engine();
|
||||
auto& mem_node = const_cast<program_node *>(_node)->as<mutable_data>();
|
||||
auto& mem_node = const_cast<program_node*>(_node)->as<mutable_data>();
|
||||
auto& mem_attached = mem_node.get_attached_memory();
|
||||
const auto& mem_orig = *_outputs[idx];
|
||||
|
||||
|
||||
@@ -431,7 +431,7 @@ network::network(cldnn::BinaryInputBuffer& ib, const ExecutionConfig& config, st
|
||||
}
|
||||
}
|
||||
|
||||
for (auto p_inst : _exec_order) {
|
||||
for (const auto& p_inst : _exec_order) {
|
||||
p_inst->rebuild_deps(_primitives);
|
||||
p_inst->rebuild_exec_deps(_primitives);
|
||||
|
||||
@@ -442,7 +442,7 @@ network::network(cldnn::BinaryInputBuffer& ib, const ExecutionConfig& config, st
|
||||
auto nodes_list = stack.front();
|
||||
stack.pop_front();
|
||||
|
||||
for (auto processed_nodes : *nodes_list) {
|
||||
for (const auto& processed_nodes : *nodes_list) {
|
||||
auto processed_node = processed_nodes.first;
|
||||
auto dep_node = _primitives[processed_node->id()];
|
||||
dep_node->set_output_memory(p_inst->output_memory_ptr(), false);
|
||||
@@ -458,7 +458,7 @@ network::network(cldnn::BinaryInputBuffer& ib, const ExecutionConfig& config, st
|
||||
std::map<std::string, std::string> reuse_map;
|
||||
ib >> reuse_map;
|
||||
|
||||
for (auto reuse_pair : reuse_map) {
|
||||
for (const auto& reuse_pair : reuse_map) {
|
||||
auto& eltw_inst = _primitives.at(reuse_pair.second);
|
||||
auto& prim_inst = _primitives.at(reuse_pair.first);
|
||||
auto& eltw_mem = eltw_inst->output_memory();
|
||||
|
||||
@@ -128,18 +128,16 @@ void primitive_inst::check_memory_to_set(const memory& mem, const layout& layout
|
||||
switch (params.mem_type) {
|
||||
case shared_mem_type::shared_mem_vasurface:
|
||||
case shared_mem_type::shared_mem_image:
|
||||
if (!layout.format.is_image_2d())
|
||||
CLDNN_ERROR_MESSAGE(_node->id(), "Attempt to set user-supplied input or output image instead of a buffer");
|
||||
OPENVINO_ASSERT(layout.format.is_image_2d(), "Attempt to set user-supplied input or output image instead of a buffer");
|
||||
break;
|
||||
case shared_mem_type::shared_mem_buffer:
|
||||
case shared_mem_type::shared_mem_dxbuffer:
|
||||
if (layout.format.is_image_2d())
|
||||
CLDNN_ERROR_MESSAGE(_node->id(), "Attempt to set user-supplied input or output buffer instead of an image");
|
||||
OPENVINO_ASSERT(!layout.format.is_image_2d(), "Attempt to set user-supplied input or output buffer instead of an image");
|
||||
break;
|
||||
case shared_mem_type::shared_mem_usm:
|
||||
break;
|
||||
default:
|
||||
CLDNN_ERROR_MESSAGE(_node->id(), "Attempt to set user-supplied input or output memory of unknown/invalid type");
|
||||
OPENVINO_THROW("Attempt to set user-supplied input or output memory of unknown/invalid type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
{
|
||||
ob << GetInputsInfo().size();
|
||||
|
||||
for (const auto & in : GetInputsInfo()) {
|
||||
for (const auto& in : GetInputsInfo()) {
|
||||
ob << in.first;
|
||||
std::string precision(in.second->getPrecision().name());
|
||||
ob << precision;
|
||||
@@ -202,7 +202,7 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
|
||||
ob << GetOutputsInfo().size();
|
||||
|
||||
for (const auto & out : GetOutputsInfo()) {
|
||||
for (const auto& out : GetOutputsInfo()) {
|
||||
ob << out.first;
|
||||
std::string precision(out.second->getPrecision().name());
|
||||
ob << precision;
|
||||
@@ -215,17 +215,17 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
|
||||
// Inputs
|
||||
{
|
||||
std::vector<std::shared_ptr<const ov::Node>> const_params = getInputs();
|
||||
const std::vector<std::shared_ptr<const ov::Node>>& const_params = getInputs();
|
||||
ob << const_params.size();
|
||||
|
||||
for (const auto& param : const_params) {
|
||||
auto new_param = ov::as_type_ptr<const ov::op::v0::Parameter>(param);
|
||||
std::string param_name = new_param->get_friendly_name();
|
||||
ov::element::Type param_element_type = new_param->get_element_type();
|
||||
ov::PartialShape param_shape = new_param->get_partial_shape();
|
||||
ov::Layout param_layout = new_param->get_layout();
|
||||
// ov::RTMap param_rt_info = new_param->output(0).get_rt_info();
|
||||
auto param_names = new_param->output(0).get_tensor().get_names();
|
||||
|
||||
const std::string& param_name = new_param->get_friendly_name();
|
||||
const ov::PartialShape& param_shape = new_param->get_partial_shape();
|
||||
const ov::Layout& param_layout = new_param->get_layout();
|
||||
const auto& param_names = new_param->output(0).get_tensor().get_names();
|
||||
|
||||
ob << param_name;
|
||||
std::stringstream ss;
|
||||
@@ -234,7 +234,7 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
ob << param_shape;
|
||||
ob << param_layout.to_string();
|
||||
ob << param_names.size();
|
||||
for (auto name : param_names) {
|
||||
for (const auto& name : param_names) {
|
||||
ob << name;
|
||||
}
|
||||
}
|
||||
@@ -247,14 +247,14 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
|
||||
for (const auto& param : const_results) {
|
||||
auto new_param = ov::as_type_ptr<const ov::op::v0::Result>(param);
|
||||
|
||||
ov::element::Type fake_element_type = new_param->get_input_element_type(0);
|
||||
ov::PartialShape fake_shape = new_param->get_input_partial_shape(0);
|
||||
std::string fake_name = new_param->get_input_node_ptr(0)->get_friendly_name();
|
||||
|
||||
std::string param_name = new_param->get_friendly_name();
|
||||
ov::Layout param_layout = new_param->get_layout();
|
||||
auto param_names = new_param->output(0).get_tensor().get_names();
|
||||
const std::string& fake_name = new_param->get_input_node_ptr(0)->get_friendly_name();
|
||||
const std::string& param_name = new_param->get_friendly_name();
|
||||
const ov::PartialShape& fake_shape = new_param->get_input_partial_shape(0);
|
||||
const ov::Layout& param_layout = new_param->get_layout();
|
||||
const auto& param_names = new_param->output(0).get_tensor().get_names();
|
||||
|
||||
|
||||
std::stringstream ss;
|
||||
ss << fake_element_type;
|
||||
@@ -264,7 +264,7 @@ void CompiledModel::Export(std::ostream& networkModel) {
|
||||
ob << param_name;
|
||||
ob << param_layout.to_string();
|
||||
ob << param_names.size();
|
||||
for (auto name : param_names) {
|
||||
for (const auto& name : param_names) {
|
||||
ob << name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ void Graph::Export(cldnn::BinaryOutputBuffer &ob) {
|
||||
ob << outputDims;
|
||||
|
||||
ob << m_networks.size();
|
||||
for (auto net : m_networks) {
|
||||
for (const auto& net : m_networks) {
|
||||
net->save(ob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,7 +524,8 @@ void InferRequest::wait() {
|
||||
|
||||
bool need_output_update = false;
|
||||
|
||||
if (outputLayout.bytes_count() == 0 || _outputs.find(no.first) == _outputs.end() || _outputs.at(no.first)->byteSize() != outputMemory->size()) {
|
||||
if (outputLayout.bytes_count() == 0 || _outputs.find(no.first) == _outputs.end() ||
|
||||
(outputMemory && _outputs.at(no.first)->byteSize() != outputMemory->size())) {
|
||||
need_output_update = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -543,13 +543,11 @@ void InferRequestLegacy::SetGraph(std::shared_ptr<Graph> graph) {
|
||||
|
||||
void InferRequestLegacy::SetBatch(int new_batch) {
|
||||
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "InferRequestLegacy::SetBatch");
|
||||
if (m_graph->GetMaxDynamicBatchSize() < 0)
|
||||
IE_THROW() << "Dynamic batch is not enabled.";
|
||||
|
||||
if (new_batch < 1 || static_cast<size_t>(new_batch) > m_graph->GetMaxDynamicBatchSize()) {
|
||||
IE_THROW() << "Invalid dynamic batch size " << new_batch <<
|
||||
" for this request. Got: " << new_batch << ". Expected value in range [1;" << m_graph->GetMaxDynamicBatchSize() << "]";
|
||||
}
|
||||
OPENVINO_ASSERT(new_batch > 0 && static_cast<size_t>(new_batch) <= m_graph->GetMaxDynamicBatchSize(),
|
||||
"[GPU] Invalid dynamic batch size ", new_batch, " for this request. ",
|
||||
"Got: ", new_batch, ". ",
|
||||
"Expected value in range [1;", m_graph->GetMaxDynamicBatchSize(), "]");
|
||||
|
||||
if (new_batch == m_curBatch)
|
||||
return;
|
||||
|
||||
@@ -35,9 +35,7 @@ static void CreateCommonCTCGreedyDecoderOp(Program& p, const std::shared_ptr<ngr
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
|
||||
@@ -146,9 +146,7 @@ void CreateCustomOp(Program& p, const std::shared_ptr<ngraph::Node>& op, CustomL
|
||||
reorderPrimName,
|
||||
inputs[param.portIndex],
|
||||
param.format,
|
||||
cldnn::element_type_to_data_type(op->get_input_element_type(param.portIndex)),
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::element_type_to_data_type(op->get_input_element_type(param.portIndex)));
|
||||
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[param.portIndex] = cldnn::input_info(reorderPrimName);
|
||||
@@ -190,12 +188,12 @@ void CreateCustomOp(Program& p, const std::shared_ptr<ngraph::Node>& op, CustomL
|
||||
int featureDim = outputTensor.feature[0];
|
||||
int yDim = outputTensor.spatial[1];
|
||||
int xDim = outputTensor.spatial[0];
|
||||
size_t iidx = customLayer->InputDimSourceIndex();
|
||||
int iidx = customLayer->InputDimSourceIndex();
|
||||
|
||||
std::string genericLayerName = layer_type_name_ID(op);
|
||||
// if input index is greater than -1, take dimension from input
|
||||
if (iidx >= 0) {
|
||||
if (iidx >= op->get_input_size())
|
||||
if (static_cast<size_t>(iidx) >= op->get_input_size())
|
||||
IE_THROW() << "Invalid input tensor for index: " << iidx;
|
||||
auto inputDims = op->get_input_shape(iidx);
|
||||
|
||||
@@ -210,13 +208,13 @@ void CreateCustomOp(Program& p, const std::shared_ptr<ngraph::Node>& op, CustomL
|
||||
{ 'y', yDim }, { 'Y', yDim },
|
||||
{ 'x', xDim }, { 'X', xDim },
|
||||
};
|
||||
for (auto rule : customLayer->GlobalSizeRules()) {
|
||||
for (const auto& rule : customLayer->GlobalSizeRules()) {
|
||||
SimpleMathExpression expr;
|
||||
expr.SetVariables(vars);
|
||||
expr.SetExpression(rule);
|
||||
gws.push_back(expr.Evaluate());
|
||||
}
|
||||
for (auto rule : customLayer->LocalSizeRules()) {
|
||||
for (const auto& rule : customLayer->LocalSizeRules()) {
|
||||
SimpleMathExpression expr;
|
||||
expr.SetVariables(vars);
|
||||
expr.SetExpression(rule);
|
||||
@@ -240,9 +238,7 @@ void CreateCustomOp(Program& p, const std::shared_ptr<ngraph::Node>& op, CustomL
|
||||
p.add_primitive(*op, cldnn::reorder(reorderPrimName,
|
||||
cldnn::input_info(genericLayerName),
|
||||
cldnn::format::get_default_format(op->get_output_shape(0).size()),
|
||||
customPrim.output_layout.data_type,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract));
|
||||
customPrim.output_layout.data_type));
|
||||
prevLayerName = reorderPrimName;
|
||||
}
|
||||
p.add_primitive(*op, customPrim);
|
||||
|
||||
@@ -57,9 +57,7 @@ void CreateElementwiseOp(Program& p,
|
||||
auto reorderPrim = cldnn::reorder(reorderName,
|
||||
inputs[i],
|
||||
targetFormat,
|
||||
targetDatatype,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
targetDatatype);
|
||||
|
||||
p.add_primitive(*op, reorderPrim);
|
||||
inputs[i] = cldnn::input_info(reorderName);
|
||||
|
||||
@@ -50,9 +50,7 @@ static void CreateEmbeddingBagOffsetsSumOp(Program& p, const std::shared_ptr<ngr
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
@@ -87,9 +85,7 @@ static void CreateEmbeddingBagPackedSumOp(Program& p, const std::shared_ptr<ngra
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
@@ -142,9 +138,7 @@ static void CreateEmbeddingSegmentsSumOp(Program& p, const std::shared_ptr<ngrap
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
|
||||
@@ -21,7 +21,7 @@ static void CreateEyeOp(Program& p, const std::shared_ptr<ngraph::op::v9::Eye>&
|
||||
|
||||
const InferenceEngine::SizeVector& output_shapes = op->get_output_shape(0);
|
||||
auto os_sz = output_shapes.size();
|
||||
assert(2 <= os_sz && os_sz <= 5);
|
||||
OPENVINO_ASSERT(2 <= os_sz && os_sz <= 5, "Incorrect output size: ", os_sz, " in op ", op->get_friendly_name());
|
||||
|
||||
size_t dim_size = std::max(os_sz, static_cast<size_t>(4));
|
||||
InferenceEngine::SizeVector dims(dim_size, 1);
|
||||
@@ -29,6 +29,8 @@ static void CreateEyeOp(Program& p, const std::shared_ptr<ngraph::op::v9::Eye>&
|
||||
dims[i - 1] = output_shapes[j - 1];
|
||||
}
|
||||
const ngraph::op::v0::Constant* constant = dynamic_cast<const ngraph::op::v0::Constant*>(op->get_input_node_ptr(2));
|
||||
OPENVINO_ASSERT(constant != nullptr, "Unsupported parameter nodes type in ", op->get_friendly_name(), " (", op->get_type_name(), ")");
|
||||
|
||||
int32_t shift{};
|
||||
switch (constant->get_element_type()) {
|
||||
case ov::element::Type_t::i32:
|
||||
|
||||
@@ -31,9 +31,7 @@ static void CreateGatherTreeOp(Program& p, const std::shared_ptr<ngraph::op::v1:
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
|
||||
@@ -35,9 +35,7 @@ void CreateGatherOpBase(Program& p, const std::shared_ptr<T>& op, const int64_t
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
|
||||
@@ -33,9 +33,7 @@ static void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_pt
|
||||
auto preprocessPrim = cldnn::reorder(reorderPrimName,
|
||||
inputs[portIndex],
|
||||
targetFormat,
|
||||
cldnn::data_types::i32,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
cldnn::data_types::i32);
|
||||
p.add_primitive(*op, preprocessPrim);
|
||||
reordered_inputs[portIndex] = cldnn::input_info(reorderPrimName);
|
||||
} else {
|
||||
|
||||
@@ -44,7 +44,8 @@ static void CreatePadOp(Program& p, const std::shared_ptr<ngraph::op::v1::Pad>&
|
||||
if (op->get_pad_mode() == ov::op::PadMode::CONSTANT && op->get_input_size() == 4) {
|
||||
auto const_node = std::dynamic_pointer_cast<ngraph::op::v0::Constant>(op->get_input_node_shared_ptr(3));
|
||||
if (const_node) {
|
||||
ov::op::util::get_single_value(const_node, pad_value);
|
||||
OPENVINO_ASSERT(ov::op::util::get_single_value(const_node, pad_value),
|
||||
"Invalid parameter size in ", op->get_friendly_name(), " (", op->get_type_name(), ")");
|
||||
is_value_const = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,7 @@ static void CreateCommonReshapeOp(Program& p, const std::shared_ptr<ngraph::Node
|
||||
cldnn::layout outputLayout(cldnn::element_type_to_data_type(op->get_output_element_type(0)), outputFormat, outTensor);
|
||||
p.add_primitive(*op, cldnn::reorder(reorderId,
|
||||
reshape_input,
|
||||
outputLayout,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract));
|
||||
outputLayout));
|
||||
reshape_input = cldnn::input_info(reorderId);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ void GetLSTMActivationParams(const std::shared_ptr<T>& op,
|
||||
static void CreateLSTMCellOp(Program& p, const std::shared_ptr<ngraph::op::v4::LSTMCell>& op) {
|
||||
validate_inputs_count(op, {6});
|
||||
int lstm_batch_size, lstm_input_size, lstm_hidden_size;
|
||||
bool hasBias = true;
|
||||
auto inputs = p.GetInputInfo(op);
|
||||
|
||||
std::string layerName = layer_type_name_ID(op);
|
||||
@@ -131,7 +130,6 @@ static void CreateLSTMCellOp(Program& p, const std::shared_ptr<ngraph::op::v4::L
|
||||
|
||||
std::string lstm_fc_id = layerName + "_fully_connected";
|
||||
std::string lstm_elt_id = layerName + "_lstm_elt";
|
||||
std::string crop_id = layerName + "_crop";
|
||||
|
||||
cldnn::primitive_id WRconcatID = layerName + "_WRconcat";
|
||||
p.add_primitive(*op, cldnn::concatenation(WRconcatID, { weight, recurrent }, 1));
|
||||
@@ -140,7 +138,7 @@ static void CreateLSTMCellOp(Program& p, const std::shared_ptr<ngraph::op::v4::L
|
||||
cldnn::tensor FCInputReshapeSz = { lstm_batch_size, inputShape.spatial[0] + inStateShape.spatial[0], 1, 1 };
|
||||
p.add_primitive(*op, cldnn::reshape(FCInputReshapeID, cldnn::input_info(input_concatID), FCInputReshapeSz));
|
||||
|
||||
p.add_primitive(*op, cldnn::fully_connected(lstm_fc_id, cldnn::input_info(FCInputReshapeID), WRconcatID, hasBias ? bias.pid : ""));
|
||||
p.add_primitive(*op, cldnn::fully_connected(lstm_fc_id, cldnn::input_info(FCInputReshapeID), WRconcatID, bias.pid));
|
||||
p.add_primitive(*op, cldnn::reshape(gemmReshapeID, cldnn::input_info(lstm_fc_id), gemmSz));
|
||||
p.add_primitive(*op, cldnn::reorder(gemmReorderID, cldnn::input_info(gemmReshapeID), gemmLayout));
|
||||
p.add_primitive(*op, cldnn::lstm_elt(lstm_elt_id, cldnn::input_info(gemmReorderID), cellInStr, clip, 0, activations,
|
||||
|
||||
@@ -47,9 +47,7 @@ static void CreateSelectOp(Program& p, const std::shared_ptr<ngraph::op::v1::Sel
|
||||
auto reorderPrim = cldnn::reorder(reorderName,
|
||||
inputs[i],
|
||||
targetFormat,
|
||||
targetDatatype,
|
||||
std::vector<float>(),
|
||||
cldnn::reorder_mean_mode::subtract);
|
||||
targetDatatype);
|
||||
|
||||
p.add_primitive(*op, reorderPrim);
|
||||
|
||||
|
||||
@@ -206,10 +206,8 @@ static void CreateStridedSliceOp(Program& p, const std::shared_ptr<ngraph::op::v
|
||||
|
||||
std::vector<cldnn::tensor::value_type> offset_tensor{ 0, 0, 0, 0 };
|
||||
for (size_t i = 0; i < axes.size(); i++) {
|
||||
if (axes[i] < 0 || axes[i] > 3) {
|
||||
IE_THROW() << "Invalid crop axis: " << std::to_string(axes[i]) << " in op " + op->get_friendly_name();
|
||||
}
|
||||
offset_tensor[axes[i]] = static_cast<uint32_t>(offset[i]);
|
||||
OPENVINO_ASSERT(axes[i] < 4, "[GPU] Invalid crop axis: ", axes[i], " in op ", op->get_friendly_name());
|
||||
offset_tensor[axes[i]] = static_cast<cldnn::tensor::value_type>(offset[i]);
|
||||
}
|
||||
|
||||
ngraph::Shape crop_shape(reshape_pattern);
|
||||
@@ -217,11 +215,9 @@ static void CreateStridedSliceOp(Program& p, const std::shared_ptr<ngraph::op::v
|
||||
crop_shape[axes[i]] = dim[i];
|
||||
}
|
||||
|
||||
|
||||
cldnn::tensor refSize = tensor_from_dims(crop_shape);
|
||||
cldnn::tensor offSize = tensor_from_dims(offset, 0);
|
||||
|
||||
|
||||
auto cropPrim = cldnn::crop(layerName, inPrimitive, refSize, offSize);
|
||||
p.add_primitive(*op, cropPrim);
|
||||
auto last_layer_primitive = layerName;
|
||||
|
||||
@@ -156,7 +156,7 @@ Plugin::Plugin() : m_default_contexts({}) {
|
||||
}
|
||||
|
||||
auto check_inputs = [](InferenceEngine::InputsDataMap _networkInputs) {
|
||||
for (auto ii : _networkInputs) {
|
||||
for (const auto& ii : _networkInputs) {
|
||||
auto input_precision = ii.second->getTensorDesc().getPrecision();
|
||||
if (input_precision != InferenceEngine::Precision::FP16 &&
|
||||
input_precision != InferenceEngine::Precision::FP32 &&
|
||||
|
||||
@@ -32,6 +32,7 @@ RemoteBlobImpl::RemoteBlobImpl(InferenceEngine::gpu::ClContext::Ptr context,
|
||||
, m_plane(plane)
|
||||
, m_layout(layout)
|
||||
, m_mem_type(mem_type)
|
||||
, m_hash(0)
|
||||
, m_memory_object(nullptr)
|
||||
, lockedCounter(0)
|
||||
, lockedHolder(nullptr)
|
||||
@@ -196,7 +197,7 @@ std::shared_ptr<InferenceEngine::RemoteContext> RemoteBlobImpl::getContext() con
|
||||
return m_context;
|
||||
}
|
||||
|
||||
void RemoteBlobImpl::reinterpret(cldnn::layout new_layout) {
|
||||
void RemoteBlobImpl::reinterpret(const cldnn::layout& new_layout) {
|
||||
OPENVINO_ASSERT(m_layout.bytes_count() >= new_layout.bytes_count(),
|
||||
"[GPU] Can't reinterpret blob to the size bigger than allocated memory buffer");
|
||||
m_layout = new_layout;
|
||||
|
||||
Reference in New Issue
Block a user