[CPU]Remove warning suppression '-Wno-sign-compare' and fix warnings (#16476)

* fix some warning sign-compare
1: get_length() sometime return dimension, sometime return static_dimension(template param), all convert to int64_t for comparing;
	src/core/include/openvino/core/dimension.hpp:28 value_type=int64_t;
	src/plugins/intel_cpu/src/utils/shape_inference/static_dimension.hpp:24 value_type = size_t;
2: auto default = int; for loop and const declaration;
3: sign and no-sign compare, compiler will convert them to no-sign to compare automatically;
	So recommend to static_cast<size_t>;

Signed-off-by: xipingya <xiping.yan@intel.com>

* -    size_t brg0BaseIdx = -1;
+    int64_t brg0BaseIdx = -1;

And some test case sign no-sign comparison.

* Fix new warnings after rebase.

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

* Update based on maxnick review.

Signed-off-by: xipingya <xiping.yan@intel.com>

* Process latest comments.

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

* Change embIndex from int to size_t

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

* 1: Revert lastNumSegments_, segmentIds_ to int
2: Initialize size_t brg1BaseIdx = std::numeric_limits<size_t>::max();

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

* Simplify this comparing.
-            indexes.push_back(std::max<size_t>(idx - 1, 0u));
+            indexes.push_back(0u == idx ? 0 : idx - 1);

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

* Fix arm build warning.

Signed-off-by: xipingya <xiping.yan@intel.com>

* Fix ARM plugin build fail issue.

Signed-off-by: xipingya <xiping.yan@intel.com>

* Fix new warning

Signed-off-by: xipingya <xiping.yan@intel.com>

* outConf.inPlace() maybe is -1

Signed-off-by: xipingya <xiping.yan@intel.com>

---------

Signed-off-by: xipingya <xiping.yan@intel.com>
Signed-off-by: Yan, Xiping <xiping.yan@intel.com>
This commit is contained in:
Xiping Yan
2023-05-31 11:58:29 +04:00
committed by GitHub
parent d84face9ee
commit dba5de6513
154 changed files with 659 additions and 638 deletions
@@ -55,13 +55,14 @@ std::vector<TShape> shape_infer(const BatchToSpace* op,
"data input must have rank greater or equal than 2. Got: ",
data_rank_size);
if (inputs_same_ps.is_static()) {
NODE_VALIDATION_CHECK(op,
data_rank.get_length() == inputs_same_ps[0].get_length(),
"block_shape and crop inputs must have same number of elements "
"as data input rank. Got: ",
inputs_same_ps[0],
" and ",
data_rank);
NODE_VALIDATION_CHECK(
op,
static_cast<int64_t>(data_rank.get_length()) == static_cast<int64_t>(inputs_same_ps[0].get_length()),
"block_shape and crop inputs must have same number of elements "
"as data input rank. Got: ",
inputs_same_ps[0],
" and ",
data_rank);
}
TShape out_shape;
@@ -216,12 +216,13 @@ void broadcast_base_shape_infer(
if (data_input_shape.rank().is_static() && target_input_shape.rank().is_static() && axes_shape.is_static()) {
int64_t input_rank =
(data_input_shape.size() == 0 && axes_shape[0].get_length() > 0) ? 1 : data_input_shape.size();
NODE_VALIDATION_CHECK(op,
axes_shape[0].get_length() == input_rank,
"Broadcast axes_mapping shape ",
axes_shape,
" doesn't match rank of input tensor ",
input_rank);
NODE_VALIDATION_CHECK(
op,
static_cast<uint64_t>(axes_shape[0].get_length()) == static_cast<uint64_t>(input_rank),
"Broadcast axes_mapping shape ",
axes_shape,
" doesn't match rank of input tensor ",
input_rank);
std::vector<int64_t> axes_mapping_val;
if (is_target_shape_defined && get_data_as_int64<T>(2, op, axes_mapping_val, constant_data)) {
AxisVector axes_mapping =
@@ -12,7 +12,7 @@ namespace ov {
namespace util {
namespace dim {
constexpr auto inf_bound = -1; //!< Infinite bound value for dimension.
constexpr int64_t inf_bound = -1; //!< Infinite bound value for dimension.
/**
* @brief Checks if dimension length is infinite bound (undefined).
@@ -58,7 +58,9 @@ std::vector<TShape> shape_infer(const Eye* op,
NODE_VALIDATION_CHECK(op, batch_shape.rank().compatible(1), eye::shape_names[3], " input must be a 1D tensor.");
if (batch_shape.is_static()) {
if (get_data_as_shape<TShape>(3, op, output_shape, constant_data)) {
NODE_VALIDATION_CHECK(op, batch_shape[0].get_length() == output_shape.rank().get_length());
NODE_VALIDATION_CHECK(op,
static_cast<int64_t>(batch_shape[0].get_length()) ==
static_cast<int64_t>(output_shape.rank().get_length()));
} else {
output_shape = PartialShape::dynamic(batch_shape[0].get_length());
}
@@ -225,7 +225,7 @@ constexpr bool is_bounds_zero_crossing(const Bounds b) {
*/
template <class TDim>
constexpr bool is_lb_within_dim(const int64_t lb, const TDim& dim) {
return (dim.get_max_length() == ov::util::dim::inf_bound) || lb + dim.get_max_length() >= 0;
return (static_cast<int64_t>(dim.get_max_length()) == ov::util::dim::inf_bound) || lb + dim.get_max_length() >= 0;
}
/**
@@ -239,7 +239,8 @@ constexpr bool is_lb_within_dim(const int64_t lb, const TDim& dim) {
*/
template <class TDim>
constexpr bool is_ub_within_dim(const int64_t ub, const TDim& dim) {
return (dim.get_max_length() == ov::util::dim::inf_bound) || cmp::lt(ub, dim.get_max_length());
return (static_cast<int64_t>(dim.get_max_length()) == ov::util::dim::inf_bound) ||
cmp::lt(ub, dim.get_max_length());
}
/**
@@ -74,7 +74,7 @@ std::vector<TShape> shape_infer(const SpaceToBatch* op,
const auto padded_dim = data_shape[idx] + static_cast<TVal>(pads_begin[idx] + pads_end[idx]);
const auto divisor = static_cast<TVal>((*blocks)[idx]);
if (padded_dim.get_max_length() == dim::inf_bound) {
if (static_cast<int64_t>(padded_dim.get_max_length()) == dim::inf_bound) {
out_shape.emplace_back(ceil_div(padded_dim.get_min_length(), divisor), dim::inf_bound);
} else {
out_shape.push_back(padded_dim / divisor);
@@ -162,8 +162,10 @@ void shape_infer(const StridedSlice* op,
constexpr int64_t inf_bound = -1;
const auto is_reverse_stride = stride < 0;
const int64_t norm_dim = (input_dim.get_max_length() == inf_bound) ? std::numeric_limits<int64_t>::max()
: input_dim.get_max_length();
const int64_t norm_dim =
(static_cast<int64_t>(input_dim.get_max_length()) == static_cast<int64_t>(inf_bound))
? std::numeric_limits<int64_t>::max()
: input_dim.get_max_length();
const slice::Bounds default_fstart = std::make_pair<int64_t, int64_t>(0, 0);
const slice::Bounds default_rstop = std::make_pair(inf_bound - norm_dim, inf_bound - norm_dim);
const slice::Bounds norm_dim_bounds = std::make_pair(norm_dim, norm_dim);
@@ -87,14 +87,14 @@ void shape_infer(const VariadicSplit* op,
}
if (data_shape[axis].is_static()) {
NODE_VALIDATION_CHECK(op,
sum_of_splits == data_shape[axis].get_length(),
sum_of_splits == static_cast<int64_t>(data_shape[axis].get_length()),
"Total length of splits: ",
sum_of_splits,
" must match the length of the chosen axis: ",
data_shape[axis]);
}
for (auto output = 0; output < num_outputs; ++output) {
for (uint64_t output = 0; output < static_cast<uint64_t>(num_outputs); ++output) {
if (split_lengths.at(output) == -1) {
auto out_shape = data_shape;
out_shape[axis] = Dimension::dynamic();
+1 -3
View File
@@ -8,9 +8,7 @@ endif()
set(TARGET_NAME "openvino_intel_cpu_plugin")
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-sign-compare)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4267, 4244 issues from oneDNN headers conversion from 'XXX' to 'YYY', possible loss of data
ie_add_compiler_flags(/wd4267)
ie_add_compiler_flags(/wd4244)
@@ -301,7 +301,7 @@ void get_num_streams(const int streams,
executor_config._threadsPerStream = executor_config._streams_info_table[0][THREADS_PER_STREAM];
executor_config._streams = 0;
executor_config._threads = 0;
for (int i = 0; i < executor_config._streams_info_table.size(); i++) {
for (size_t i = 0; i < executor_config._streams_info_table.size(); i++) {
executor_config._streams += executor_config._streams_info_table[i][NUMBER_OF_STREAMS];
executor_config._threads += executor_config._streams_info_table[i][NUMBER_OF_STREAMS] *
executor_config._streams_info_table[i][THREADS_PER_STREAM];
@@ -29,7 +29,7 @@ DnnlPostOpsComposer::DnnlPostOpsComposer(const dnnl::engine& engine,
idxOC(indexOfOutputChannelDim),
isINT8(isInt8),
weightScaleMaskPerChannel(weiScaleMaskPerChannel) {
IE_ASSERT(idxOC >= 0 && idxOC < outputDims.size());
IE_ASSERT(idxOC >= 0 && static_cast<size_t>(idxOC) < outputDims.size());
OC = outputDims[idxOC];
dimsPerOC = dimsPerTensor = VectorDims(outputDims.size(), 1);
dimsPerOC[idxOC] = OC;
@@ -163,10 +163,10 @@ bool DnnlPostOpsComposer::appendScale(const std::vector<float>& scale, bool isLa
else
IE_ASSERT(wei_scale_values.size() == OC);
for (int j = 0; j < OC; j++)
for (Dim j = 0; j < OC; j++)
wei_scale_values[j] *= scale[j];
} else {
for (int j = 0; j < wei_scale_values.size(); j++)
for (size_t j = 0; j < wei_scale_values.size(); j++)
wei_scale_values[j] *= scale[0];
}
+8 -7
View File
@@ -152,9 +152,10 @@ bool Edge::enforceReorder() {
if (in_place) {
int outNumber = getOutputNum();
if (inNumber >= 0 && inNumber < parentSPD->getConfig().outConfs.size() &&
if (inNumber >= 0 && static_cast<size_t>(inNumber) < parentSPD->getConfig().outConfs.size() &&
parentSPD->getConfig().outConfs[inNumber].inPlace() >= 0 && outNumber >= 0 &&
outNumber < childSPD->getConfig().inConfs.size() && childSPD->getConfig().inConfs[outNumber].inPlace() >= 0)
static_cast<size_t>(outNumber) < childSPD->getConfig().inConfs.size() &&
childSPD->getConfig().inConfs[outNumber].inPlace() >= 0)
canBeInPlaceConflicts = true;
}
@@ -236,7 +237,7 @@ static inline bool isPhycicalMemCompatible(const MemoryDesc& lhsMemDesc, const M
if (dims.size() != flag.size())
return dims;
std::vector<size_t> ret;
for (int i = 0; i < dims.size(); i++) {
for (size_t i = 0; i < dims.size(); i++) {
if (flag[i] != 1) {
ret.push_back(dims[i]);
}
@@ -400,7 +401,7 @@ PortDescBaseCPtr Edge::getInputPortDesc() const {
if (outConfs.empty())
IE_THROW() << "Node " << parentPtr->getName() << " has empty output config list.";
if (inputIdx >= outConfs.size())
if (static_cast<size_t>(inputIdx) >= outConfs.size())
inputIdx = 0;
auto inputPortDesc = outConfs[inputIdx].getPortDesc();
@@ -425,7 +426,7 @@ PortDescBaseCPtr Edge::getOutputPortDesc() const {
if (inConfs.empty())
IE_THROW() << "Node " << childPtr->getName() << " has empty input config list.";
if (outputIdx >= inConfs.size())
if (static_cast<size_t>(outputIdx) >= inConfs.size())
outputIdx = 0;
auto outPortDesc = inConfs[outputIdx].getPortDesc();
@@ -632,9 +633,9 @@ bool Edge::inPlace(LOOK look) const {
IE_THROW() << "Cannot make a decision about reorder. Primitive descriptors weren't selected.";
int inputNum = getInputNum();
int outputNum = getOutputNum();
if (inputNum >= parentSPD->getConfig().outConfs.size())
if (inputNum >= static_cast<int>(parentSPD->getConfig().outConfs.size()))
inputNum = 0;
if (outputNum >= childSPD->getConfig().inConfs.size())
if (outputNum >= static_cast<int>(childSPD->getConfig().inConfs.size()))
outputNum = 0;
if (look & LOOK_UP) {
@@ -81,7 +81,7 @@ void jit_emitter::emitter_preamble(const std::vector<size_t> &in_idxs, const std
}
// moving mask vector at the beginning of aux vectors list to simplify further processing
for (int i = 0; i < aux_vec_idxs.size(); i++) {
for (size_t i = 0; i < aux_vec_idxs.size(); i++) {
if (aux_vec_idxs[i] == 0) {
size_t tmp = aux_vec_idxs[0];
aux_vec_idxs[0] = aux_vec_idxs[i];
@@ -115,7 +115,7 @@ void jit_load_emitter::emit_isa(const Xbyak::Reg64 &reg_src, const int out_vec_i
if (!matched_prc) {
IE_THROW() << "Load emitter in " << name_ << " only support output precision of FP32 or I32 or the same precision as input.";
}
if (load_num_ > (get_vec_length() / dst_prc_.size())) {
if (load_num_ > static_cast<int>((get_vec_length() / dst_prc_.size()))) {
IE_THROW() << "Load emitter in " << name_ << " have unexpected number of elements to load.";
}
@@ -229,7 +229,7 @@ void KernelEmitter::init_data_pointers(size_t num_inputs, size_t num_params, siz
// Note: this is an extra copy, but let's keep it for clarity
if (!layout.empty()) {
std::vector<size_t> reordered_strides(strides.size());
for (auto i = 0; i < layout.size(); i++)
for (size_t i = 0; i < layout.size(); i++)
reordered_strides[i] = strides[layout[i]];
strides = std::move(reordered_strides);
}
@@ -250,7 +250,7 @@ void KernelEmitter::init_data_pointers(size_t num_inputs, size_t num_params, siz
// master_shape size must be valid in both static and dynamic cases
std::function<void(Reg64, const std::vector<size_t>&, Reg64)> init_ptr_with_offset;
init_ptr_with_offset = [&](Reg64 pointer, const std::vector<size_t>& offsets, Reg64 reg_tmp) {
for (int j = 0; j < offset_rank; j++) {
for (size_t j = 0; j < offset_rank; j++) {
if (jcp.master_shape[j] != 1 && offsets[j] != 0) {
h->mov(reg_tmp, offsets[j]);
h->imul(reg_tmp, h->ptr[reg_indexes + j * sizeof(size_t)]);
@@ -407,7 +407,7 @@ void LoopEndEmitter::emit_impl(const std::vector<size_t>& in,
transform_idxs_to_regs(data_ptr_reg_idxs, data_ptr_regs);
Reg64 reg_work_amount = Reg64(in.back());
if (!evaluate_once) {
for (int idx = 0; idx < data_ptr_regs.size(); idx++) {
for (size_t idx = 0; idx < data_ptr_regs.size(); idx++) {
if (ptr_increments[idx] != 0)
h->add(data_ptr_regs[idx], ptr_increments[idx] * wa_increment * io_data_size[idx]);
}
@@ -416,7 +416,7 @@ void LoopEndEmitter::emit_impl(const std::vector<size_t>& in,
h->jge(loop_begin->begin_address);
}
for (int idx = 0; idx < data_ptr_regs.size(); idx++) {
for (size_t idx = 0; idx < data_ptr_regs.size(); idx++) {
if (finalization_offsets[idx] != 0)
h->add(data_ptr_regs[idx], finalization_offsets[idx] * io_data_size[idx]);
}
@@ -778,7 +778,7 @@ BrgemmEmitter::BrgemmEmitter(dnnl::impl::cpu::x64::jit_generator* h, dnnl::impl:
: m_K;
m_K_tail = m_K % m_K_blk;
size_t brg0BaseIdx = -1;
size_t brg0BaseIdx = std::numeric_limits<size_t>::max();
for (size_t m = 0; m < 2; m++) {
for (size_t k = 0; k < 2; k++) {
for (size_t n = 0; n < 2; n++) {
@@ -802,7 +802,7 @@ BrgemmEmitter::BrgemmEmitter(dnnl::impl::cpu::x64::jit_generator* h, dnnl::impl:
// don't create brgemm kernels for empty tiles
if (M_ != 0 && K_ != 0 && N_ != 0) {
if (brg0BaseIdx == -1)
if (brg0BaseIdx == std::numeric_limits<size_t>::max())
brg0BaseIdx = getBrgIdx(m, k, n);
initBrgemm(brgemmCtx, m_brgKernels0[getBrgIdx(m, k, n)], brgWithAMX);
}
+13 -12
View File
@@ -170,7 +170,7 @@ void Graph::Replicate(const std::shared_ptr<const ov::Model> &subgraph) {
ngraph::op::v0::Result::get_type_info_static(),
ngraph::op::v3::Assign::get_type_info_static(),
ngraph::op::v6::Assign::get_type_info_static())) {
for (int oi = 0; oi < op->get_output_size(); oi++) {
for (size_t oi = 0; oi < op->get_output_size(); oi++) {
if (op->get_output_target_inputs(oi).empty()) {
unusedOutputs.push_back(op->output(oi));
}
@@ -269,7 +269,7 @@ void Graph::Replicate(const CNNNetwork &network) {
ngraph::op::v0::Result::get_type_info_static(),
ngraph::op::v3::Assign::get_type_info_static(),
ngraph::op::v6::Assign::get_type_info_static())) {
for (int oi = 0; oi < op->get_output_size(); oi++) {
for (size_t oi = 0; oi < op->get_output_size(); oi++) {
if (op->get_output_target_inputs(oi).empty()) {
unusedOutputs.push_back(op->output(oi));
}
@@ -560,7 +560,7 @@ static bool isReorderAvailable(const MemoryDescPtr& parentDesc, const MemoryDesc
void Graph::InitEdges() {
OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::intel_cpu_LT, "Graph::InitEdges");
size_t numberOfEdges = graphEdges.size();
ptrdiff_t numberOfEdges = static_cast<ptrdiff_t>(graphEdges.size());
std::unordered_set<std::string> uniqueLayerNames;
for (auto node : graphNodes) {
@@ -583,13 +583,13 @@ void Graph::InitEdges() {
InsertReorder(edge, layerName, edge->getInputDesc(), edge->getOutputDesc(), isOptimized);
};
auto updateEdge = [&](int& i) {
auto updateEdge = [&](ptrdiff_t& i) {
graphEdges.erase(graphEdges.begin() + i);
i--;
numberOfEdges--;
};
for (auto i = 0; i < numberOfEdges; i++) {
for (ptrdiff_t i = 0; i < numberOfEdges; i++) {
auto edge = graphEdges[i];
auto reorderStatus = graphEdges[i]->needReorder();
DEBUG_LOG(graphEdges[i]->name(), " reorderStatus = ", reorderStatus);
@@ -712,8 +712,8 @@ void Graph::AllocateWithReuse() {
std::vector<MemorySolver::Box> definedBoxes;
std::vector<MemorySolver::Box> undefinedBoxes;
for (int i = 0; i < edge_clusters.size(); i++) {
MemorySolver::Box box = { std::numeric_limits<int>::max(), 0, 0, i };
for (size_t i = 0; i < edge_clusters.size(); i++) {
MemorySolver::Box box = {std::numeric_limits<int>::max(), 0, 0, static_cast<int64_t>(i)};
int64_t boxSize = 0;
for (auto &edge : edge_clusters[i]) {
int e_start = edge->getParent()->execIndex;
@@ -1296,7 +1296,7 @@ void Graph::SortTopologically() {
std::vector<NodePtr> unsorted;
std::vector<NodePtr> sorted;
for (int i = 0; i < graphNodes.size(); i++) {
for (size_t i = 0; i < graphNodes.size(); i++) {
NodePtr node = graphNodes[i];
node->permanent = false;
@@ -1312,7 +1312,8 @@ void Graph::SortTopologically() {
VisitNode(node, sorted);
}
for (int i = 0; i < sorted.size(); i++) sorted[i]->execIndex = i;
for (size_t i = 0; i < sorted.size(); i++)
sorted[i]->execIndex = static_cast<int>(i);
graphNodes.erase(graphNodes.begin(), graphNodes.end());
graphNodes.assign(sorted.begin(), sorted.end());
@@ -1328,7 +1329,7 @@ void Graph::SortTopologically() {
int port_num = node->inputShapes.size();
std::vector<EdgePtr> res(port_num);
for (int i = 0; i < node->parentEdges.size(); i++) {
for (size_t i = 0; i < node->parentEdges.size(); i++) {
auto edge = node->getParentEdgeAt(i);
int port = edge->getOutputNum();
if (port < port_num && !res[port])
@@ -1342,7 +1343,7 @@ void Graph::SortTopologically() {
int port_num = node->outputShapes.size();
std::vector<EdgePtr> res(port_num);
for (int i = 0; i < node->childEdges.size(); i++) {
for (size_t i = 0; i < node->childEdges.size(); i++) {
auto edge = node->getChildEdgeAt(i);
int port = edge->getInputNum();
if (port < port_num && !res[port])
@@ -1380,7 +1381,7 @@ void Graph::GetPerfData(std::map<std::string, InferenceEngine::InferenceEnginePr
}
};
for (int i = 0; i < graphNodes.size(); i++) {
for (size_t i = 0; i < graphNodes.size(); i++) {
if (graphNodes[i]->isConstant())
continue;
getPerfMapFor(perfMap, graphNodes[i]);
+1 -1
View File
@@ -124,7 +124,7 @@ std::shared_ptr<ngraph::Function> dump_graph_as_ie_ngraph_net(const Graph &graph
auto pr_edges = node->getParentEdges();
ngraph::OutputVector inputs(pr_edges.size());
for (int i = 0; i < pr_edges.size(); i++) {
for (size_t i = 0; i < pr_edges.size(); i++) {
auto edge = node->getParentEdgeAt(i);
int pr_port = edge->getInputNum();
int ch_port = edge->getOutputNum();
+5 -2
View File
@@ -824,8 +824,11 @@ InferenceEngine::Blob::Ptr InferRequest::GetBlob(const std::string& name) {
// but in dynamic shape case we also need to handle following corner case:
// on blob initialization stage we create empty blob with dimensions equal 0
// so if we have blob with all zero dimension we mustn't throw exception
if (!shape.compatible(ov::PartialShape(blobDims)) && (!isDynamic || blobDims.size() != shape.rank().get_length() ||
std::any_of(blobDims.begin(), blobDims.end(), [](const size_t& dims) { return dims != 0; } ))) {
if (!shape.compatible(ov::PartialShape(blobDims)) &&
(!isDynamic || static_cast<int64_t>(blobDims.size()) != shape.rank().get_length() ||
std::any_of(blobDims.begin(), blobDims.end(), [](const size_t& dims) {
return dims != 0;
}))) {
IE_THROW(ParameterMismatch) << "Network input and output use the same name: " << name
<< ", but expect blobs with different shapes. Input shape: "
<< ov::PartialShape(blobDims) << ", output shape: " << shape;
@@ -131,7 +131,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(InferenceEngine::Precision prc, con
}
bool is_descending_strides = true;
for (int i = 1; i < strides.size(); i++) {
for (size_t i = 1; i < strides.size(); i++) {
is_descending_strides &= (strides[i - 1] >= strides[i]);
}
@@ -143,7 +143,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(InferenceEngine::Precision prc, con
if (!strides.empty() && !emptyDesc && std::none_of(strides.begin(), strides.end(), [](size_t x) { return Shape::UNDEFINED_DIM == x; })) {
bool inner_block_are_dense = one_of(strides.back(), 0u, 1u); // stride 1 - is dense case, 0 - broad casted
for (int i = outer_ndims; i < strides.size() - 1; i++) {
for (size_t i = outer_ndims; i < strides.size() - 1; i++) {
inner_block_are_dense &= (strides[i] == strides[i + 1] * blockedDims[i + 1]);
}
@@ -303,7 +303,7 @@ static VectorDims extractOrder(const dnnl::memory::desc& desc) {
// total inner block size. in case of 4i16o4i will be {16, 16, 1, 1}
VectorDims total_block_per_dim(outer_ndims, 1);
for (int i = 0; i < inner_ndims; i++) {
for (size_t i = 0; i < inner_ndims; i++) {
total_block_per_dim[blk_desc.inner_idxs[i]] *= blk_desc.inner_blks[i];
}
VectorDims outer_block_dims(std::begin(dims), std::begin(dims) + outer_ndims);
@@ -390,8 +390,8 @@ bool DnnlBlockedMemoryDesc::isBlockedCFormat(size_t blk_size) const {
return false;
}
}
if (blk_size != UNREACHABLE_DIM && blk_size != desc.get_inner_blks()[0]) {
return false;
if (blk_size != UNREACHABLE_DIM && static_cast<int64_t>(blk_size) != desc.get_inner_blks()[0]) {
return false;
}
return true;
@@ -479,11 +479,11 @@ bool DnnlBlockedMemoryDesc::isSame(dnnl::memory::format_tag fmt) const {
if (desc.get_inner_nblks() != refBlkDesc.inner_nblks)
return false;
for (size_t i = 0; i < actualBlkDesc.inner_nblks; ++i)
for (int i = 0; i < actualBlkDesc.inner_nblks; ++i)
if (actualBlkDesc.inner_blks[i] != refBlkDesc.inner_blks[i])
return false;
for (size_t i = 0; i < actualBlkDesc.inner_nblks; ++i)
for (int i = 0; i < actualBlkDesc.inner_nblks; ++i)
if (actualBlkDesc.inner_idxs[i] != refBlkDesc.inner_idxs[i])
return false;
+7 -7
View File
@@ -300,7 +300,7 @@ void Node::selectPreferPrimitiveDescriptor(const std::vector<impl_desc_type>& pr
if (parent_spd != nullptr && !parent_spd->getConfig().outConfs.empty()) {
int inNum = parentEdge->getInputNum();
if (inNum < 0 || inNum >= parent_spd->getConfig().outConfs.size()) {
if (inNum < 0 || inNum >= static_cast<int>(parent_spd->getConfig().outConfs.size())) {
inNum = 0;
}
auto curDesc = supportedPrimitiveDesc.getConfig().inConfs[j].getMemDesc();
@@ -514,7 +514,7 @@ const std::vector<EdgePtr> Node::getParentEdgesAtPort(size_t idx) const {
auto edge = edge_w.lock();
if (!edge)
IE_THROW() << "Node " << getName() << " contains dead weak ptr";
if (edge->getOutputNum() == idx) res.push_back(edge);
if (edge->getOutputNum() == static_cast<int>(idx)) res.push_back(edge);
}
return res;
}
@@ -528,7 +528,7 @@ const std::vector<EdgePtr> Node::getChildEdgesAtPort(size_t idx) const {
auto edge = edge_w.lock();
if (!edge)
IE_THROW() << "Node " << getName() << " contains dead weak ptr";
if (edge->getInputNum() == idx) res.push_back(edge);
if (edge->getInputNum() == static_cast<int>(idx)) res.push_back(edge);
}
return res;
}
@@ -679,7 +679,7 @@ void Node::filterSupportedPrimitiveDescriptors() {
if (inputMemoryFormatsFilter.size() > config.inConfs.size() || outputMemoryFormatsFilter.size() > config.outConfs.size())
IE_THROW() << "Incorrect number of input or output memory formats";
for (int i = 0; i < inputMemoryFormatsFilter.size(); i++) {
for (size_t i = 0; i < inputMemoryFormatsFilter.size(); i++) {
if (!areCompatible(*config.inConfs[i].getMemDesc(), inputMemoryFormatsFilter[i])) {
DEBUG_LOG(getName(), " input memory format filter: ", inputMemoryFormatsFilter[i],
" not matched. Erase desc from supported primitive descriptors: ", desc);
@@ -687,7 +687,7 @@ void Node::filterSupportedPrimitiveDescriptors() {
}
}
for (int i = 0; i < outputMemoryFormatsFilter.size(); i++) {
for (size_t i = 0; i < outputMemoryFormatsFilter.size(); i++) {
if (!areCompatible(*config.outConfs[i].getMemDesc(), outputMemoryFormatsFilter[i])) {
DEBUG_LOG(getName(), " Output memory format filter: ", outputMemoryFormatsFilter[i],
" not matched. Erase desc from supported primitive descriptors: ", desc);
@@ -1025,7 +1025,7 @@ PortDescBasePtr Node::getConsistentInputDesc(const NodeConfig &config, size_t id
auto inplaceIndx = static_cast<size_t>(inConf.inPlace());
PortDescBasePtr outPortDesc;
const auto& outConf = config.outConfs[inplaceIndx];
if (outConf.inPlace() == idx) { // the input desc port is the same port used for inplace output
if (outConf.inPlace() == static_cast<int>(idx)) { // the input desc port is the same port used for inplace output
outPortDesc = outConf.getPortDesc(); // just use desc from this output port
} else {
outPortDesc = getConsistentOutputDesc(config, inplaceIndx); // get consistent desc otherwise
@@ -1065,7 +1065,7 @@ PortDescBasePtr Node::getConsistentOutputDesc(const NodeConfig &config, size_t i
auto inplaceIndx = static_cast<size_t>(outConf.inPlace());
PortDescBasePtr inpPortDesc;
const auto& inpConf = config.inConfs[inplaceIndx];
if (inpConf.inPlace() == idx) { // the input desc port is the same port used for inplace output
if (inpConf.inPlace() == static_cast<int>(idx)) { // the input desc port is the same port used for inplace output
inpPortDesc = inpConf.getPortDesc(); // just use desc from this output port
} else {
inpPortDesc = getConsistentInputDesc(config, inplaceIndx); // get consistent desc otherwise
@@ -140,8 +140,8 @@ void AdaptivePooling::getSupportedDescriptors() {
bool AdaptivePooling::needShapeInfer() const {
const auto newSpatialDimsPtr = reinterpret_cast<int32_t *>(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr());
for (size_t i = 0; i < spatialDimsCount; i++) {
if (spatialDimsValue[i] != newSpatialDimsPtr[i]) {
for (int i = 0; i < spatialDimsCount; i++) {
if (static_cast<int32_t>(spatialDimsValue[i]) != newSpatialDimsPtr[i]) {
for (size_t j = 0; j < spatialDimsValue.size(); j++) {
spatialDimsValue[j] = newSpatialDimsPtr[j];
}
@@ -211,7 +211,7 @@ void AdaptivePooling::execute(dnnl::stream strm) {
const auto *srcPooledSpatialShapes = reinterpret_cast<const int *>(getParentEdgeAt(1)->getMemoryPtr()->GetPtr());
auto *dst = reinterpret_cast<float *>(getChildEdgeAt(0)->getMemoryPtr()->GetPtr());
if (srcMemory1.GetShape().getElementsCount() != spatialDimsCount)
if (static_cast<int>(srcMemory1.GetShape().getElementsCount()) != spatialDimsCount)
IE_THROW() << errorPrefix << "has input spatial dimension (" << srcMemory1.GetShape().getElementsCount()
<< ") inconsistent with pooling vector size (" << spatialDimsCount << ")";
+7 -7
View File
@@ -905,10 +905,10 @@ BinaryConvolution::BinaryConvolution(const std::shared_ptr<ngraph::Node>& op, co
const auto binConv = std::dynamic_pointer_cast<const ngraph::opset1::BinaryConvolution>(op);
pad_value = binConv->get_pad_value();
for (int i = 0; i < binConv->get_strides().size(); i++) {
for (size_t i = 0; i < binConv->get_strides().size(); i++) {
stride.push_back(static_cast<ptrdiff_t>(binConv->get_strides()[i]));
}
for (int i = 0; i < binConv->get_dilations().size(); i++) {
for (size_t i = 0; i < binConv->get_dilations().size(); i++) {
dilation.push_back(static_cast<ptrdiff_t>(binConv->get_dilations()[i]) - 1);
}
paddingL = binConv->get_pads_begin();
@@ -934,8 +934,8 @@ void BinaryConvolution::getSupportedDescriptors() {
withBinarization = isFusedWith(Type::FakeQuantize);
withSum = false;
int expectedInputEdgesNum = 2;
for (int i = 0; i < fusedWith.size(); i++) {
size_t expectedInputEdgesNum = 2;
for (size_t i = 0; i < fusedWith.size(); i++) {
auto *eltwiseNode = dynamic_cast<Eltwise *>(fusedWith[i].get());
if (eltwiseNode && eltwiseNode->isSpecialConvolutionAddFusing()) {
withSum = true;
@@ -1308,19 +1308,19 @@ void BinaryConvolution::execute(dnnl::stream strm) {
auto srcDesc = getParentEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
std::vector<size_t> srcStride(srcDesc->getStrides().size());
for (int i = 0; i < srcStride.size(); i++) {
for (size_t i = 0; i < srcStride.size(); i++) {
srcStride[srcDesc->getOrder()[i]] = srcDesc->getStrides()[i];
}
auto weiDesc = getParentEdgeAt(1)->getMemory().GetDescWithType<BlockedMemoryDesc>();
std::vector<size_t> weightsStride(weiDesc->getShape().getRank());
for (int i = 0; i < weightsStride.size(); i++) {
for (size_t i = 0; i < weightsStride.size(); i++) {
weightsStride[weiDesc->getOrder()[i]] = weiDesc->getStrides()[i];
}
auto dstDesc = getChildEdgeAt(0)->getMemory().GetDescWithType<BlockedMemoryDesc>();
std::vector<size_t> dstStride(dstDesc->getStrides().size());
for (int i = 0; i < dstStride.size(); i++) {
for (size_t i = 0; i < dstStride.size(); i++) {
dstStride[dstDesc->getOrder()[i]] = dstDesc->getStrides()[i];
}
@@ -331,7 +331,7 @@ void RefConverter::convert(const T* y,
auto y_ptr = y + batch * stride_y;
auto uv_ptr = uv + batch * stride_uv;
for (int w = 0; w < width; w++) {
for (size_t w = 0; w < width; w++) {
auto y_index = h * width + w;
auto y_val = static_cast<float>(y_ptr[y_index]);
auto uv_index = (h / 2) * width + (w / 2) * 2;
@@ -684,7 +684,7 @@ void RefConverter::convert(const T* y,
auto u_ptr = u + batch * stride_uv;
auto v_ptr = v + batch * stride_uv;
for (int w = 0; w < width; w++) {
for (size_t w = 0; w < width; w++) {
auto y_index = h * width + w;
auto y_val = static_cast<float>(y_ptr[y_index]);
auto uv_index = (h / 2) * (width / 2) + w / 2;
@@ -77,7 +77,7 @@ struct jit_uni_permute_kernel_f32 : public jit_uni_permute_kernel, public jit_ge
Xbyak::Label tail_loop_label;
Xbyak::Label exit_label;
if (n + 1 == jcp.ndims) {
if (n + 1 == static_cast<int>(jcp.ndims)) {
if (jcp.src_strides[n] == 1 && jcp.dst_strides[n] == 1) {
uint32_t step = vlen / jcp.data_size;
@@ -102,7 +102,7 @@ struct jit_uni_permute_kernel_f32 : public jit_uni_permute_kernel, public jit_ge
cmp(reg_work_amount, 0);
je(exit_label, T_NEAR);
if (n + 1 == jcp.ndims) {
if (n + 1 == static_cast<int>(jcp.ndims)) {
load(xmm, ptr[reg_src]);
store(ptr[reg_dst], xmm);
} else {
@@ -207,7 +207,7 @@ void PermuteKernel::prepareParams() {
int batch_count = 0;
int batch_pos = 0;
for (size_t i = 0; i < new_dst_block_order.size(); i++) {
if (new_dst_block_order[i] == batch_ord) {
if (static_cast<int>(new_dst_block_order[i]) == batch_ord) {
batch_count++;
batch_pos = i;
}
@@ -224,7 +224,7 @@ void PermuteKernel::prepareParams() {
for (size_t i = 0; i < mask.size(); i++) {
if (mask[i] == 0) {
n2++;
if (batch_count == 1 && new_dst_block_order[i] == batch_ord) {
if (batch_count == 1 && static_cast<int>(new_dst_block_order[i]) == batch_ord) {
continue;
}
sorted_src_strides.push_back(new_src_block_strides[i]);
@@ -299,7 +299,7 @@ void PermuteKernel::optimizedExecute(const uint8_t* src_data, uint8_t* dst_data,
const SizeVector dst_strides = jcp.dst_strides;
const SizeVector src_strides = jcp.src_strides;
if (dst_dims[0] != mb)
if (static_cast<int>(dst_dims[0]) != mb)
dst_dims[0] = mb;
switch (jcp.n) {
@@ -368,7 +368,7 @@ void PermuteKernel::referenceExecute(const uint8_t* src_data, uint8_t* dst_data,
const size_t data_size = jcp.data_size;
const size_t ndims = dst_dims.size();
if (dst_dims[0] != mb)
if (static_cast<int>(dst_dims[0]) != mb)
dst_dims[0] = mb;
size_t work_amount = std::accumulate(dst_dims.begin(), dst_dims.end(), 1, std::multiplies<size_t>());
@@ -31,14 +31,14 @@ void TileBroadcastCommon::fillOptimizedDimsAndSrcStrides(const VectorDims& srcBl
optimizedSrcStrides.clear();
VectorDims srcBlockedStrides = calculateDenseStrides(srcBlockedDims);
for (int i = 0; i < srcBlockedDims.size(); i++) {
for (size_t i = 0; i < srcBlockedDims.size(); i++) {
optimizedDims.push_back(blockedRepeats[i]);
optimizedDims.push_back(srcBlockedDims[i]);
optimizedSrcStrides.push_back(0);
optimizedSrcStrides.push_back(srcBlockedStrides[i]);
}
int i = 1;
size_t i = 1;
while (i < optimizedDims.size() - 1) {
if (optimizedDims[i] == 1) {
optimizedDims[i + 1] *= optimizedDims[i - 1];
@@ -120,7 +120,7 @@ std::vector<NodeDesc> TileBroadcastCommon::getSupportedConfigs(const Node *node)
auto pushDesc = [&](dnnl::memory::format_tag inFormat, dnnl::memory::format_tag outFormat) {
config.inConfs[0].setMemDesc(std::make_shared<DnnlBlockedMemoryDesc>(node->getInputShapeAtPort(0), dataType, inFormat));
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
config.outConfs[i].inPlace(-1);
config.outConfs[i].constant(false);
config.outConfs[i].setMemDesc(std::make_shared<DnnlBlockedMemoryDesc>(node->getOutputShapeAtPort(0), dataType, outFormat));
@@ -156,7 +156,7 @@ std::vector<NodeDesc> TileBroadcastCommon::getSupportedConfigs(const Node *node)
auto outFmt = DnnlExtensionUtils::GetPlainFormatByRank(outDataShapeRank);
if (inFmt == dnnl::memory::format_tag::undef || outFmt == dnnl::memory::format_tag::undef) {
config.inConfs[0].setMemDesc(std::make_shared<CpuBlockedMemoryDesc>(precision, node->getInputShapeAtPort(0)));
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
config.outConfs[i].inPlace(-1);
config.outConfs[i].constant(false);
config.outConfs[i].setMemDesc(std::make_shared<CpuBlockedMemoryDesc>(precision, node->getOutputShapeAtPort(i)));
@@ -180,7 +180,7 @@ bool TileBroadcastCommon::prepareOptimizedParams(const Node *node, VectorDims& s
blockedRepeats.push_back(1);
}
// for NSPC layouts
if (node->getBaseMemDescAtInputPort(0)->hasLayoutType(LayoutType::nspc) && one_of(node->getBaseMemDescAtInputPort(0)->getShape().getRank(), 4, 5)) {
if (node->getBaseMemDescAtInputPort(0)->hasLayoutType(LayoutType::nspc) && one_of(node->getBaseMemDescAtInputPort(0)->getShape().getRank(), 4u, 5u)) {
blockedRepeats.push_back(blockedRepeats[1]);
blockedRepeats.erase(blockedRepeats.begin() + 1);
}
@@ -200,7 +200,7 @@ bool TileBroadcastCommon::prepareOptimizedParams(const Node *node, VectorDims& s
VectorDims optimizedDstStrides = calculateDenseStrides(optimizedDims);
size_t dataSize = node->getSelectedPrimitiveDescriptor()->getConfig().inConfs[0].getMemDesc()->getPrecision().size();
for (int i = 0; i < optimizedDims.size(); i++) {
for (size_t i = 0; i < optimizedDims.size(); i++) {
optimizedSrcStrides[i] *= dataSize;
optimizedDstStrides[i] *= dataSize;
}
@@ -277,7 +277,7 @@ void TileBroadcastCommon::optimizedExecute(const MemoryPtr& srcMemory, const Mem
auto dstData2 = dstData + (i0 * optimizedParams.dstStrides[0] + i1 * optimizedParams.dstStrides[1] +
i2 * optimizedParams.dstStrides[2] + i3 * optimizedParams.dstStrides[3] +
i4 * optimizedParams.dstStrides[4]);
for (int i = 0; i < optimizedParams.dims[5]; i++) {
for (size_t i = 0; i < optimizedParams.dims[5]; i++) {
cpu_memcpy(dstData2 + i * optimizedParams.dstStrides[5], srcData2, optimizedParams.dstStrides[5]);
}
});
+7 -7
View File
@@ -102,7 +102,7 @@ void Concat::initSupportedPrimitiveDescriptors() {
auto& originInputPrecisions = getOriginalInputPrecisions();
inputPrecision = originInputPrecisions[0];
bool isMixedPrecision = false;
for (int i = 1; i < inputShapes.size(); i++) {
for (size_t i = 1; i < inputShapes.size(); i++) {
if (originInputPrecisions[0] != originInputPrecisions[i]) {
isMixedPrecision = true;
break;
@@ -230,8 +230,8 @@ void Concat::selectOptimalPrimitiveDescriptor() {
// The double connection marks that some tensor should
// be replicated. Inplace approach is not applicable
// for that case.
for (int i = 0; i < getParentEdges().size(); i++) {
for (int j = i + 1; j < getParentEdges().size(); j++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
for (size_t j = i + 1; j < getParentEdges().size(); j++) {
if (getParentEdgeAt(i) == getParentEdgeAt(j)) canBeInPlace = false;
}
}
@@ -248,7 +248,7 @@ void Concat::selectOptimalPrimitiveDescriptor() {
const auto &parent_config = parent_pdesc->getConfig();
int outputIndex = parentEdge->getInputNum();
if (outputIndex < 0 || outputIndex >= parent_config.outConfs.size())
if (outputIndex < 0 || outputIndex >= static_cast<int>(parent_config.outConfs.size()))
IE_THROW() << "Cannot find index of output node";
const auto &port_desc = parent_config.outConfs[outputIndex].getMemDesc();
for (auto& item : supportedLayouts) {
@@ -266,7 +266,7 @@ void Concat::selectOptimalPrimitiveDescriptor() {
const auto &config = prim_desc->getConfig();
int inputIndex = childEdge->getOutputNum();
if (inputIndex < 0 || inputIndex >= config.inConfs.size())
if (inputIndex < 0 || inputIndex >= static_cast<int>(config.inConfs.size()))
IE_THROW() << "Cannot find index of output node";
const auto &port_desc = config.inConfs[inputIndex].getMemDesc();
for (auto& item : supportedLayouts) {
@@ -563,7 +563,7 @@ void Concat::execute(dnnl::stream strm) {
const size_t num_src = getParentEdges().size();
std::unordered_map<int, memory> mem_ags {{DNNL_ARG_DST, dst_memory.GetPrimitive()}};
size_t nonZeroInShapes = 0;
for (int i = 0; i < num_src; i++) {
for (size_t i = 0; i < num_src; i++) {
const auto& srcMem = getParentEdgesAtPort(i)[0]->getMemory();
if (srcMem.GetShape().hasZeroDims()) {
continue;
@@ -615,7 +615,7 @@ void Concat::execNspcSpecCase() {
parallel_for(iter_count, [&](int i) {
const size_t dst_off = i * channels_size;
for (int j = 0; j < nonZeroInShapes; j++) {
for (size_t j = 0; j < nonZeroInShapes; j++) {
cpu_memcpy(dst_ptrs[j] + dst_off, src_ptrs[j] + i * channelsDataSize[j], channelsDataSize[j]);
}
});
+13 -13
View File
@@ -259,10 +259,10 @@ Convolution::Convolution(const std::shared_ptr<ngraph::Node>& op, const GraphCon
biasesDims = { groupOC };
for (int i = 0; i < convolutionOp->get_strides().size(); i++) {
for (size_t i = 0; i < convolutionOp->get_strides().size(); i++) {
stride.push_back(convolutionOp->get_strides()[i]);
}
for (int i = 0; i < convolutionOp->get_dilations().size(); i++) {
for (size_t i = 0; i < convolutionOp->get_dilations().size(); i++) {
dilation.push_back(static_cast<ptrdiff_t>(convolutionOp->get_dilations()[i]) - 1);
}
paddingL = convolutionOp->get_pads_begin();
@@ -282,10 +282,10 @@ Convolution::Convolution(const std::shared_ptr<ngraph::Node>& op, const GraphCon
biasesDims = {groupOC * groupNum};
for (int i = 0; i < groupConvolutionOp->get_strides().size(); i++) {
for (size_t i = 0; i < groupConvolutionOp->get_strides().size(); i++) {
stride.push_back(groupConvolutionOp->get_strides()[i]);
}
for (int i = 0; i < groupConvolutionOp->get_dilations().size(); i++) {
for (size_t i = 0; i < groupConvolutionOp->get_dilations().size(); i++) {
dilation.push_back(static_cast<ptrdiff_t>(groupConvolutionOp->get_dilations()[i]) - 1);
}
paddingL = groupConvolutionOp->get_pads_begin();
@@ -391,7 +391,7 @@ void Convolution::getSupportedDescriptors() {
}
int expectedInputEdgesNum = static_cast<int>(getOriginalInputsNumber());
for (int i = 0; i < fusedWith.size(); i++) {
for (size_t i = 0; i < fusedWith.size(); i++) {
if (fusedWith[i]->getType() == Type::Convolution) {
expectedInputEdgesNum += static_cast<int>(fusedWith[i]->getOriginalInputsNumber()) - 1;
}
@@ -418,7 +418,7 @@ void Convolution::getSupportedDescriptors() {
// We need to make sure that convolution output and second input of fused Eltwise operation
// have equal precision sizes since they use the same physical memory. In case precisions are different we upscale to FP32.
if (outputDataType != memory::data_type::f32 && outputDataType != memory::data_type::bf16 && withSum) {
for (int i = 0; i < fusedWith.size(); i++) {
for (size_t i = 0; i < fusedWith.size(); i++) {
if (fusedWith[i]->getAlgorithm() == Algorithm::EltwiseAdd) {
auto* eltwiseNode = dynamic_cast<Eltwise *>(fusedWith[i].get());
if (eltwiseNode && eltwiseNode->isSpecialConvolutionAddFusing()) {
@@ -433,7 +433,7 @@ void Convolution::getSupportedDescriptors() {
}
}
if (getParentEdges().size() != expectedInputEdgesNum)
if (static_cast<int>(getParentEdges().size()) != expectedInputEdgesNum)
IE_THROW() << "Incorrect number of input edges for layer " << getName() << ", expected: " << expectedInputEdgesNum
<< " actual: " << getParentEdges().size();
if (getChildEdges().empty())
@@ -446,7 +446,7 @@ void Convolution::getSupportedDescriptors() {
IE_THROW() << "DW convolution is fused into convolution node " << getName() << " with dynamic shape.";
}
for (int i = 0; i < fusedWith.size(); i++) {
for (size_t i = 0; i < fusedWith.size(); i++) {
auto *convolutionNode = dynamic_cast<Convolution *>(fusedWith[i].get());
if (convolutionNode) {
auto& inActivationDims = convolutionNode->inputShapes[0].getStaticDims();
@@ -471,7 +471,7 @@ void Convolution::getSupportedDescriptors() {
dw_conv_in_dt = memory::data_type::f32;
}
for (int j = 0; j < paddingR.size(); j++) {
for (size_t j = 0; j < paddingR.size(); j++) {
int with_group = isGrouped ? 1 : 0;
int krn = weightDims[with_group + 2 + j];
int src = getInputShapeAtPort(0).getStaticDims()[2 + j];
@@ -506,7 +506,7 @@ void Convolution::getSupportedDescriptors() {
outputDataType = (getOriginalOutputPrecisionAtPort(0) == Precision::BF16
&& !(isDepthWise() && ndims == 5)) ? memory::data_type::bf16 : memory::data_type::f32;
eltwisePrecision = Precision::FP32;
for (int i = 0; i < fusedWith.size(); i++) {
for (size_t i = 0; i < fusedWith.size(); i++) {
if (fusedWith[i]->getAlgorithm() == Algorithm::EltwiseAdd) {
auto* eltwiseNode = dynamic_cast<Eltwise *>(fusedWith[i].get());
if (eltwiseNode && eltwiseNode->isSpecialConvolutionAddFusing()) {
@@ -601,7 +601,7 @@ void Convolution::setPostOps(dnnl::primitive_attr& attr,
DEBUG_LOG(getName(), " useLegacyPostOps=", useLegacyPostOps, " initWeights=", initWeights);
for (int i = 0; i < fusedWith.size(); ++i) {
for (size_t i = 0; i < fusedWith.size(); ++i) {
auto& node = fusedWith[i];
bool isLastPostOp = (i == (fusedWith.size() - 1));
@@ -639,7 +639,7 @@ void Convolution::setPostOps(dnnl::primitive_attr& attr,
if (i == 0) {
bool hasSubsequentSum = false;
bool hasSubsequentFQ = false;
for (int j = i + 1; j < fusedWith.size(); j++) {
for (size_t j = i + 1; j < fusedWith.size(); j++) {
auto &nextNode = fusedWith[j];
auto *nextEltwiseNode = dynamic_cast<Eltwise *>(nextNode.get());
@@ -1636,7 +1636,7 @@ void Convolution::initializeInputZeroPoints(const uint8_t* inputZpData, const si
IE_THROW() << "input zero point is not empty '" << getName() << "'";
if (inputZpSize)
inputZeroPointType = zpType::PerTensor;
for (int j = 0; j < inputZpSize; j++) {
for (size_t j = 0; j < inputZpSize; j++) {
legacyInputZeroPoints.push_back(inputZpData[j]);
if (inputZpData[j] != inputZpData[0])
inputZeroPointType = zpType::PerChannel;
@@ -65,7 +65,7 @@ void CTCGreedyDecoderSeqLen::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
for (int i = 1; i < inputShapes.size(); ++i)
for (size_t i = 1; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::I32);
addSupportedPrimDesc(inDataConf,
@@ -91,7 +91,7 @@ void CTCGreedyDecoderSeqLen::execute(dnnl::stream strm) {
size_t workAmount = 0;
for (size_t b = 0; b < B; b++) {
if (sequenceLengths[b] > T) {
if (sequenceLengths[b] > static_cast<int>(T)) {
std::string errorMsg = errorPrefix
+ ". Sequence length " + std::to_string(sequenceLengths[b])
+ " cannot be greater than according decoded classes dimension size "
+3 -2
View File
@@ -52,7 +52,7 @@ void CTCLoss::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
for (int i = 1; i < inputShapes.size(); ++i)
for (size_t i = 1; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::I32);
addSupportedPrimDesc(inDataConf,
@@ -95,7 +95,8 @@ void CTCLoss::execute(dnnl::stream strm) {
return;
for (size_t b = start; b < end; b++) {
if (logitsLength[b] < 0 || labelsLength[b] < 0 || logitsLength[b] > maxTime || labelsLength[b] > logitsLength[b]) {
if (logitsLength[b] < 0 || labelsLength[b] < 0 || logitsLength[b] > static_cast<int>(maxTime) ||
labelsLength[b] > logitsLength[b]) {
errorMsgB[ithr] = errorPrefix + ". Logit length cannot be greater than max sequence length. "
+ "Label length cannot be greater than a logit length"
+ " and both cannot be negative.\nMaxSeqLen: "
+1 -1
View File
@@ -84,7 +84,7 @@ void CumSum::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
inDataConf.emplace_back(LayoutType::ncsp, dataPrecision);
for (int i = 1; i < inputShapes.size(); ++i)
for (size_t i = 1; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::I32);
addSupportedPrimDesc(inDataConf,
+11 -11
View File
@@ -174,10 +174,10 @@ Deconvolution::Deconvolution(const std::shared_ptr<ngraph::Node>& op,
groupNum = 1;
withGroups = false;
for (int i = 0; i < convBackprop->get_strides().size(); i++) {
for (size_t i = 0; i < convBackprop->get_strides().size(); i++) {
stride.push_back(static_cast<ptrdiff_t>(convBackprop->get_strides()[i]));
}
for (int i = 0; i < convBackprop->get_dilations().size(); i++) {
for (size_t i = 0; i < convBackprop->get_dilations().size(); i++) {
dilation.push_back(static_cast<ptrdiff_t>(convBackprop->get_dilations()[i]) - 1);
}
paddingL = convBackprop->get_pads_begin();
@@ -196,10 +196,10 @@ Deconvolution::Deconvolution(const std::shared_ptr<ngraph::Node>& op,
withGroups = groupNum > 1;
isDW = withGroups && groupNum == OC && groupNum == IC;
for (int i = 0; i < groupConvBackprop->get_strides().size(); i++) {
for (size_t i = 0; i < groupConvBackprop->get_strides().size(); i++) {
stride.push_back(static_cast<ptrdiff_t>(groupConvBackprop->get_strides()[i]));
}
for (int i = 0; i < groupConvBackprop->get_dilations().size(); i++) {
for (size_t i = 0; i < groupConvBackprop->get_dilations().size(); i++) {
dilation.push_back(static_cast<ptrdiff_t>(groupConvBackprop->get_dilations()[i]) - 1);
}
paddingL = groupConvBackprop->get_pads_begin();
@@ -209,7 +209,7 @@ Deconvolution::Deconvolution(const std::shared_ptr<ngraph::Node>& op,
autoPad = one_of(groupConvBackprop->get_auto_pad(), ov::op::PadType::SAME_LOWER, ov::op::PadType::SAME_UPPER);
}
for (int i = 0; i < dilation.size(); i++) {
for (size_t i = 0; i < dilation.size(); i++) {
kernel.push_back(weightDims[withGroups + 2 + i]);
}
@@ -252,7 +252,7 @@ InferenceEngine::Blob::Ptr Deconvolution::createWeiBlobAsIO(InferenceEngine::Siz
} else {
orderForBlockedDesc = {1, 0};
}
for (int i = 2 + withGroups; i < dimsForBlockedDesc.size(); i++)
for (size_t i = 2 + withGroups; i < dimsForBlockedDesc.size(); i++)
orderForBlockedDesc.push_back(i);
BlockingDesc blkDesc(dimsForBlockedDesc, orderForBlockedDesc);
@@ -288,15 +288,15 @@ bool Deconvolution::canBeExecutedInInt8() const {
}
// heuristicConst = 2^26
// heuristicParam = IC^2 * SP
auto heuristicConst = 67108864;
size_t heuristicConst = 67108864;
auto heuristicParam = IC * IC;
for (int i = 2; i < inMaxDims.size(); i++)
for (size_t i = 2; i < inMaxDims.size(); i++)
heuristicParam *= inMaxDims[i];
if (heuristicParam > heuristicConst)
return false;
}
for (int i = 0; i < kernel.size(); i++) {
for (size_t i = 0; i < kernel.size(); i++) {
if (kernel[i] < stride[i])
return false;
}
@@ -483,7 +483,7 @@ void Deconvolution::getSupportedDescriptors() {
}
void Deconvolution::initPaddingR(const Shape &inShape, const Shape &outShape) {
for (int i = 0; i < paddingR.size(); i++) {
for (size_t i = 0; i < paddingR.size(); i++) {
int with_group = getAlgorithm() == Algorithm::DeconvolutionGrouped ? 1 : 0;
const auto& weightDims = getWeightDims();
int krn = weightDims[with_group + 2 + i];
@@ -511,7 +511,7 @@ void Deconvolution::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dim
// @todo: Clarify with ONEDNN about deconvolution channel mask setting.
DnnlPostOpsComposer dnnlpoc(getEngine(), attr, ops, postOpsArgs, dims, 1, isInt8, withGroups ? 3 : 1 << 0, getDQScales(), withBiases);
for (int i = 0; i < fusedWith.size(); ++i) {
for (size_t i = 0; i < fusedWith.size(); ++i) {
auto& node = fusedWith[i];
bool isLastPostOp = (i == (fusedWith.size() - 1));
+6 -6
View File
@@ -758,12 +758,12 @@ DeformableConvolution::DeformableConvolution(const std::shared_ptr<ngraph::Node>
defConvAttr.group = defConvNodeBase->get_group();
defConvAttr.deformable_group = defConvNodeBase->get_deformable_group();
auto& strides = defConvNodeBase->get_strides();
for (int i = 0; i < strides.size(); i++) {
for (size_t i = 0; i < strides.size(); i++) {
defConvAttr.stride.push_back(strides[i]);
}
auto& dilations = defConvNodeBase->get_dilations();
for (int i = 0; i < dilations.size(); i++) {
for (size_t i = 0; i < dilations.size(); i++) {
defConvAttr.dilation.push_back(dilations[i] - 1);
}
@@ -1022,10 +1022,10 @@ DeformableConvolution::DefConvExecutor::DefConvExecutor(const DefConvAttr &defCo
dstStrides = std::vector<size_t>(dstDesc->getStrides().size());
pSampledCoordsVector = nullptr;
pInterpWeightsVector = nullptr;
for (int i = 0; i < srcDesc->getStrides().size(); i++) {
for (size_t i = 0; i < srcDesc->getStrides().size(); i++) {
srcStrides[srcDesc->getOrder()[i]] = srcDesc->getStrides()[i];
}
for (int i = 0; i < dstDesc->getStrides().size(); i++) {
for (size_t i = 0; i < dstDesc->getStrides().size(); i++) {
dstStrides[dstDesc->getOrder()[i]] = dstDesc->getStrides()[i];
}
@@ -1137,8 +1137,8 @@ void DeformableConvolution::DefConvRefExecutor::exec(const float* src, const flo
const int deformable_group_index = (IC * g + ic) / channel_per_deformable_group;
int sampledCoordIndex = (mb * DGHW + deformable_group_index * HW + oh * OW + ow) * ker_size * sampledPointsPerPixel;
size_t weiIndex = (size_t) g * group_wei_stride + oc * weiStrides[0] + ic * weiStrides[1];
for (int kh_off = 0; kh_off < KH * weiStrides[2]; kh_off += weiStrides[2]) {
for (int kw_off = 0; kw_off < KW * weiStrides[3]; kw_off += weiStrides[3]) {
for (size_t kh_off = 0; kh_off < KH * weiStrides[2]; kh_off += weiStrides[2]) {
for (size_t kw_off = 0; kw_off < KW * weiStrides[3]; kw_off += weiStrides[3]) {
// check if current addendum marked as equal zero
if (pSampledCoordsVector[sampledCoordIndex] != -1) {
const int v11 = pSampledCoordsVector[sampledCoordIndex];
@@ -127,7 +127,7 @@ void DetectionOutput::prepareParams() {
// --> g_topk(vector<>(all detections) --> indices per class))
// MXNet: max conf for prior within img, filter(indices) --> topk_img(buffer) --> nms_cls(indices)
// --> g_topk(vector<>(all detections) --> indices per class))
int cacheSizeL3 = utils::get_cache_size(3, true);
unsigned cacheSizeL3 = utils::get_cache_size(3, true);
isSparsityWorthwhile =
(confidenceThreshold > sparsityThreshold) &&
((classesNum * priorsNum * sizeof(float) * 2) > cacheSizeL3);
@@ -144,7 +144,7 @@ void DetectionOutput::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
addSupportedPrimDesc(inDataConf,
@@ -386,7 +386,7 @@ inline void DetectionOutput::confFilterCF(float* reorderedConfData, int* indices
parallel_for2d(imgNum, classesNum, [&](size_t n, size_t c) {
// in: reorderedConf
// out: pindices count
if (c == backgroundClassId)
if (c == static_cast<size_t>(backgroundClassId))
return;
int off = n * priorsNum * classesNum + c * priorsNum;
const float *pconf = reorderedConfData + off;
@@ -540,7 +540,7 @@ inline void DetectionOutput::confReorderAndFilterSparsityCF(const float* confDat
parallel_for(classesNum, [&](size_t c) {
// in: conf_h info
// out: buffer, detectionCount(k)
if (c == backgroundClassId) // Ignore background class
if (c == static_cast<size_t>(backgroundClassId)) // Ignore background class
return;
int countIdx = offH + c * confInfoLen + priorsNum;
int count = reorderedConfDataIndices[countIdx];
@@ -845,7 +845,7 @@ inline void DetectionOutput::generateOutput(float* reorderedConfData, int* indic
else
dstDataSize = imgNum * classesNum * priorsNum * DETECTION_SIZE * sizeof(float);
if (dstDataSize > getChildEdgesAtPort(0)[0]->getMemory().GetSize()) {
if (static_cast<size_t>(dstDataSize) > getChildEdgesAtPort(0)[0]->getMemory().GetSize()) {
IE_THROW() << errorPrefix << OUT_OF_BOUNDS;
}
memset(dstData, 0, dstDataSize);
+2 -2
View File
@@ -130,7 +130,7 @@ inline bool nextIterationStep(std::vector<size_t>& counters, const std::vector<s
auto itWork = iterationRange.rbegin();
while (itCounter != counters.rend() && itWork != iterationRange.rend()) {
if (std::distance(itCounter, counters.rend()) == axis + 1) {
if (static_cast<size_t>(std::distance(itCounter, counters.rend())) == axis + 1) {
++itCounter;
++itWork;
continue;
@@ -393,7 +393,7 @@ void DFT::fft(float* inBuffer,
for (size_t numBlocks = 1; numBlocks < nComplex; numBlocks *= 2) {
blockSize = nextIterationBlockSize;
nextIterationBlockSize /= 2;
if (parallelize && blockSize >= 4 * elementsPerCacheLine) {
if (parallelize && blockSize >= static_cast<size_t>(4 * elementsPerCacheLine)) {
parallel_for(numBlocks, [&](const size_t block) {
blockIteration(block, 1, nextIterationBlockSize);
});
+65 -65
View File
@@ -178,7 +178,7 @@ InferenceEngine::Precision eltwise_precision_helper::get_precision(const size_t
}
}
for (int i = 0; i < inputs_number; i++) {
for (size_t i = 0; i < inputs_number; i++) {
if (src_prc[i] != exec_prc) {
exec_prc = Precision::FP32;
break;
@@ -292,7 +292,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
// ptrs initializing
if (jep.use_runtime_ptrs) {
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
mov(start_to_offsets, ptr[reg_const_params + GET_OFF(src_offsets) + i * sizeof(size_t)]);
mov(get_src_reg(i), ptr[reg_const_params + GET_OFF(src_ptr[0]) + i * sizeof(size_t)]);
for (int j = 0; j < offset_count; j++) {
@@ -324,7 +324,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
}
};
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
mov(get_src_reg(i), ptr[reg_const_params + GET_OFF(src_ptr[0]) + i * sizeof(size_t)]);
init_ptrs_with_offsets(get_src_reg(i), jep.src_offsets[i]);
}
@@ -350,13 +350,13 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
if (isa == x64::avx512_core)
vpxord(vmm_zero, vmm_zero, vmm_zero);
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] == 1)
load_vector(get_vmm_reg(i), ptr[get_src_reg(i)], jep.src_prc[i], exec_prc, true);
}
size_t min_src_size = jep.dst_size;
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1)
min_src_size = std::min(min_src_size, jep.src_size[i]);
}
@@ -368,7 +368,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
if (jep.dst_size % min_src_size != 0)
is_valid_configuration = false;
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1 && jep.src_size[i] != min_src_size && jep.src_size[i] != jep.dst_size)
is_valid_configuration = false;
}
@@ -387,8 +387,8 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
cmp(reg_work_amount, loop_step);
jl(unroll_loop_end_label, T_NEAR);
for (int j = 0; j < min_src_size / vec_step; j++) {
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t j = 0; j < min_src_size / vec_step; j++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1)
load_vector(get_vmm_reg(i), ptr[get_src_reg(i) + j * vec_step * jep.src_prc[i].size()], jep.src_prc[i], exec_prc, false);
}
@@ -400,9 +400,9 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
store_vector(ptr[reg_dst + j * vec_step * jep.dst_prc.size()], vmm_dst, exec_prc, jep.dst_prc);
}
int tail_start = min_src_size - min_src_size % vec_step;
for (int j = tail_start; j < min_src_size; j++) {
for (int i = 0; i < jep.inputs_number; i++) {
size_t tail_start = min_src_size - min_src_size % vec_step;
for (size_t j = tail_start; j < min_src_size; j++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1)
load_scalar(get_xmm_reg(i), ptr[get_src_reg(i) + j * jep.src_prc[i].size()], jep.src_prc[i], exec_prc);
}
@@ -414,7 +414,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
store_scalar(ptr[reg_dst + j * jep.dst_prc.size()], xmm_dst, exec_prc, jep.dst_prc);
}
for (int i = 0; i < jep.inputs_number; i++)
for (size_t i = 0; i < jep.inputs_number; i++)
if (jep.src_size[i] == jep.dst_size)
add(get_src_reg(i), jep.src_prc[i].size() * loop_step);
@@ -437,7 +437,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
cmp(reg_work_amount, loop_step);
jl(main_loop_end_label, T_NEAR);
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1)
load_vector(get_vmm_reg(i), ptr[get_src_reg(i)], jep.src_prc[i], exec_prc, false);
}
@@ -448,7 +448,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
store_vector(ptr[reg_dst], vmm_dst, exec_prc, jep.dst_prc);
for (int i = 0; i < jep.inputs_number; i++)
for (size_t i = 0; i < jep.inputs_number; i++)
if (jep.src_size[i] != 1)
add(get_src_reg(i), jep.src_prc[i].size() * loop_step);
@@ -470,7 +470,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
cmp(reg_work_amount, loop_step);
jl(tail_loop_end_label, T_NEAR);
for (int i = 0; i < jep.inputs_number; i++) {
for (size_t i = 0; i < jep.inputs_number; i++) {
if (jep.src_size[i] != 1)
load_scalar(get_xmm_reg(i), ptr[get_src_reg(i)], jep.src_prc[i], exec_prc);
}
@@ -481,7 +481,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
store_scalar(ptr[reg_dst], xmm_dst, exec_prc, jep.dst_prc);
for (int i = 0; i < jep.inputs_number; i++)
for (size_t i = 0; i < jep.inputs_number; i++)
if (jep.src_size[i] != 1)
add(get_src_reg(i), jep.src_prc[i].size() * loop_step);
@@ -501,7 +501,7 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, public jit_gener
uni_vcvtneps2bf16->emit_data();
eltwise_emitter->emit_data();
for (int i = 0; i < post_op_emitters.size(); i++) {
for (size_t i = 0; i < post_op_emitters.size(); i++) {
post_op_emitters[i]->emit_data();
}
}
@@ -625,9 +625,9 @@ private:
inline void compute_eltwise_op() {
std::vector<size_t> in_idxs;
std::vector<size_t> aux_idxs;
for (int i = 0; i < eltwise_emitter->get_inputs_num(); i++)
for (size_t i = 0; i < eltwise_emitter->get_inputs_num(); i++)
in_idxs.push_back(get_vmm_reg(i).getIdx());
for (int i = 0; i < eltwise_emitter->aux_vecs_count(); i++)
for (size_t i = 0; i < eltwise_emitter->aux_vecs_count(); i++)
aux_idxs.push_back(get_aux_vmm(i).getIdx());
std::vector<size_t> out_idxs;
@@ -640,14 +640,14 @@ private:
int input_idx = eltwise_emitter->get_inputs_num();
int eltwise_post_op_idx = 0;
int quantization_post_op_idx = 0;
for (int i = 1; i < ops_list_.size(); i++) {
for (size_t i = 1; i < ops_list_.size(); i++) {
if (ops_list_[i] == ov::intel_cpu::Type::Eltwise) {
std::vector<size_t> in_idxs;
std::vector<size_t> aux_idxs;
in_idxs.push_back(vmm_dst.getIdx());
for (int j = 1; j < post_op_emitters[eltwise_post_op_idx]->get_inputs_num(); j++)
for (size_t j = 1; j < post_op_emitters[eltwise_post_op_idx]->get_inputs_num(); j++)
in_idxs.push_back(get_vmm_reg(input_idx++).getIdx());
for (int j = 0; j < post_op_emitters[eltwise_post_op_idx]->aux_vecs_count(); j++)
for (size_t j = 0; j < post_op_emitters[eltwise_post_op_idx]->aux_vecs_count(); j++)
aux_idxs.push_back(get_aux_vmm(j).getIdx());
std::vector<size_t> out_idxs;
@@ -1313,7 +1313,7 @@ public:
const dnnl::post_ops& post_ops,
bool useRuntimePtrs) {
auto collapseLastDims = [](std::vector<size_t>& dims, int dimsToCollapse) {
for (int i = dims.size() - 2; i > dims.size() - dimsToCollapse - 2; i--) {
for (size_t i = dims.size() - 2; i > dims.size() - dimsToCollapse - 2; i--) {
dims[dims.size() - 1] *= dims[i];
}
@@ -1327,7 +1327,7 @@ public:
};
auto collapseLastOffsets = [](std::vector<size_t>& dims, int dimsToCollapse) {
for (int i = dims.size() - 2; i > dims.size() - dimsToCollapse - 2; i--) {
for (size_t i = dims.size() - 2; i > dims.size() - dimsToCollapse - 2; i--) {
if (dims[dims.size() - 1] > 0 || dims[i] > 0)
dims[dims.size() - 1] = std::max(dims[dims.size() - 1], static_cast<size_t>(1)) * std::max(dims[i], static_cast<size_t>(1));
else
@@ -1369,12 +1369,12 @@ public:
}
size_t outRank = outBlkDims.size();
for (int i = 0; i < outRank; i++) {
for (size_t i = 0; i < outRank; i++) {
jep.dims[jep.dims.size() - 1 - i] = outBlkDims[outRank - 1 - i];
}
for (int i = 0; i < inpDims.size(); i++) {
for (int j = 0; j < inpDims[i].size(); j++) {
for (size_t i = 0; i < inpDims.size(); i++) {
for (size_t j = 0; j < inpDims[i].size(); j++) {
if (inpDims[i][j] != jep.dims[j] && inpDims[i][j] != 1)
IE_THROW() << "Eltwise executor got invalid input/output dims configuration.";
}
@@ -1395,7 +1395,7 @@ public:
int oc_dim_idx = i + (jep.input_size - outOrder.size());
jep.oc_offsets[oc_dim_idx] = offset_oc;
offset_oc *= jep.dims[oc_dim_idx];
if (oc_dim_idx + 1 != jep.input_size) { // since in nspc case we can safely collapse the last axis
if (oc_dim_idx + 1 != static_cast<int>(jep.input_size)) { // since in nspc case we can safely collapse the last axis
lastUnchangedAxis = oc_dim_idx;
}
}
@@ -1406,7 +1406,7 @@ public:
int maxCollapsedDims = static_cast<int>(jep.dims.size()) - lastUnchangedAxis - 2;
size_t fullWorkAmount = 1;
for (int i = 0; i < jep.dims.size(); i++) {
for (size_t i = 0; i < jep.dims.size(); i++) {
fullWorkAmount *= jep.dims[i];
}
@@ -1420,7 +1420,7 @@ public:
if (collapsedDims >= maxCollapsedDims)
break;
for (int j = 1; j < inpDims.size(); j++) {
for (size_t j = 1; j < inpDims.size(); j++) {
if (inpDims[j].back() != inpDims[0].back()) {
hasDifferentDims = true;
}
@@ -1431,7 +1431,7 @@ public:
}
bool canCollapse = true;
for (int i = 0; i < inpDims.size(); i++) {
for (size_t i = 0; i < inpDims.size(); i++) {
if (inpDims[i][inpDims[i].size() - 2] != 1) {
if (hasDifferentDims) {
canCollapse = false;
@@ -1449,7 +1449,7 @@ public:
currentJitWorkAmount = nextJitWorkAmount;
collapsedDims++;
for (int i = 0; i < inpDims.size(); i++) {
for (size_t i = 0; i < inpDims.size(); i++) {
collapseLastDims(inpDims[i], 1);
}
collapseLastDims(jep.dims, 1);
@@ -1473,14 +1473,14 @@ public:
// init offset
jep.dst_offsets.resize(jep.input_size, 1);
offset_out_calc(jep.dst_offsets, jep.dims);
for (int j = 0; j < jep.input_size; j++) {
for (size_t j = 0; j < jep.input_size; j++) {
jep.dst_offsets[j] *= outPrc.size();
}
for (int i = 0; i < inputsNumber; i++) {
for (size_t i = 0; i < inputsNumber; i++) {
jep.src_offsets[i].resize(jep.input_size, 1);
offset_in_calc(jep.src_offsets[i], inpDims[i], jep.dims);
for (int j = 0; j < jep.input_size; j++) {
for (size_t j = 0; j < jep.input_size; j++) {
jep.src_offsets[i][j] *= inpPrc[i].size();
}
}
@@ -1488,7 +1488,7 @@ public:
jep.inputs_number = inputsNumber;
for (int i = 0; i < inputsNumber; i++) {
for (size_t i = 0; i < inputsNumber; i++) {
jep.src_prc[i] = inpPrc[i];
jep.src_size[i] = inpDims[i][inpDims[i].size() - 1];
}
@@ -1600,26 +1600,26 @@ public:
_batchDimIdx = input_size - outBlkDims.size();
_dims.resize(input_size, 1);
for (int i = 0; i < outBlkDims.size(); i++) {
for (size_t i = 0; i < outBlkDims.size(); i++) {
_dims[_dims.size() - 1 - i] = outBlkDims[outBlkDims.size() - 1 - i];
}
_fullWorkAmount = 1;
for (int i = 0; i < _dims.size(); i++) {
for (size_t i = 0; i < _dims.size(); i++) {
_fullWorkAmount *= _dims[i];
}
// init offset
_dst_offsets.resize(input_size, 1);
EltwiseJitExecutor::offset_out_calc(_dst_offsets, _dims);
for (int j = 0; j < input_size; j++) {
for (size_t j = 0; j < input_size; j++) {
_dst_offsets[j] *= sizeof(float); // only FP32 out prc is supported
}
for (int i = 0; i < _inputNum; i++) {
for (size_t i = 0; i < _inputNum; i++) {
_src_offsets[i].resize(input_size, 1);
EltwiseJitExecutor::offset_in_calc(_src_offsets[i], inpDims[i], _dims);
for (int j = 0; j < input_size; j++) {
for (size_t j = 0; j < input_size; j++) {
_src_offsets[i][j] *= sizeof(float); // only FP32 inp prcs are supported
}
}
@@ -1655,22 +1655,22 @@ public:
}
size_t index_in[MAX_ELTWISE_INPUTS] = {0};
for (int i = 0; i < _inputNum; i++) {
for (size_t i = 0; i < _inputNum; i++) {
index_in[i] = 0;
for (int j = 0; j < counters.size(); j++) {
for (size_t j = 0; j < counters.size(); j++) {
index_in[i] += counters[j] * _src_offsets[i][j];
}
index_in[i] /= sizeof(float);
}
size_t index_out = 0;
for (int j = 0; j < counters.size(); j++) {
for (size_t j = 0; j < counters.size(); j++) {
index_out += counters[j] * _dst_offsets[j];
}
index_out /= sizeof(float);
std::vector<float> src_f(_inputNum);
for (int i = 0; i < _inputNum; i++) {
for (size_t i = 0; i < _inputNum; i++) {
src_f[i] = (reinterpret_cast<const float*>(args_ptrs.src_ptr[i]) + index_in[i])[0];
}
float* dst_ptr_f = reinterpret_cast<float*>(args_ptrs.dst_ptr) + index_out;
@@ -1937,7 +1937,7 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
for (auto& fusedNode : fusedWith) {
if (fusedNode->getType() == Type::Eltwise) {
for (int i = 0; i < fusedNode->getOriginalInputsNumber(); i++) {
for (int i = 0; i < static_cast<int>(fusedNode->getOriginalInputsNumber()); i++) {
if (fusedNode->getFusingPort() != i)
inputPrecisions.push_back(fusedNode->getOriginalInputPrecisionAtPort(i));
}
@@ -1981,7 +1981,7 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
}
};
for (int i = 0; i < inputPrecisions.size(); i++) {
for (size_t i = 0; i < inputPrecisions.size(); i++) {
inputPrecisions[i] = filterPrecision(inputPrecisions[i]);
}
outputPrecision = filterPrecision(outputPrecision);
@@ -2082,11 +2082,11 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
impl_desc_type impl_type = impl_desc_type::undef;
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < config.inConfs.size(); i++) {
for (size_t i = 0; i < config.inConfs.size(); i++) {
srcMemoryDescs.push_back(config.inConfs[i].getMemDesc());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
dstMemoryDescs.push_back(config.outConfs[i].getMemDesc());
}
@@ -2158,7 +2158,7 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
void Eltwise::createPrimitive() {
if (memPtrs.empty()) {
for (auto i = 0; i < inputNum; i++)
for (size_t i = 0; i < inputNum; i++)
memPtrs.push_back(getParentEdgeAt(i)->getMemoryPtr());
memPtrs.push_back(getChildEdgeAt(0)->getMemoryPtr());
}
@@ -2182,7 +2182,7 @@ void Eltwise::createPrimitive() {
void Eltwise::prepareParams() {
if (canUseAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemoryDescs.push_back(getParentEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
@@ -2204,13 +2204,13 @@ void Eltwise::prepareParams() {
std::vector<VectorDims> dims_in;
// init dims
dims_in.resize(inputNum);
for (int i = 0; i < inputNum; i++) {
for (size_t i = 0; i < inputNum; i++) {
dims_in[i].resize(input_size, 1);
}
size_t outRank = currentOutBlkDims.size();
for (int i = 0; i < inputNum; i++) {
for (size_t i = 0; i < inputNum; i++) {
auto inBlockingDesc = getParentEdgeAt(i)->getMemory().GetDescWithType<BlockedMemoryDesc>();
currentInBlkDims[i] = inBlockingDesc->getBlockDims();
size_t inRank = currentInBlkDims[i].size();
@@ -2225,7 +2225,7 @@ void Eltwise::prepareParams() {
if (outRank > 2 && 1 == outOrder.back()) startOff = 1;
}
for (int j = 0; j < inRank; j++) {
for (size_t j = 0; j < inRank; j++) {
dims_in[i][dims_in[i].size() - 1 - j - startOff] = currentInBlkDims[i][inRank - 1 - j];
}
}
@@ -2238,7 +2238,7 @@ void Eltwise::prepareParams() {
if (execPtr) {
canSkipSearchInCache = true;
// check broadcast policy
for (int i = 0; i < inputNum; i++) {
for (size_t i = 0; i < inputNum; i++) {
if (broadcastPolicy[i] != (dims_in[i].back() == 1)) {
broadcastPolicy[i] = (dims_in[i].back() == 1);
canSkipSearchInCache = false;
@@ -2247,7 +2247,7 @@ void Eltwise::prepareParams() {
} else {
// fill broadcast policy
broadcastPolicy.resize(inputNum);
for (int i = 0; i < inputNum; i++) {
for (size_t i = 0; i < inputNum; i++) {
broadcastPolicy[i] = (dims_in[i].back() == 1);
}
}
@@ -2284,7 +2284,7 @@ void Eltwise::prepareParams() {
// outDims recalculation
outDims.resize(dims_in[0].size(), 1);
for (int i = 0; i < outRank; i++) {
for (size_t i = 0; i < outRank; i++) {
outDims[outDims.size() - 1 - i] = currentOutBlkDims[outRank - 1 - i];
}
// offsets recalculation
@@ -2307,16 +2307,16 @@ void Eltwise::prepareParams() {
auto inputSize = dims_in.front().size();
outOffsets.resize(inputSize, 1);
offset_out_calc(outOffsets, outDims);
for (int j = 0; j < inputSize; j++) {
for (size_t j = 0; j < inputSize; j++) {
outOffsets[j] *= outPrc.size();
}
auto inputsNumber = dims_in.size();
inOffsets.resize(inputsNumber);
for (int i = 0; i < inputsNumber; i++) {
for (size_t i = 0; i < inputsNumber; i++) {
inOffsets[i].resize(inputSize, 1);
offset_in_calc(inOffsets[i], dims_in[i], outDims);
for (int j = 0; j < inputSize; j++) {
for (size_t j = 0; j < inputSize; j++) {
inOffsets[i][j] *= inpPrc[i].size();
}
}
@@ -2339,7 +2339,7 @@ void Eltwise::execute(dnnl::stream strm) {
if (execPtr) {
jit_eltwise_call_args_ptrs args_ptrs = {};
VectorDims dims_out = implType == EltwiseImplType::optimizedShapeAgnostic ? execParams.outDims : execPtr->getOutDims();
for (int i = 0; i < memPtrs.size() - 1; i++)
for (size_t i = 0; i < memPtrs.size() - 1; i++)
args_ptrs.src_ptr[i] = reinterpret_cast<const uint8_t*>(memPtrs[i]->GetData()) + start_offset_in[i];
args_ptrs.dst_ptr = reinterpret_cast<uint8_t*>(memPtrs.back()->GetData()) + start_offset_out;
@@ -2348,7 +2348,7 @@ void Eltwise::execute(dnnl::stream strm) {
// shape agnostic kernel: offsets and work amount initialization
if (implType == EltwiseImplType::optimizedShapeAgnostic) {
args_ptrs.work_amount = dims_out.back();
for (int i = 0; i < execParams.inOffsets.size(); i++) {
for (size_t i = 0; i < execParams.inOffsets.size(); i++) {
args_ptrs.src_offsets[i] = execParams.inOffsets[i].data();
}
args_ptrs.dst_offsets = execParams.outOffsets.data();
@@ -2357,7 +2357,7 @@ void Eltwise::execute(dnnl::stream strm) {
execPtr->exec(args_ptrs, dims_out);
} else if (aclExecPtr) {
std::vector<MemoryCPtr> srcMemory;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemory.push_back(getParentEdgeAt(i)->getMemoryPtr());
}
std::vector<MemoryPtr> dstMemory;
@@ -2469,7 +2469,7 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops, const VectorDims &postOpDim
}
return;
}
int channelSize = 1;
size_t channelSize = 1;
if (channelAxis >= 0) {
const auto chIdx = postOpDims.size() > 1 ? channelAxis : 0;
channelSize = postOpDims[chIdx];
@@ -2673,7 +2673,7 @@ bool Eltwise::canFuse(const NodePtr& node) const {
// Limitation: inputs precision definition inside Eltwise node assumes fusing is applied for 0-th port,
// otherwise we need identical precision on all inputs of fused node
for (int i = 1; i < getOriginalInputsNumber(); i++) {
for (size_t i = 1; i < getOriginalInputsNumber(); i++) {
if (getOriginalInputPrecisionAtPort(0) != getOriginalInputPrecisionAtPort(i)) {
return false;
}
@@ -89,11 +89,11 @@ void EmbeddingBagOffsetSum::initFromInputs() {
}
}
void EmbeddingBagOffsetSum::getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (embIndex >= _offsetsLen) {
void EmbeddingBagOffsetSum::getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (static_cast<size_t>(embIndex) >= _offsetsLen) {
IE_THROW() << "Invalid embedding bag index.";
}
if (offsetsData_[embIndex] >= _indicesLen) {
if (static_cast<size_t>(offsetsData_[embIndex]) >= _indicesLen) {
IE_THROW() << "Offset value exceeds indices size.";
}
@@ -33,7 +33,7 @@ protected:
private:
void initFromInputs() override;
void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
void getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
const size_t OFFSETS_IDX = 2lu;
@@ -78,8 +78,8 @@ void EmbeddingBagPackedSum::initFromInputs() {
_indices = reinterpret_cast<const int *>(getParentEdgeAt(INDICES_IDX)->getMemoryPtr()->GetPtr());
}
void EmbeddingBagPackedSum::getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (embIndex >= _batch * _indicesPerBag)
void EmbeddingBagPackedSum::getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (static_cast<size_t>(embIndex) >= _batch * _indicesPerBag)
IE_THROW() << "Invalid embedding bag index.";
withWeight = true;
@@ -33,7 +33,7 @@ protected:
private:
void initFromInputs() override;
void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
void getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
const int* _indices = nullptr;
size_t _batch = 0;
@@ -75,7 +75,7 @@ void EmbeddingBagSum::processData(const T* srcData, const T* weightsData,
withWeights = withWeights & _withWeights;
size_t inIdx = 0lu;
if (indices[inIdx] >= inDataDims[0]) {
if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {
IE_THROW() << msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]);
}
size_t srcIndex = indices[inIdx] * _embDepth;
@@ -92,7 +92,7 @@ void EmbeddingBagSum::processData(const T* srcData, const T* weightsData,
}
for (inIdx = 1lu; inIdx < indicesSize; inIdx++) {
if (indices[inIdx] >= inDataDims[0]) {
if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {
IE_THROW() << msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]);
}
size_t srcIndex = indices[inIdx] * _embDepth;
@@ -31,7 +31,7 @@ public:
protected:
virtual void initFromInputs() = 0;
virtual void getIndices(
int embIndex,
size_t embIndex,
const int*& indicesRef,
size_t& size,
int& weightsIdx,
@@ -94,16 +94,16 @@ void EmbeddingSegmentsSum::initFromInputs() {
}
}
void EmbeddingSegmentsSum::getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (embIndex >= lastNumSegments_)
void EmbeddingSegmentsSum::getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) {
if (embIndex >= static_cast<size_t>(lastNumSegments_))
IE_THROW() << "Invalid embedding bag index.";
indices = nullptr;
size = 0;
withWeight = true;
for (int si = 0; si < indicesSize_; si++) {
if (segmentIds_[si] == embIndex) {
for (int si = 0; si < static_cast<int>(indicesSize_); si++) {
if (static_cast<size_t>(segmentIds_[si]) == embIndex) {
size++;
if (indices == nullptr) {
indices = indices_ + si;
@@ -34,13 +34,13 @@ protected:
private:
void initFromInputs() override;
void getIndices(int embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
void getIndices(size_t embIndex, const int*& indices, size_t& size, int& weightsIdx, bool& withWeight) override;
int32_t getNumSegments() const;
static constexpr size_t SEGMENT_ID_IDX = 2lu;
static constexpr size_t NUM_SEGMENTS_IDX = 3lu;
int lastNumSegments_ = 0;
int32_t lastNumSegments_ = 0;
const int* indices_ = nullptr;
const int* segmentIds_ = nullptr;
@@ -14,10 +14,10 @@ inline VectorDims reshape_sizes(VectorDims dims) {
const size_t MAX_NUM_SHAPE = arm_compute::MAX_DIMS;
VectorDims result_dims(MAX_NUM_SHAPE - 1);
if (dims.size() >= MAX_NUM_SHAPE) {
for (int i = 0; i < MAX_NUM_SHAPE - 1; i++) {
for (size_t i = 0; i < MAX_NUM_SHAPE - 1; i++) {
result_dims[i] = dims[i];
}
for (int i = MAX_NUM_SHAPE - 1; i < dims.size(); i++) {
for (size_t i = MAX_NUM_SHAPE - 1; i < dims.size(); i++) {
result_dims[MAX_NUM_SHAPE - 2] *= dims[i];
}
} else {
@@ -31,7 +31,7 @@ bool AclEltwiseExecutorBuilder::isSupported(const EltwiseAttrs& eltwiseAttrs,
const std::vector<MemoryDescPtr>& srcDescs,
const std::vector<MemoryDescPtr>& dstDescs) const {
auto checkPrecision = [&srcDescs, &dstDescs](std::vector<Precision> srcVecPrc, Precision dstPrc) -> bool {
for (int i = 0; i < srcDescs.size(); i++) {
for (size_t i = 0; i < srcDescs.size(); i++) {
if (srcDescs[i]->getPrecision() != srcVecPrc[i]) return false;
}
if (dstDescs[0]->getPrecision() != dstPrc) { return false; }
@@ -144,18 +144,18 @@ bool AclEltwiseExecutor::init(const EltwiseAttrs &eltwiseAttrs, const std::vecto
srcTensors = std::vector<arm_compute::Tensor>(srcDescs.size());
dstTensors = std::vector<arm_compute::Tensor>(dstDescs.size());
for (int i = 0; i < srcVecDims.size(); i++) {
for (size_t i = 0; i < srcVecDims.size(); i++) {
srcVecDims[i] = shapeCast(reshape_sizes(srcDescs[i]->getShape().getDims()));
}
for (int i = 0; i < dstVecDims.size(); i++) {
for (size_t i = 0; i < dstVecDims.size(); i++) {
dstVecDims[i] = shapeCast(reshape_sizes(dstDescs[i]->getShape().getDims()));
}
for (int i = 0; i < srcDescs.size(); i++) {
for (size_t i = 0; i < srcDescs.size(); i++) {
srcDataLayout[i] = getAclDataLayoutByMemoryDesc(srcDescs[i]);
if (srcDataLayout[i] == arm_compute::DataLayout::UNKNOWN) { return false; }
}
for (int i = 0; i < dstDescs.size(); i++) {
for (size_t i = 0; i < dstDescs.size(); i++) {
dstDataLayout[i] = getAclDataLayoutByMemoryDesc(dstDescs[i]);
if (dstDataLayout[i] == arm_compute::DataLayout::UNKNOWN) { return false; }
}
@@ -179,14 +179,14 @@ bool AclEltwiseExecutor::init(const EltwiseAttrs &eltwiseAttrs, const std::vecto
mover(dstVecDims[0]);
}
for (int i = 0; i < srcVecDims.size(); i++) {
for (size_t i = 0; i < srcVecDims.size(); i++) {
srcTensorsInfo[i] = TensorInfo(srcVecDims[i], 1,
precisionToAclDataType(srcDescs[i]->getPrecision()),
srcDataLayout[i]);
srcTensors[i].allocator()->init(srcTensorsInfo[i]);
}
for (int i = 0; i < dstVecDims.size(); i++) {
for (size_t i = 0; i < dstVecDims.size(); i++) {
dstTensorsInfo[i] = TensorInfo(dstVecDims[i], 1,
precisionToAclDataType(dstDescs[i]->getPrecision()),
dstDataLayout[i]);
@@ -474,19 +474,19 @@ bool AclEltwiseExecutor::init(const EltwiseAttrs &eltwiseAttrs, const std::vecto
void AclEltwiseExecutor::exec(const std::vector<MemoryCPtr> &src, const std::vector<MemoryPtr> &dst,
const void *post_ops_data_) {
for (int i = 0; i < src.size(); i++) {
for (size_t i = 0; i < src.size(); i++) {
srcTensors[i].allocator()->import_memory(src[i]->GetPtr());
}
for (int i = 0; i < dst.size(); i++) {
for (size_t i = 0; i < dst.size(); i++) {
dstTensors[i].allocator()->import_memory(dst[i]->GetPtr());
}
exec_func();
for (int i = 0; i < src.size(); i++) {
for (size_t i = 0; i < src.size(); i++) {
srcTensors[i].allocator()->free();
}
for (int i = 0; i < dst.size(); i++) {
for (size_t i = 0; i < dst.size(); i++) {
dstTensors[i].allocator()->free();
}
}
@@ -167,7 +167,7 @@ bool ov::intel_cpu::ACLInterpolateExecutorBuilder::isSupportedConfiguration(
bool ov::intel_cpu::ACLInterpolateExecutorBuilder::isSupported(const ov::intel_cpu::InterpolateAttrs &interpolateAttrs,
const std::vector<MemoryDescPtr> &srcDescs,
const std::vector<MemoryDescPtr> &dstDescs) const {
if (srcDescs[0]->getShape().getDims().size() != 4) {
if (srcDescs[0]->getShape().getDims().size() != 4u) {
return false;
}
@@ -20,10 +20,10 @@ bool AclMVNExecutor::init(const MVNAttrs& mvnAttrs,
size_t X, Y;
if (mvnAttrs.initAcrossChannels_) {
if (srcDims.size() >= 2) {
if (srcDims.size() >= 2u) {
Y = srcDims[0];
X = srcDims[1];
for (int i = 2; i < srcDims.size(); i++) {
for (size_t i = 2; i < srcDims.size(); i++) {
X *= srcDims[i];
}
} else {
@@ -31,13 +31,13 @@ bool AclMVNExecutor::init(const MVNAttrs& mvnAttrs,
X = srcDims[0];
}
} else {
if (srcDims.size() > 2) {
if (srcDims.size() > 2u) {
Y = srcDims[0] * srcDims[1];
X = srcDims[2];
for (int i = 3; i < srcDims.size(); i++) {
for (size_t i = 3; i < srcDims.size(); i++) {
X *= srcDims[i];
}
} else if (srcDims.size() == 2) {
} else if (srcDims.size() == 2u) {
Y = srcDims[0] * srcDims[1];
X = 1;
} else {
@@ -21,14 +21,14 @@ bool AclPoolingExecutor::isSupported(const TensorInfo& srcTensorInfo,
const VectorDims* indDims,
PoolingLayerInfo* pool_info,
Pooling3dLayerInfo* pool3d_info) {
unsigned int pad_left = (poolingAttrs.data_pad_begin.size() >= 2) ? poolingAttrs.data_pad_begin[1] : poolingAttrs.data_pad_begin[0];
unsigned int pad_right = (poolingAttrs.data_pad_end.size() >= 2) ? poolingAttrs.data_pad_end[1] : poolingAttrs.data_pad_end[0];
unsigned int pad_top = (poolingAttrs.data_pad_begin.size() >= 2) ? poolingAttrs.data_pad_begin[0] : 0;
unsigned int pad_bottom = (poolingAttrs.data_pad_end.size() >= 2) ? poolingAttrs.data_pad_end[0] : 0;
unsigned int kernel_w = (poolingAttrs.kernel.size() >= 2) ? poolingAttrs.kernel[1] : poolingAttrs.kernel[0];
unsigned int kernel_h = (poolingAttrs.kernel.size() >= 2) ? poolingAttrs.kernel[0] : 1;
unsigned int stride_x = (poolingAttrs.stride.size() >= 2) ? poolingAttrs.stride[1] : poolingAttrs.stride[0];
unsigned int stride_y = (poolingAttrs.stride.size() >= 2) ? poolingAttrs.stride[0] : 1;
unsigned int pad_left = (poolingAttrs.data_pad_begin.size() >= 2u) ? poolingAttrs.data_pad_begin[1] : poolingAttrs.data_pad_begin[0];
unsigned int pad_right = (poolingAttrs.data_pad_end.size() >= 2u) ? poolingAttrs.data_pad_end[1] : poolingAttrs.data_pad_end[0];
unsigned int pad_top = (poolingAttrs.data_pad_begin.size() >= 2u) ? poolingAttrs.data_pad_begin[0] : 0;
unsigned int pad_bottom = (poolingAttrs.data_pad_end.size() >= 2u) ? poolingAttrs.data_pad_end[0] : 0;
unsigned int kernel_w = (poolingAttrs.kernel.size() >= 2u) ? poolingAttrs.kernel[1] : poolingAttrs.kernel[0];
unsigned int kernel_h = (poolingAttrs.kernel.size() >= 2u) ? poolingAttrs.kernel[0] : 1;
unsigned int stride_x = (poolingAttrs.stride.size() >= 2u) ? poolingAttrs.stride[1] : poolingAttrs.stride[0];
unsigned int stride_y = (poolingAttrs.stride.size() >= 2u) ? poolingAttrs.stride[0] : 1;
PoolingType pool_type;
bool exclude_padding = false;
@@ -110,8 +110,8 @@ bool AclPoolingExecutor::init(const PoolingAttrs& poolingAttrs,
srcTensor.allocator()->init(srcTensorInfo);
dstTensor.allocator()->init(dstTensorInfo);
if (srcDims.size() == 5) {
if (dstDescs.size() == 1) {
if (srcDims.size() == 5u) {
if (dstDescs.size() == 1u) {
Pooling3dLayerInfo pool_info;
if (!isSupported(srcTensorInfo,
dstTensorInfo,
@@ -131,7 +131,7 @@ bool AclPoolingExecutor::init(const PoolingAttrs& poolingAttrs,
}
} else {
arm_compute::PoolingLayerInfo pool_info;
if (dstDescs.size() > 1) {
if (dstDescs.size() > 1u) {
if (!isSupported(srcTensorInfo,
dstTensorInfo,
poolingAttrs,
@@ -175,13 +175,13 @@ bool AclPoolingExecutor::init(const PoolingAttrs& poolingAttrs,
void AclPoolingExecutor::exec(const std::vector<MemoryCPtr>& src, const std::vector<MemoryPtr>& dst, std::unordered_map<int, MemoryPtr> postOpsArgs) {
srcTensor.allocator()->import_memory(src[0]->GetPtr());
dstTensor.allocator()->import_memory(dst[0]->GetPtr());
if (dst.size() > 1) indTensor.allocator()->import_memory(dst[1]->GetPtr());
if (dst.size() > 1u) indTensor.allocator()->import_memory(dst[1]->GetPtr());
exec_func();
srcTensor.allocator()->free();
dstTensor.allocator()->free();
if (dst.size() > 1) indTensor.allocator()->free();
if (dst.size() > 1u) indTensor.allocator()->free();
}
} // namespace intel_cpu
@@ -63,7 +63,7 @@ public:
return false;
}
if (srcDescs.size() == 2 &&
if (srcDescs.size() == 2u &&
(srcDescs[1]->getPrecision() != InferenceEngine::Precision::FP32 &&
srcDescs[0]->getPrecision() != InferenceEngine::Precision::FP32 &&
dstDescs[0]->getPrecision() != InferenceEngine::Precision::FP32) &&
@@ -77,7 +77,7 @@ public:
return false;
}
if (dstDescs.size() == 2 &&
if (dstDescs.size() == 2u &&
dstDescs[1]->getPrecision() != InferenceEngine::Precision::U32) {
DEBUG_LOG("AclPoolingExecutor does not support precisions:",
" dst[1]=", dstDescs[1]->getPrecision());
@@ -94,7 +94,7 @@ public:
" dst=", dstDescs[0]->serializeFormat());
return false;
}
if (srcDescs.size() == 2 &&
if (srcDescs.size() == 2u &&
!(srcDescs[0]->hasLayoutType(LayoutType::ncsp) &&
srcDescs[1]->hasLayoutType(LayoutType::ncsp) &&
dstDescs[0]->hasLayoutType(LayoutType::ncsp)) &&
@@ -62,17 +62,17 @@ void ov::intel_cpu::InterpolateExecutor::buildTblNN(const SizeVector& srcDimPad5
bool isDDownsample = (fz < 1) ? true : false;
bool isHDownsample = (fy < 1) ? true : false;
bool isWDownsample = (fx < 1) ? true : false;
for (int oz = 0; oz < OD; oz++) {
for (int oz = 0; oz < static_cast<int>(OD); oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
indexTable[oz] = nearestRound(iz, isDDownsample, nearestMode);
indexTable[oz] = clipCoord(indexTable[oz], ID);
}
for (int oy = 0; oy < OH; oy++) {
for (int oy = 0; oy < static_cast<int>(OH); oy++) {
float iy = coordTransToInput(oy, fy, IH, OH);
indexTable[OD + oy] = nearestRound(iy, isHDownsample, nearestMode);
indexTable[OD + oy] = clipCoord(indexTable[OD + oy], IH);
}
for (int ox = 0; ox < OW; ox++) {
for (int ox = 0; ox < static_cast<int>(OW); ox++) {
float ix = coordTransToInput(ox, fx, IW, OW);
indexTable[OD + OH + ox] = nearestRound(ix, isWDownsample, nearestMode);
indexTable[OD + OH + ox] = clipCoord(indexTable[OD + OH + ox], IW);
@@ -317,7 +317,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const SizeVector& srcDim
int *idxOH = static_cast<int*>(&idxTable[sizeOD]);
int *idxOW = static_cast<int*>(&idxTable[sizeOD + sizeOH]);
for (int oz = 0; oz < OD; oz++) {
for (int oz = 0; oz < static_cast<int>(OD); oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
int iz_r = static_cast<int>(std::round(iz));
for (int r = iz_r - rz, i = 0; r <= iz_r + rz; r++, i++) {
@@ -330,7 +330,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const SizeVector& srcDim
}
}
}
for (int oy = 0; oy < OH; oy++) {
for (int oy = 0; oy < static_cast<int>(OH); oy++) {
float iy = coordTransToInput(oy, fy, IH, OH);
int iy_r = static_cast<int>(std::round(iy));
for (int r = iy_r - ry, i = 0; r <= iy_r + ry; r++, i++) {
@@ -343,7 +343,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const SizeVector& srcDim
}
}
}
for (int ox = 0; ox < OW; ox++) {
for (int ox = 0; ox < static_cast<int>(OW); ox++) {
float ix = coordTransToInput(ox, fx, IW, OW);
int ix_r = static_cast<int>(std::round(ix));
for (int r = ix_r - rx, i = 0; r <= ix_r + rx; r++, i++) {
@@ -262,7 +262,7 @@ void ExperimentalDetectronDetectionOutput::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
addSupportedPrimDesc(inDataConf,
@@ -320,7 +320,7 @@ void ExperimentalDetectronROIFeatureExtractor::initSupportedPrimitiveDescriptors
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
addSupportedPrimDesc(inDataConf,
@@ -30,7 +30,7 @@ private:
const int INPUT_FEATURES_START {1};
const int OUTPUT_ROI_FEATURES {0};
const int OUTPUT_ROIS {1};
const size_t OUTPUT_ROIS {1};
int output_dim_ = 0;
int pooled_height_ = 0;
@@ -266,7 +266,7 @@ private:
void prepare_table() {
align(64);
L(gather_index_table);
for (int32_t i = 0; i < vlen / sizeof(int32_t); i++)
for (size_t i = 0; i < vlen / sizeof(int32_t); i++)
dd(i * jpp.SW * jpp.dtype_size);
}
};
@@ -284,7 +284,7 @@ bool ExtractImagePatches::isSupportedOperation(const std::shared_ptr<const ngrap
errorMessage = "Does not support pad type: " + ngraph::as_string(padValue);
return false;
}
if (!everyone_is(2, extImgPatcher->get_sizes().size(), extImgPatcher->get_strides().size(), extImgPatcher->get_rates().size())) {
if (!everyone_is(2u, extImgPatcher->get_sizes().size(), extImgPatcher->get_strides().size(), extImgPatcher->get_rates().size())) {
errorMessage = "Doesn't support 'sizes', 'strides', 'rates', attributes with rank != 2";
return false;
}
+1 -1
View File
@@ -94,7 +94,7 @@ void Eye::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> outDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::I32);
outDataConf.reserve(1);
outDataConf.emplace_back(LayoutType::ncsp, convertPrecision(outType));
@@ -473,7 +473,7 @@ private:
constexpr unsigned simd_w = isa == cpu::x64::avx512_core ? 16 : 8;
constexpr unsigned tail8_simd_w = 8;
constexpr unsigned tail4_simd_w = 4;
constexpr unsigned repeats = isa == cpu::x64::sse41 ? 2 : 1;
constexpr int repeats = isa == cpu::x64::sse41 ? 2 : 1;
Label main_loop_label;
Label tail_blk8_label;
@@ -616,7 +616,7 @@ private:
auto tail_unroll = [&](size_t iter) {
const auto &broadcasted = jqp_.broadcasted;
for (int i = 0; i < iter; i++) {
for (size_t i = 0; i < iter; i++) {
if (!broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)])
uni_vmovss(xmm_crop_low(0), ptr[reg_crop_low + i * wei_type_size]);
if (!broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)])
@@ -979,7 +979,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
auto initAxisIdx = [&](const VectorDims& inputDims) {
size_t axisIdx = 0;
for (int i = 1; i < inputDims.size(); i++) {
for (size_t i = 1; i < inputDims.size(); i++) {
if (inputDims[i] > 1) {
axisIdx = i;
}
@@ -1048,14 +1048,14 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
binarization = levels == 2;
if (binarization) {
for (int i = 0; i < outputLowAxisSize; i++) {
for (size_t i = 0; i < outputLowAxisSize; i++) {
if (outputLowData[i] != 1.f && outputLowData[i] != 0.f) {
binarization = false;
break;
}
}
for (int i = 0; i < outputHighAxisSize; i++) {
for (size_t i = 0; i < outputHighAxisSize; i++) {
if (outputHighData[i] != 1.f && outputHighData[i] != 0.f) {
binarization = false;
break;
@@ -1098,7 +1098,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
return true;
auto first = data[0];
for (int i = 1; i < size; i++) {
for (size_t i = 1; i < size; i++) {
if (data[i] != first)
return false;
}
@@ -1156,15 +1156,15 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
bool quantizationOnly = true;
for (int i = 0; i < cropLow.size(); i++) {
for (size_t i = 0; i < cropLow.size(); i++) {
cropLow[i] = inputLowData[isInputLowBroadcasted ? 0 : i];
}
for (int i = 0; i < cropHigh.size(); i++) {
for (size_t i = 0; i < cropHigh.size(); i++) {
cropHigh[i] = inputHighData[isInputHighBroadcasted ? 0 : i];
}
for (int i = 0; i < inputScale.size(); i++) {
for (size_t i = 0; i < inputScale.size(); i++) {
float il = inputLowData[isInputLowBroadcasted ? 0 : i];
float ih = inputHighData[isInputHighBroadcasted ? 0 : i];
@@ -1183,7 +1183,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
#endif
}
for (int i = 0; i < outputScale.size(); i++) {
for (size_t i = 0; i < outputScale.size(); i++) {
float ol = outputLowData[isOutputLowBroadcasted ? 0 : i];
float oh = outputHighData[isOutputHighBroadcasted ? 0 : i];
@@ -1203,7 +1203,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
quantizationOnly = false;
}
for (int i = 0; i < outputShift.size(); i++) {
for (size_t i = 0; i < outputShift.size(); i++) {
float ol = outputLowData[isOutputLowBroadcasted ? 0 : i];
outputShift[i] = ol;
@@ -1214,7 +1214,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
bool isFakeQuantization = true;
bool isFakeQuantizationWithScale = true;
for (int i = 0; i < std::max(inputLowAxisSize, std::max(outputLowAxisSize, std::max(inputHighAxisSize, outputHighAxisSize))); i++) {
for (size_t i = 0; i < std::max(inputLowAxisSize, std::max(outputLowAxisSize, std::max(inputHighAxisSize, outputHighAxisSize))); i++) {
float il = inputLowData[isInputLowBroadcasted ? 0 : i];
float ol = outputLowData[isOutputLowBroadcasted ? 0 : i];
float ih = inputHighData[isInputHighBroadcasted ? 0 : i];
@@ -1226,7 +1226,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ngraph::Node>& op, const GraphC
}
if (isFakeQuantizationWithScale) {
for (int i = 0; i < std::max(inputLowAxisSize, std::max(outputLowAxisSize, std::max(inputHighAxisSize, outputHighAxisSize))); i++) {
for (size_t i = 0; i < std::max(inputLowAxisSize, std::max(outputLowAxisSize, std::max(inputHighAxisSize, outputHighAxisSize))); i++) {
float il = inputLowData[isInputLowBroadcasted ? 0 : i];
float ol = outputLowData[isOutputLowBroadcasted ? 0 : i];
float ih = inputHighData[isInputHighBroadcasted ? 0 : i];
@@ -1455,7 +1455,7 @@ void FakeQuantize::createPrimitive() {
const auto &srcMemory = getParentEdgeAt(0)->getMemory();
const auto &srcDesc = srcMemory.getDesc();
key.jqp.is_planar = srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3, 4, 5);
key.jqp.is_planar = srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3u, 4u, 5u);
key.jqp.op_type = getAlgorithm();
if (isBinarization()) {
@@ -1933,12 +1933,12 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
return abs(val - ref) < zero_thr;
});
};
int OC = std::max({inputScale.size(),
inputShift.size(),
cropLow.size(),
cropHigh.size(),
outputScale.size(),
outputShift.size()});
size_t OC = std::max({inputScale.size(),
inputShift.size(),
cropLow.size(),
cropHigh.size(),
outputScale.size(),
outputShift.size()});
IE_ASSERT(inputScale.size() == 1 || inputScale.size() == OC);
IE_ASSERT(inputShift.size() == 1 || inputShift.size() == OC);
@@ -1975,7 +1975,7 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
if (f.ish.size() == 1)
f.ish.resize(OC, f.ish[0]);
for (int i = 0; i < OC; i++) {
for (size_t i = 0; i < OC; i++) {
auto& clo = f.clo[i];
auto& chi = f.chi[i];
auto& isc = f.isc[i];
@@ -480,7 +480,7 @@ void FullyConnected::setPostOps(dnnl::primitive_attr& attr, const VectorDims& di
DnnlPostOpsComposer dnnlpoc(getEngine(), attr, ops, postOpsArgs, dims, dims.size() - 1, isINT8, 1 << 0, getDQScales(), withBiases);
for (int i = 0; i < fusedWith.size(); ++i) {
for (size_t i = 0; i < fusedWith.size(); ++i) {
auto& node = fusedWith[i];
bool isLastPostOp = (i == (fusedWith.size() - 1));
@@ -816,7 +816,7 @@ bool FullyConnected::canBeExecutedInConv1x1() const {
// problems with the above.
if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core) &&
getOriginalInputPrecisionAtPort(DATA_ID) == InferenceEngine::Precision::FP32 &&
one_of(inRank, 2, 3) && weightRank == 2) {
one_of(inRank, 2u, 3u) && weightRank == 2) {
auto dstMemPtr = getChildEdgesAtPort(0)[0]->getMemoryPtr();
DnnlMemoryDescCPtr outDesc = dstMemPtr->GetDescWithType<DnnlMemoryDesc>();
// brg convolution does not support stride
@@ -886,7 +886,7 @@ bool FullyConnected::useSparseWeightsDecompression() {
auto weightsData = reinterpret_cast<const int8_t*>(blb->GetPtr());
auto elementsCount = blb->GetDescWithType<BlockedMemoryDesc>()->getPaddedElementsCount();
size_t zerosCounts = 0;
for (int i = 0; i < elementsCount; i++) {
for (size_t i = 0; i < elementsCount; i++) {
if (weightsData[i] == 0) {
zerosCounts++;
}
+10 -10
View File
@@ -427,12 +427,12 @@ void Gather::executeDynamicImpl(dnnl::stream strm) {
permIdxMask[0] = idxElPerVec - specIndicesSize;
int div = idxElPerVec / specIndicesSize;
int remainder = idxElPerVec % specIndicesSize;
for (int i = 1; i < idxElPerVec; i++) {
for (uint64_t i = 1; i < idxElPerVec; i++) {
permIdxMask[i] = permIdxMask[i - 1] + 1;
if (permIdxMask[i] == idxElPerVec)
if (static_cast<uint64_t>(permIdxMask[i]) == idxElPerVec)
permIdxMask[i] = idxElPerVec - specIndicesSize;
}
for (int i = 0; i < idxElPerVec; i++) {
for (uint64_t i = 0; i < idxElPerVec; i++) {
if (((start + i) % specIndicesSize) < (specIndicesSize - remainder))
beforeAxisDiff[i] = axisDim * div;
else
@@ -466,9 +466,9 @@ void Gather::initShortParams(threadExecParams& p, const uint64_t start) {
p.srcBeforeAxisDiff.resize(idxElPerVec);
p.permIdxMask[0] = idxElPerVec - specIndicesSize;
for (int i = 1; i < idxElPerVec; i++) {
for (uint64_t i = 1; i < idxElPerVec; i++) {
p.permIdxMask[i] = p.permIdxMask[i - 1] + 1;
if (p.permIdxMask[i] == idxElPerVec)
if (static_cast<uint64_t>(p.permIdxMask[i]) == idxElPerVec)
p.permIdxMask[i] = idxElPerVec - specIndicesSize;
}
@@ -492,7 +492,7 @@ void Gather::initShortParams(threadExecParams& p, const uint64_t start) {
p.srcBeforeAxisDiff.resize(idxElPerVec);
int secondStart = start + idxElPerVec;
for (int i = 0; i < idxElPerVec; i++) {
for (uint64_t i = 0; i < idxElPerVec; i++) {
p.afterAxIdxInBytes[i] = (start + i) % afterAxisSize;
p.specIdxDiff[i] = (((secondStart + i) / afterAxisSize) % specIndicesSize) * idxTypeSize - p.specIdxInBytes[i];
if (p.specIdxDiff[i] < 0)
@@ -503,15 +503,15 @@ void Gather::initShortParams(threadExecParams& p, const uint64_t start) {
p.afterAxIdxInBytes[i] *= dataTypeSize;
p.afterAxPermMask[i] = idxElPerVec - afterAxisSize + i;
for (size_t j = 0lu; j < 6lu; j++) {
if (p.afterAxPermMask[i] >= idxElPerVec)
if (static_cast<uint64_t>(p.afterAxPermMask[i]) >= idxElPerVec)
p.afterAxPermMask[i] -= afterAxisSize;
}
}
if (specIndicesSize * afterAxisSize < idxElPerVec) {
p.beforeAxPermMask[0] = idxElPerVec - specIndicesSize * afterAxisSize;
for (int i = 1; i < idxElPerVec; i++) {
for (uint64_t i = 1; i < idxElPerVec; i++) {
p.beforeAxPermMask[i] = p.beforeAxPermMask[i - 1] + 1;
if (p.beforeAxPermMask[i] == idxElPerVec)
if (static_cast<uint64_t>(p.beforeAxPermMask[i]) == idxElPerVec)
p.beforeAxPermMask[i] = idxElPerVec - specIndicesSize * afterAxisSize;
}
}
@@ -536,7 +536,7 @@ void Gather::execReference() {
}
const size_t idx = ii;
const size_t c2 = dstAfterBatchSize * b + afterAxisSizeInBytes * j;
if (idx < axisDim) {
if (idx < static_cast<size_t>(axisDim)) {
size_t c1 = srcAfterBatchSizeInBytes * b + afterAxisSizeInBytes * idx;
for (size_t i = 0; i < betweenBatchAndAxisSize; i++) {
size_t srcIdx = c1 + axisAndAfterAxisSizeInBytes * i;
@@ -61,12 +61,12 @@ void GatherElements::prepareParams() {
const auto& dataDims = getParentEdgesAtPort(dataIndex_)[0]->getMemory().getStaticDims();
const auto& dstDims = getChildEdgesAtPort(0)[0]->getMemory().getStaticDims();
strideAxDst_ = 1;
for (int i = dstDims.size() - 1; i > axis_; i--)
for (size_t i = dstDims.size() - 1; i > axis_; i--)
strideAxDst_ *= dstDims[i];
dstAxDim_ = dstDims[axis_];
if (axis_ > 0) {
strideAx1Diff_ = 1;
for (int i = dataDims.size() - 1; i >= axis_; i--)
for (size_t i = dataDims.size() - 1; i >= axis_; i--)
strideAx1Diff_ *= dataDims[i];
strideAx1Diff_ -= strideAxDst_ * dstDims[axis_];
}
@@ -118,7 +118,7 @@ void GatherElements::directExecution() {
int dstAxIdx = (start / strideAxDst_) % dstAxDim_;
int dstShift0 = (start / strideAxDst_ / dstAxDim_) * strideAx1Diff_;
for (size_t o = start; o < end; o++, axStrideIt++) {
for (int o = start; o < end; o++, axStrideIt++) {
if (axStrideIt == strideAxDst_) {
axStrideIt = 0;
dstAxIdx++;
@@ -156,7 +156,8 @@ void GatherTree::GatherTreeExecutor::exec(const MemoryPtr& stepIdxMemPtr, const
finalIdx[idx + beam] = endToken;
for (int32_t parent = static_cast<int32_t>(beam); time >= 0; time--, idx -= bbSize) {
if (parent < 0 || parent >= static_cast<int32_t>(beamWidth) || idx + parent >= parentIdxSize) {
if (parent < 0 || parent >= static_cast<int32_t>(beamWidth) ||
static_cast<size_t>(idx + parent) >= parentIdxSize) {
incorrectResult = true;
break;
}
@@ -147,7 +147,7 @@ void nms_cpu(const int num_boxes, int is_dead[],
continue;
index_out[count++] = base_index + box;
if (count == max_num_out)
if (count == static_cast<size_t>(max_num_out))
break;
int tail = box + 1;
+2 -2
View File
@@ -180,7 +180,7 @@ void Generic::initDescriptor(const NodeConfig &config) {
IE_THROW() << resp.msg;
}
for (size_t j = 0; j < configs.size(); j++, t++) {
if (t == selectedPrimitiveDescriptorIndex) {
if (t == static_cast<size_t>(selectedPrimitiveDescriptorIndex)) {
selectedImpl = impls[k];
}
}
@@ -194,7 +194,7 @@ void Generic::initDescriptor(const NodeConfig &config) {
}
}
for (auto &outConf : rightConfig.outConfs) {
if (outConf.inPlace() < getParentEdges().size() &&
if (outConf.inPlace() < static_cast<int>(getParentEdges().size()) &&
getParentEdgeAt(static_cast<size_t>(outConf.inPlace()))->getParent()->getChildEdges().size() > 1) {
outConf.inPlace(-1);
}
@@ -221,7 +221,7 @@ static inline void cat(uint8_t* out,
int64_t bs,
size_t elemSize) {
size_t offset = 0;
for (int j = 0; j < feature_sizes.size(); j++) {
for (size_t j = 0; j < feature_sizes.size(); j++) {
cpu_memcpy(out + offset * elemSize, in[j] + bs * feature_sizes[j] * elemSize,
feature_sizes[j] * elemSize);
offset += feature_sizes[j];
@@ -230,7 +230,7 @@ static inline void cat(uint8_t* out,
static inline void flat_triangle(const uint8_t* in, uint8_t* out, size_t size, size_t elemSize) {
size_t offset = 0;
for (int i = 1; i < size; i++) {
for (size_t i = 1; i < size; i++) {
cpu_memcpy(out + offset * elemSize, in + i * size * elemSize, i * elemSize);
offset += i;
}
+25 -25
View File
@@ -378,11 +378,11 @@ private:
// xpass
if (xPass) {
mov(reg_dst_aux, reg_dst_xpass);
for (size_t ih = 0; ih < jcp_.IH; ih++) {
for (size_t ih = 0; ih < static_cast<size_t>(jcp_.IH); ih++) {
// reg_dst_xpass: point to start of this dst height
// reset reg_dst_aux to start of this height
mov(reg_weights, reg_weights_bk);
for (size_t ow = 0; ow < jcp_.OW; ow++) {
for (size_t ow = 0; ow < static_cast<size_t>(jcp_.OW); ow++) {
// reg_src: point to start of this src height src
// reset reg_src_aux to reg_src
mov(reg_src_aux, reg_src);
@@ -433,10 +433,10 @@ private:
add(reg_weights_bk, jcp_.OW * jcp_.filterLenX * sizeof(float));
mov(reg_weights, reg_weights_bk);
size_t bound_offset_y = jcp_.OW * 2;
for (size_t oh = 0; oh < jcp_.OH; oh++) {
for (size_t oh = 0; oh < static_cast<size_t>(jcp_.OH); oh++) {
filterS = jcp_.bound[bound_offset_y + oh * 2];
filterL = jcp_.bound[bound_offset_y + oh * 2 + 1];
for (size_t ow = 0; ow < jcp_.OW; ow++) {
for (size_t ow = 0; ow < static_cast<size_t>(jcp_.OW); ow++) {
mov(reg_src_aux, reg_src_ypass); // reg_src_aux to advance block
for (int blk = 0; blk < jcp_.C / vector_step; blk++) {
uni_vpxor(vmm_dst, vmm_dst, vmm_dst);
@@ -1484,7 +1484,7 @@ private:
uni_vmovdqu(ptr[rsp], vmm_indices);
int repeats = is_scalar ? 1 : vlen / sizeof(float);
for (size_t i = 0; i < repeats; ++i) {
for (int i = 0; i < repeats; ++i) {
mov(reg_tmp_64.cvt32(), ptr[rsp + i * sizeof(int)]); // sizeof(int) index_size
table_idx = ptr[base + offset + reg_tmp_64 * scale]; // scale: sizeof(float) value_size
mov(reg_tmp_64.cvt32(), table_idx);
@@ -1894,7 +1894,7 @@ Interpolate::Interpolate(const std::shared_ptr<ngraph::Node>& op, const GraphCon
axes = std::dynamic_pointer_cast<const ngraph::opset1::Constant>(interp->get_input_node_shared_ptr(AXES_ID))->cast_vector<int>();
} else {
axes.resize(dataRank);
for (int i = 0; i < dataRank; i++) {
for (int i = 0; i < static_cast<int>(dataRank); i++) {
axes[i] = i;
}
}
@@ -1963,7 +1963,7 @@ Interpolate::Interpolate(const std::shared_ptr<ngraph::Node>& op, const GraphCon
}
} else {
axes.resize(dataRank);
for (int i = 0; i < dataRank; i++) {
for (int i = 0; i < static_cast<int>(dataRank); i++) {
axes[i] = i;
}
}
@@ -1984,13 +1984,13 @@ void Interpolate::getSupportedDescriptors() {
int dataRank = getInputShapeAtPort(DATA_ID).getRank();
// get pad
for (int i = 0; i < interpAttrs.padBegin.size(); i++) {
for (size_t i = 0; i < interpAttrs.padBegin.size(); i++) {
if (interpAttrs.padBegin[i] != 0) {
hasPad = true;
break;
}
}
for (int i = 0; i < interpAttrs.padEnd.size(); i++) {
for (size_t i = 0; i < interpAttrs.padEnd.size(); i++) {
if (interpAttrs.padEnd[i] != 0) {
hasPad = true;
break;
@@ -2087,11 +2087,11 @@ void Interpolate::initSupportedPrimitiveDescriptors() {
if (useAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < config.inConfs.size(); i++) {
for (size_t i = 0; i < config.inConfs.size(); i++) {
srcMemoryDescs.push_back(config.inConfs[i].getMemDesc());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
dstMemoryDescs.push_back(config.outConfs[i].getMemDesc());
}
@@ -2302,7 +2302,7 @@ void Interpolate::prepareParams() {
interpAttrs.dataScales = dataScales;
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemoryDescs.push_back(getParentEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
@@ -2838,17 +2838,17 @@ void Interpolate::InterpolateExecutorBase::buildTblNN(const SizeVector& srcDimPa
bool isDDownsample = (fz < 1) ? true : false;
bool isHDownsample = (fy < 1) ? true : false;
bool isWDownsample = (fx < 1) ? true : false;
for (int oz = 0; oz < OD; oz++) {
for (size_t oz = 0; oz < OD; oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
auxTable[oz] = nearestRound(iz, isDDownsample, nearestMode);
auxTable[oz] = clipCoord(auxTable[oz], ID);
}
for (int oy = 0; oy < OH; oy++) {
for (size_t oy = 0; oy < OH; oy++) {
float iy = coordTransToInput(oy, fy, IH, OH);
auxTable[OD + oy] = nearestRound(iy, isHDownsample, nearestMode);
auxTable[OD + oy] = clipCoord(auxTable[OD + oy], IH);
}
for (int ox = 0; ox < OW; ox++) {
for (size_t ox = 0; ox < OW; ox++) {
float ix = coordTransToInput(ox, fx, IW, OW);
auxTable[OD + OH + ox] = nearestRound(ix, isWDownsample, nearestMode);
auxTable[OD + OH + ox] = clipCoord(auxTable[OD + OH + ox], IW);
@@ -3093,7 +3093,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const SizeVector& srcD
int *idxOH = static_cast<int*>(&idxTable[sizeOD]);
int *idxOW = static_cast<int*>(&idxTable[sizeOD + sizeOH]);
for (int oz = 0; oz < OD; oz++) {
for (size_t oz = 0; oz < OD; oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
int iz_r = static_cast<int>(std::round(iz));
for (int r = iz_r - rz, i = 0; r <= iz_r + rz; r++, i++) {
@@ -3106,7 +3106,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const SizeVector& srcD
}
}
}
for (int oy = 0; oy < OH; oy++) {
for (size_t oy = 0; oy < OH; oy++) {
float iy = coordTransToInput(oy, fy, IH, OH);
int iy_r = static_cast<int>(std::round(iy));
for (int r = iy_r - ry, i = 0; r <= iy_r + ry; r++, i++) {
@@ -3119,7 +3119,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const SizeVector& srcD
}
}
}
for (int ox = 0; ox < OW; ox++) {
for (size_t ox = 0; ox < OW; ox++) {
float ix = coordTransToInput(ox, fx, IW, OW);
int ix_r = static_cast<int>(std::round(ix));
for (int r = ix_r - rx, i = 0; r <= ix_r + rx; r++, i++) {
@@ -3583,11 +3583,11 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t *in_
parallel_for2d(B, C, [&](size_t b, size_t c) {
const uint8_t *in_ptr_nc = in_ptr_ + (IW * IH * ID * C * b + IW * IH * ID * c) * srcDataSize;
uint8_t *out_ptr_nc = out_ptr_ + (OW * OH * OD * C * b + OW * OH * OD * c) * dstDataSize;
for (size_t oz = 0; oz < OD; oz++) {
for (int oz = 0; oz < OD; oz++) {
uint8_t *out_ptr_ncd = out_ptr_nc + (OW * OH * oz) * dstDataSize;
for (size_t oy = 0; oy < OH; oy++) {
for (int oy = 0; oy < OH; oy++) {
uint8_t *out_ptr_ncdh = out_ptr_ncd + (OW * oy) * dstDataSize;
for (size_t ox = 0; ox < OW; ox++) {
for (int ox = 0; ox < OW; ox++) {
float sum = 0.f;
float wsum = 0.f;
@@ -3707,8 +3707,8 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t *in_ptr_, uint
int f, filterS, filterL;
float* weight;
if (xPass) {
for (size_t ih = 0; ih < IH; ih++) {
for (size_t ow = 0; ow < OW; ow++) {
for (size_t ih = 0; ih < static_cast<size_t>(IH); ih++) {
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
filterS = indexX[ow * 2];
filterL = indexX[ow * 2 + 1];
weight = reinterpret_cast<float*>(&weightX[ow * filterLenX]);
@@ -3725,11 +3725,11 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t *in_ptr_, uint
}
}
if (yPass) {
for (size_t oh = 0; oh < OH; oh++) {
for (size_t oh = 0; oh < static_cast<size_t>(OH); oh++) {
filterS = indexY[oh * 2];
filterL = indexY[oh * 2 + 1];
weight = reinterpret_cast<float*>(&weightY[oh * filterLenY]);
for (size_t ow = 0; ow < OW; ow++) {
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
result = 0.f;
for (f = 0; f < filterL; f++) {
float pixel = getValue(ypass_in_ptr_nc, ((f + filterS) * OW + ow) * srcDataSize, inputPrec);
@@ -987,7 +987,7 @@ template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::storeVectorPart(const Xbyak::Reg64& rDst, const Xbyak::Reg64& rToStoreCounter, Vmm& vmmSrc, Vmm& vAux) {
Xbyak::Label lEnd;
Xbyak::Xmm xAux(vAux.getIdx());
for (int j = 0; j < vlen / vlenXmm; j++) {
for (size_t j = 0; j < vlen / vlenXmm; j++) {
if (isa == x64::avx2)
vextracti128(xAux, vmmSrc, j);
else if (isa == x64::avx512_core)
@@ -520,7 +520,7 @@ void GridSampleKernel<x64::avx>::getTailCoordinates(const Vmm& vHCoord, const Vm
mov(rGridRest, regWorkAmount);
sal(rGridRest, 0x1); // multiply by gridShape[3] == 2
for (int i = 0; i < dataElPerVec; i++) {
for (size_t i = 0; i < dataElPerVec; i++) {
cmp(rGridRest, 0);
jle(lEnd, T_NEAR);
@@ -539,7 +539,7 @@ void GridSampleKernel<x64::avx>::getTailCoordinates(const Vmm& vHCoord, const Vm
vperm2f128(vWCoord, vWCoord, vWCoord, 0x1);
vperm2f128(vHCoord, vHCoord, vHCoord, 0x1);
for (int i = 0; i < dataElPerVec; i++) {
for (size_t i = 0; i < dataElPerVec; i++) {
cmp(rGridRest, 0);
jle(lLoop2End, T_NEAR);
@@ -1224,7 +1224,7 @@ void GridSampleKernel<isa>::nearestInterpolation(const Vmm& vWCoord, const Vmm&
mov(rSrcTmp, regSrc);
mov(rDstTmp, regDst);
for (int ch = 0; ch < jcp.cannelNum; ch++) {
for (uint64_t ch = 0; ch < jcp.cannelNum; ch++) {
if (jcp.dynamicChannel) {
rChannel = getReg64();
mov(rChannel, ptr[regParams + GET_OFF(channelsNum)]);
@@ -1334,7 +1334,7 @@ void GridSampleKernel<x64::avx512_core>::bilinearInterpolation(const Vmm& vWCoor
mov(rSrcTmp, regSrc);
mov(rDstTmp, regDst);
for (int ch = 0; ch < jcp.cannelNum; ch++) {
for (uint64_t ch = 0; ch < jcp.cannelNum; ch++) {
if (jcp.dynamicChannel) {
rChannel = getReg64();
mov(rChannel, 0);
@@ -1502,7 +1502,7 @@ void GridSampleKernel<isa>::bilinearInterpolation(const Vmm& vWCoord, const Vmm&
mov(rDstTmp, regDst);
mov(rTypeSize, ptr[regParams + GET_OFF(dataTypeSize)]);
for (int ch = 0; ch < jcp.cannelNum; ch++) {
for (uint64_t ch = 0; ch < jcp.cannelNum; ch++) {
if (jcp.dynamicChannel) {
rChannel = getReg64();
mov(rChannel, ptr[regParams + GET_OFF(channelsNum)]);
@@ -1663,7 +1663,7 @@ void GridSampleKernel<x64::avx512_core>::bicubicInterpolation(const Vmm& vWCoord
mov(rSrcTmp, regSrc);
mov(rDstTmp, regDst);
for (int ch = 0; ch < jcp.cannelNum; ch++) {
for (size_t ch = 0; ch < jcp.cannelNum; ch++) {
if (jcp.dynamicChannel) {
rChannel = getReg64();
mov(rChannel, 0);
@@ -1956,7 +1956,7 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
mov(rSrcTmp, regSrc);
mov(rDstTmp, regDst);
for (int ch = 0; ch < jcp.cannelNum; ch++) {
for (uint64_t ch = 0; ch < jcp.cannelNum; ch++) {
if (jcp.dynamicChannel) {
rChannel = getReg64();
mov(rChannel, ptr[regParams + GET_OFF(channelsNum)]);
@@ -298,7 +298,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Opmask& dstMask,
void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,
const Xbyak::Reg64& rWorkRest,
const uint64_t typeSize) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not fill data with type size " << typeSize;
}
Xbyak::Label lEnd;
@@ -327,7 +327,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,
void JitKernelBase::fillRestWorkMask(const Xbyak::Ymm& ymmDstMask,
const Xbyak::Reg64& rWorkRest,
const uint64_t typeSize) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not fill data with type size " << typeSize;
}
Xbyak::Label lEnd;
@@ -367,7 +367,7 @@ void JitKernelBase::load(const Xbyak::Xmm& vDst,
const Xbyak::Reg64& rLoadNum,
const size_t typeSize,
const bool zeroFilling) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not load data with type size " << typeSize;
}
const uint8_t elPerVec = x64::cpu_isa_traits<x64::sse41>::vlen / typeSize;
@@ -397,7 +397,7 @@ void JitKernelBase::load(const Xbyak::Ymm& vDst,
const Xbyak::Reg64& rLoadNum,
const size_t typeSize,
const bool zeroFilling) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not load data with type size " << typeSize;
}
const size_t elPerXmm = x64::cpu_isa_traits<x64::sse41>::vlen / typeSize;
@@ -436,7 +436,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,
const Xbyak::Xmm& vSrc,
const Xbyak::Reg64& rToStoreNum,
const size_t typeSize) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not store data with type size " << typeSize;
}
Xbyak::Label lEnd;
@@ -464,7 +464,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,
const Xbyak::Ymm& vSrc,
const Xbyak::Reg64& rToStoreNum,
const size_t typeSize) {
if (!one_of(typeSize, 1, 2, 4, 8)) {
if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
IE_THROW() << "Could not store data with type size " << typeSize;
}
Xbyak::Label lEnd;
@@ -144,7 +144,7 @@ protected:
}
size_t getUnused(size_t requestedIdx) {
if (requestedIdx == anyIdx) {
if (requestedIdx == static_cast<size_t>(anyIdx)) {
return getFirstFreeIndex();
} else {
if (requestedIdx >= isFreeIndexVector.size() || requestedIdx < 0) {
@@ -58,7 +58,7 @@ void Math::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
addSupportedPrimDesc(inDataConf,
+1 -1
View File
@@ -241,7 +241,7 @@ void MatMul::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dims, bool
DnnlPostOpsComposer dnnlpoc(getEngine(), attr, ops, postOpsArgs, dims, dims.size() - 1, isINT8, 1 << (dims.size() - 1), getDQScales(), withBiases);
for (int i = 0; i < fusedWith.size(); ++i) {
for (size_t i = 0; i < fusedWith.size(); ++i) {
auto& node = fusedWith[i];
bool isLastPostOp = (i == (fusedWith.size() - 1));
@@ -262,7 +262,7 @@ void MatrixNms::prepareParams() {
int64_t max_output_boxes_per_class = 0;
size_t real_num_classes = m_backgroundClass == -1 ? m_numClasses :
m_backgroundClass < m_numClasses ? m_numClasses - 1 : m_numClasses;
static_cast<size_t>(m_backgroundClass) < m_numClasses ? m_numClasses - 1 : m_numClasses;
if (m_nmsTopk >= 0)
max_output_boxes_per_class = std::min(m_numBoxes, static_cast<size_t>(m_nmsTopk));
else
@@ -283,7 +283,7 @@ void MatrixNms::prepareParams() {
m_classOffset.resize(m_numClasses, 0);
for (size_t i = 0, count = 0; i < m_numClasses; i++) {
if (i == m_backgroundClass)
if (i == static_cast<size_t>(m_backgroundClass))
continue;
m_classOffset[i] = (count++) * m_realNumBoxes;
}
@@ -306,7 +306,7 @@ void MatrixNms::execute(dnnl::stream strm) {
const float* scores = reinterpret_cast<const float*>(getParentEdgeAt(NMS_SCORES)->getMemoryPtr()->GetPtr());
InferenceEngine::parallel_for2d(m_numBatches, m_numClasses, [&](size_t batchIdx, size_t classIdx) {
if (classIdx == m_backgroundClass) {
if (classIdx == static_cast<size_t>(m_backgroundClass)) {
m_numPerBatchClass[batchIdx][classIdx] = 0;
return;
}
+7 -7
View File
@@ -888,7 +888,7 @@ void MHA::init_brgemm_copy_b(std::unique_ptr<jit_brgemm_matmul_copy_b_t>& brgCop
void MHA::prepareParams() {
auto transpose = [](const std::vector<size_t>& vec, const std::vector<size_t>& order) -> std::vector<size_t> {
std::vector<size_t> new_vec(vec.size());
for (int i = 0; i < vec.size(); i++) {
for (size_t i = 0; i < vec.size(); i++) {
new_vec[i] = vec[order[i]];
}
return new_vec;
@@ -952,7 +952,7 @@ void MHA::prepareParams() {
accPrecision0 = brg0Prc == Precision::I8 ? Precision::I32 : Precision::FP32;
size_t brg0BaseIdx = -1;
size_t brg0BaseIdx = std::numeric_limits<size_t>::max();
for (size_t m = 0; m < 2; m++) {
for (size_t k = 0; k < 2; k++) {
for (size_t n = 0; n < 2; n++) {
@@ -976,7 +976,7 @@ void MHA::prepareParams() {
// don't create brgemm kernels for empty tiles
if (M_ != 0 && K_ != 0 && N_ != 0) {
if (brg0BaseIdx == -1)
if (brg0BaseIdx == std::numeric_limits<size_t>::max())
brg0BaseIdx = getBrgIdx(m, k, n);
init_brgemm(brgemmCtx, brgKernels0[getBrgIdx(m, k, n)], brg0WithAMX);
}
@@ -1015,7 +1015,7 @@ void MHA::prepareParams() {
accPrecision1 = one_of(brg1PrcIn0, Precision::U8, Precision::I8) ? Precision::I32 : Precision::FP32;
size_t brg1BaseIdx = -1;
size_t brg1BaseIdx = std::numeric_limits<size_t>::max();
for (size_t m = 0; m < 2; m++) {
for (size_t k = 0; k < 2; k++) {
for (size_t n = 0; n < 2; n++) {
@@ -1039,7 +1039,7 @@ void MHA::prepareParams() {
// don't create brgemm kernels for empty tiles
if (M_ != 0 && K_ != 0 && N_ != 0) {
if (brg1BaseIdx == -1)
if (brg1BaseIdx == std::numeric_limits<size_t>::max())
brg1BaseIdx = getBrgIdx(m, k, n);
init_brgemm(brgemmCtx, brgKernels1[getBrgIdx(m, k, n)], brg1WithAMX);
@@ -1183,8 +1183,8 @@ void MHA::prepareParams() {
template<typename srcT, typename dstT>
static void reorder2D(const srcT* pin, dstT* pout, const std::vector<size_t>& dimsOut,
const std::vector<size_t>& stridesOut, const std::vector<size_t>& stridesIn) {
for (int i0 = 0; i0 < dimsOut[0]; i0++) {
for (int i1 = 0; i1 < dimsOut[1]; i1++) {
for (size_t i0 = 0; i0 < dimsOut[0]; i0++) {
for (size_t i1 = 0; i1 < dimsOut[1]; i1++) {
pout[i0 * stridesOut[0] + i1 * stridesOut[1]] = static_cast<dstT>(pin[i0 * stridesIn[0] + i1 * stridesIn[1]]);
}
}
@@ -171,7 +171,7 @@ void MultiClassNms::prepareParams() {
int max_output_boxes_per_class = 0;
size_t real_num_classes = m_backgroundClass == -1 ? m_numClasses :
m_backgroundClass < m_numClasses ? m_numClasses - 1 : m_numClasses;
static_cast<size_t>(m_backgroundClass) < m_numClasses ? m_numClasses - 1 : m_numClasses;
if (m_nmsTopK) {
max_output_boxes_per_class = (m_nmsTopK == -1) ? m_numBoxes :
std::min(m_nmsTopK, static_cast<int>(m_numBoxes));
@@ -263,12 +263,12 @@ void MultiClassNms::execute(dnnl::stream strm) {
startOffset = 0;
size_t offset = 0;
for (size_t b = 0; b < m_numFiltBox.size(); b++) {
if (m_numBoxOffset[b] > m_keepTopK) {
if (m_numBoxOffset[b] > static_cast<size_t>(m_keepTopK)) {
if (startOffset == offset) {
startOffset += m_keepTopK;
offset += m_numBoxOffset[b];
} else {
for (size_t i = 0; i < m_keepTopK; i++) {
for (int i = 0; i < m_keepTopK; i++) {
m_filtBoxes[startOffset + i] = m_filtBoxes[offset + i];
}
startOffset += m_keepTopK;
@@ -450,7 +450,8 @@ void MultiClassNms::nmsWithEta(const float* boxes,
fb.reserve(sorted_boxes.size());
if (sorted_boxes.size() > 0) {
auto adaptive_threshold = m_iouThreshold;
int max_out_box = (m_nmsRealTopk > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk;
int max_out_box =
(static_cast<size_t>(m_nmsRealTopk) > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk;
while (max_out_box && !sorted_boxes.empty()) {
boxInfo currBox = sorted_boxes.top();
float origScore = currBox.score;
@@ -563,8 +564,9 @@ void MultiClassNms::nmsWithoutEta(const float* boxes,
int offset = batch_idx * m_numClasses * m_nmsRealTopk + class_idx * m_nmsRealTopk;
m_filtBoxes[offset + 0] = filteredBoxes(sorted_boxes[0].first, batch_idx, class_idx, sorted_boxes[0].second);
io_selection_size++;
int max_out_box = (m_nmsRealTopk > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk;
for (size_t box_idx = 1; box_idx < max_out_box; box_idx++) {
int max_out_box =
(static_cast<size_t>(m_nmsRealTopk) > sorted_boxes.size()) ? sorted_boxes.size() : m_nmsRealTopk;
for (int box_idx = 1; box_idx < max_out_box; box_idx++) {
bool box_is_selected = true;
for (int idx = io_selection_size - 1; idx >= 0; idx--) {
float iou = intersectionOverUnion(&boxesPtr[sorted_boxes[box_idx].second * 4],
+39 -38
View File
@@ -342,17 +342,17 @@ private:
Xbyak::Reg64 reg_src_aux = reg_stride;
Xbyak::Reg64 reg_work_amount_bk = rbx;
mov(reg_work_amount_bk, reg_work_amount);
for (int ur_num = 0; ur_num < unroll_number; ur_num++) {
for (size_t ur_num = 0; ur_num < unroll_number; ur_num++) {
// 4-15 for unroll. 4-7 for src, 8-11 for m/v sum, 12-15 for mean
int ur_offset_elt = ur_num * unroll_size * vector_step;
int ur_offset = ur_offset_elt * sizeof(float);
size_t unroll_size_rt = std::min(vec_num - ur_num * unroll_size, unroll_size);
size_t elt_num = std::min(jcp_.C - ur_num * unroll_size * vector_step, unroll_size * vector_step);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vpxor(Vmm(ur_base + 4 + ur_size), Vmm(ur_base + 4 + ur_size), Vmm(ur_base + 4 + ur_size));
}
if (jcp_.normalize_variance) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmovups(Vmm(ur_base + 8 + ur_size), ptr[reg_mean + ur_offset + ur_size * vector_step * sizeof(float)]);
}
}
@@ -367,8 +367,8 @@ private:
cmp(reg_work_amount, 0);
jle(loop_end_label, T_NEAR);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > jcp_.C;
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > static_cast<size_t>(jcp_.C);
if (is_tails) {
load_tail_emitter->emit_code({static_cast<size_t>(reg_src_aux.getIdx())},
{static_cast<size_t>(ur_base + ur_size)}, {}, {load_pool_gpr_idxs});
@@ -384,18 +384,18 @@ private:
if (jcp_.normalize_variance) {
if (!isFloatCompatible(jcp_.src_prc)) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vcvtdq2ps(Vmm(ur_base + ur_size), Vmm(ur_base + ur_size));
}
}
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vsubps(Vmm(ur_base + ur_size), Vmm(ur_base + ur_size), Vmm(ur_base + 8 + ur_size));
}
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vfmadd231ps(Vmm(ur_base + 4 + ur_size), Vmm(ur_base + ur_size), Vmm(ur_base + ur_size));
}
} else {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
if (!isFloatCompatible(jcp_.src_prc))
uni_vpaddd(Vmm(ur_base + 4 + ur_size), Vmm(ur_base + 4 + ur_size), Vmm(ur_base + ur_size));
else
@@ -409,7 +409,7 @@ private:
L(loop_end_label);
// store sum/variance
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
if (jcp_.normalize_variance) {
uni_vmovups(ptr[reg_variance + ur_offset + ur_size * vector_step * sizeof(float)], Vmm(ur_base + 4 + ur_size));
} else {
@@ -603,12 +603,12 @@ private:
L(l_table);
if (mayiuse(avx512_core_vnni) && (jcp_.src_prc == Precision::U8 || jcp_.src_prc == Precision::I8)) {
for (size_t d = 0; d < vector_step; ++d) {
for (int d = 0; d < vector_step; ++d) {
dd(cvals[0]);
}
}
if (mayiuse(avx512_core_bf16) && jcp_.src_prc == Precision::BF16) {
for (size_t d = 0; d < vector_step; ++d) {
for (int d = 0; d < vector_step; ++d) {
dd(cvals[1]);
}
}
@@ -831,17 +831,17 @@ private:
Xbyak::Reg64 reg_oc_off_bk = rdi;
mov(reg_oc_off_bk, reg_oc_off);
mov(reg_work_amount_bk, reg_work_amount);
for (int ur_num = 0; ur_num < unroll_number; ur_num++) {
for (size_t ur_num = 0; ur_num < unroll_number; ur_num++) {
// 4-15 for unroll. 4-7 for src, 8-11 for m, 12-15 for v
int ur_offset_elt = ur_num * unroll_size * vector_step;
int ur_offset = ur_offset_elt * sizeof(float);
size_t unroll_size_rt = std::min(vec_num - ur_num * unroll_size, unroll_size);
size_t elt_num = std::min(jcp_.C - ur_num * unroll_size * vector_step, unroll_size * vector_step);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmovups(Vmm(ur_base + 4 + ur_size), ptr[reg_mean + ur_offset + ur_size * vector_step * sizeof(float)]);
}
if (jcp_.normalize_variance) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmovups(Vmm(ur_base + 8 + ur_size), ptr[reg_variance_inv + ur_offset + ur_size * vector_step * sizeof(float)]);
}
}
@@ -850,13 +850,13 @@ private:
for (int i = 0; i < optimized_scaleshift_num; i++) {
mov(reg_d_weights, ptr[reg_post_ops_data + post_ops_data_offset]);
add(reg_d_weights, ur_offset);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmovups(Vmm(16 + i * 4 + ur_size), ptr[reg_d_weights]);
add(reg_d_weights, vector_step * sizeof(float));
}
mov(reg_d_bias, ptr[reg_post_ops_data + post_ops_data_offset]);
add(reg_d_bias, ur_offset + jcp_.C * sizeof(float));
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmovups(Vmm(24 + i * 4 + ur_size), ptr[reg_d_bias]);
add(reg_d_bias, vector_step * sizeof(float));
}
@@ -875,8 +875,8 @@ private:
cmp(reg_work_amount, 0);
jle(loop_end_label, T_NEAR);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > jcp_.C;
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > static_cast<size_t>(jcp_.C);
if (is_tails) {
load_tail_emitter->emit_code({static_cast<size_t>(reg_src_aux.getIdx())},
{static_cast<size_t>(ur_base + ur_size)}, {}, {load_pool_gpr_idxs});
@@ -890,25 +890,25 @@ private:
add(reg_src_aux, (jcp_.C - elt_num) * jcp_.src_data_size);
prefetcht0(ptr[reg_src_aux]);
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vsubps(Vmm(ur_base + ur_size), Vmm(ur_base + ur_size), Vmm(ur_base + 4 + ur_size));
}
if (jcp_.normalize_variance) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vmulps(Vmm(ur_base + ur_size), Vmm(ur_base + ur_size), Vmm(ur_base + 8 + ur_size));
}
}
for (int i = 0; i < optimized_scaleshift_num; i++) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
uni_vfmadd132ps(Vmm(ur_base + ur_size), Vmm(24 + i * 4 + ur_size), Vmm(16 + i * 4 + ur_size));
}
}
if (attr_.post_ops_.len() != 0) {
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
apply_post_ops(jcp_.dst_prc, ur_base + ur_size, false);
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > jcp_.C;
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > static_cast<size_t>(jcp_.C);
if (is_tails)
add(reg_oc_off, tail_step * sizeof(float));
else
@@ -916,8 +916,8 @@ private:
}
}
for (int ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > jcp_.C;
for (size_t ur_size = 0; ur_size < unroll_size_rt; ur_size++) {
bool is_tails = ur_offset_elt + ur_size * vector_step + vector_step > static_cast<size_t>(jcp_.C);
if (is_tails) {
store_tail_emitter->emit_code({static_cast<size_t>(ur_base + ur_size)}, {static_cast<size_t>(reg_dst_aux.getIdx())},
{store_pool_vec_idxs}, {store_pool_gpr_idxs});
@@ -961,8 +961,8 @@ private:
mov(reg_oc_off, reg_oc_off_bk);
}
for (int v_num = 0; v_num < vec_num; v_num++) {
bool is_tail = (v_num * vector_step + vector_step > jcp_.C) ? true : false;
for (size_t v_num = 0; v_num < vec_num; v_num++) {
bool is_tail = (v_num * vector_step + vector_step > static_cast<size_t>(jcp_.C)) ? true : false;
worker_mvn(is_tail);
if (is_tail) {
add(reg_src, tail_step * jcp_.src_data_size);
@@ -1112,7 +1112,8 @@ bool MVN::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, st
return false;
}
} else {
if (inDataRank > 5 || (inDataRank != axesVal.size() + 1 && inDataRank != axesVal.size() + 2)) {
if (inDataRank > 5 || (static_cast<size_t>(inDataRank) != axesVal.size() + 1 &&
static_cast<size_t>(inDataRank) != axesVal.size() + 2)) {
errorMessage = "Unsupported axes.";
return false;
}
@@ -1209,11 +1210,11 @@ void MVN::initSupportedPrimitiveDescriptors() {
if (useAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < config.inConfs.size(); i++) {
for (size_t i = 0; i < config.inConfs.size(); i++) {
srcMemoryDescs.push_back(config.inConfs[i].getMemDesc());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
dstMemoryDescs.push_back(config.outConfs[i].getMemDesc());
}
@@ -1369,7 +1370,7 @@ void MVN::prepareParams() {
if (canUseAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemoryDescs.push_back(getParentEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
@@ -1860,7 +1861,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
// // \|/
/////////////////////////////////
auto mean_buffer_ptr = &mean_buffer[blk_size * parallel_get_thread_num()];
for (int i = 0; i < blk_size; i++)
for (size_t i = 0; i < blk_size; i++)
mean_buffer_ptr[i] = 0.f;
auto arg = jit_mvn_call_args();
@@ -1872,7 +1873,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
(*mvn_mean_kernel)(&arg); // for W * blk
size_t min_cb = (std::min)(blk_size, C - cb * blk_size);
for (int i = 0; i < min_cb; i++)
for (size_t i = 0; i < min_cb; i++)
mean_internal += mean_buffer_ptr[i];
return mean_internal;
});
@@ -1886,7 +1887,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
float variance_internal = 0.0f;
auto variance_buffer_ptr = &variance_buffer[blk_size * parallel_get_thread_num()];
for (int i = 0; i < blk_size; i++)
for (size_t i = 0; i < blk_size; i++)
variance_buffer_ptr[i] = 0.f;
auto arg = jit_mvn_call_args();
@@ -1900,7 +1901,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
(*mvn_variance_kernel)(&arg);
size_t min_cb = (std::min)(blk_size, C - cb * blk_size);
for (int i = 0; i < min_cb; i++)
for (size_t i = 0; i < min_cb; i++)
variance_internal += variance_buffer_ptr[i];
return variance_internal;
});
@@ -1944,7 +1945,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
}
} else { // for per_channel
float size_inv = 1.f / static_cast<float>(D * H * W);
for (int i = 0; i < mean_buffer.size(); i++)
for (size_t i = 0; i < mean_buffer.size(); i++)
mean_buffer[i] = 0.f;
// one thread for one C*W size(the same H) to get C size result for the same H, added to last group result
@@ -1973,7 +1974,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data, uint8_t* dst_data, co
mean_buffer[c] *= size_inv;
if (mvnAttrs.normalizeVariance_) {
for (int i = 0; i < variance_buffer.size(); i++)
for (size_t i = 0; i < variance_buffer.size(); i++)
variance_buffer[i] = 0.f;
parallel_for2d(D, H, [&](size_t thr_idx, size_t d, size_t h) {
@@ -650,14 +650,14 @@ void NonMaxSuppression::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i) {
for (size_t i = 0; i < inputShapes.size(); ++i) {
Precision inPrecision = i == NMS_MAXOUTPUTBOXESPERCLASS ? Precision::I32 : Precision::FP32;
inDataConf.emplace_back(LayoutType::ncsp, inPrecision);
}
std::vector<PortConfigurator> outDataConf;
outDataConf.reserve(outputShapes.size());
for (int i = 0; i < outputShapes.size(); ++i) {
for (size_t i = 0; i < outputShapes.size(); ++i) {
Precision outPrecision = i == NMS_SELECTEDSCORES ? Precision::FP32 : Precision::I32;
outDataConf.emplace_back(LayoutType::ncsp, outPrecision);
}
@@ -891,7 +891,7 @@ void NonMaxSuppression::nmsWithSoftSigma(const float *boxes, const float *scores
const float *scoresPtr = scores + batch_idx * scoresStrides[0] + class_idx * scoresStrides[1];
std::priority_queue<boxInfo, std::vector<boxInfo>, decltype(less)> sorted_boxes(less); // score, box_id, suppress_begin_index
for (int box_idx = 0; box_idx < numBoxes; box_idx++) {
for (int box_idx = 0; box_idx < static_cast<int>(numBoxes); box_idx++) {
if (scoresPtr[box_idx] > scoreThreshold)
sorted_boxes.emplace(boxInfo({scoresPtr[box_idx], box_idx, 0}));
}
@@ -1000,7 +1000,7 @@ void NonMaxSuppression::nmsWithoutSoftSigma(const float *boxes, const float *sco
const float *scoresPtr = scores + batch_idx * scoresStrides[0] + class_idx * scoresStrides[1];
std::vector<std::pair<float, int>> sorted_boxes; // score, box_idx
for (int box_idx = 0; box_idx < numBoxes; box_idx++) {
for (size_t box_idx = 0; box_idx < numBoxes; box_idx++) {
if (scoresPtr[box_idx] > scoreThreshold)
sorted_boxes.emplace_back(std::make_pair(scoresPtr[box_idx], box_idx));
}
+1 -1
View File
@@ -84,7 +84,7 @@ std::vector<size_t> NonZero::getNonZeroElementsCount(const T* src, const Shape&
}
default: {
threadsCount = parallel_get_num_threads();
if (inSize < blockSize * threadsCount)
if (inSize < static_cast<size_t>(blockSize * threadsCount))
threadsCount = 1;
counts.resize(threadsCount);
@@ -644,9 +644,9 @@ private:
// is_broadcast for broadcasting param for depth_wise and quantize, for fusion with plain layout.
void apply_post_ops(memory::data_type dst_dt, bool is_broadcast) {
const auto &p = attr_.post_ops_;
int eltwise_inj_idx = 0;
int depthwise_inj_idx = 0;
int quantization_inj_idx = 0;
size_t eltwise_inj_idx = 0;
size_t depthwise_inj_idx = 0;
size_t quantization_inj_idx = 0;
int post_ops_data_offset = 0;
for (int i = 0; i < p.len(); i++) {
auto& post_op = p.entry_[i];
+1 -1
View File
@@ -133,7 +133,7 @@ OneHot::OneHot(const std::shared_ptr<ngraph::Node>& op, const GraphContext::CPtr
bool OneHot::needShapeInfer() const {
const auto depthNodePtr = reinterpret_cast<int32_t *>(getParentEdgesAtPort(1)[0]->getMemoryPtr()->GetPtr());
if (depth != depthNodePtr[0]) {
if (depth != static_cast<size_t>(depthNodePtr[0])) {
depth = depthNodePtr[0];
return true;
}
+15 -15
View File
@@ -180,7 +180,7 @@ bool Pad::needPrepareParams() const {
void Pad::createPrimitive() {
if (srcMemory.empty()) {
for (int i = 0; i < getOriginalInputsNumber(); i++) {
for (size_t i = 0; i < getOriginalInputsNumber(); i++) {
srcMemory.push_back(getParentEdgeAt(i)->getMemoryPtr());
}
}
@@ -276,7 +276,7 @@ void Pad::PadExecutor::paramsInitialization(const PadAttrs& attrs,
params.attrs.beginPadIdx = 0;
params.attrs.endPadIdx = params.attrs.padsBegin.size() - 1;
for (int i = 0; i < params.attrs.padsBegin.size(); ++i) {
for (size_t i = 0; i < params.attrs.padsBegin.size(); ++i) {
if (params.attrs.padsBegin[i] != 0 || params.attrs.padsEnd[i] != 0) {
params.attrs.beginPadIdx = i - 1;
break;
@@ -411,7 +411,7 @@ static inline size_t parallel_init(size_t start, size_t nDims, const VectorDims&
static inline void parallel_step(size_t nDims, const VectorDims& dims, std::vector<int32_t>& indexes) {
for (int j = nDims - 1; j >= 0; --j) {
++indexes[j];
if (indexes[j] < dims[j])
if (static_cast<size_t>(indexes[j]) < dims[j])
break;
else
indexes[j] = 0;
@@ -463,7 +463,7 @@ void Pad::PadExecutor::padConstantCommon(MemoryPtr& srcMemPtr, MemoryPtr& dstMem
for (size_t iwork = start; iwork < end; ++iwork, dstIdx += params.lastDstDim) {
size_t j = 0;
for (; j < params.nDimsForWork; ++j) {
if (indexes[j] < params.attrs.padsBegin[j] || indexes[j] >= params.srcODims[j])
if (indexes[j] < params.attrs.padsBegin[j] || static_cast<size_t>(indexes[j]) >= params.srcODims[j])
break;
}
@@ -503,7 +503,7 @@ void Pad::PadExecutor::padConstantZero(MemoryPtr& srcMemPtr, MemoryPtr& dstMemPt
for (size_t iwork = start; iwork < end; ++iwork, dstIdx += params.lastDstDim) {
size_t j = 0;
for (; j < params.nDimsForWork; ++j) {
if (indexes[j] < params.attrs.padsBegin[j] || indexes[j] >= params.srcODims[j])
if (indexes[j] < params.attrs.padsBegin[j] || static_cast<size_t>(indexes[j]) >= params.srcODims[j])
break;
}
@@ -544,11 +544,11 @@ void Pad::PadExecutor::padEdge(MemoryPtr& srcMemPtr, MemoryPtr& dstMemPtr) {
for (size_t iwork = start; iwork < end; ++iwork, dstIdx += params.lastDstDim) {
size_t srcIdx = 0;
for (size_t idx = 0; idx < params.nDimsForWork; ++idx) {
size_t shift =
(indexes[idx] < params.attrs.padsBegin[idx])
? 0
: ((indexes[idx] >= params.srcODims[idx]) ? (params.srcDims[idx] - 1)
: (indexes[idx] - params.attrs.padsBegin[idx]));
size_t shift = (indexes[idx] < params.attrs.padsBegin[idx])
? 0
: ((static_cast<size_t>(indexes[idx]) >= params.srcODims[idx])
? (params.srcDims[idx] - 1)
: (indexes[idx] - params.attrs.padsBegin[idx]));
srcIdx += shift * params.srcStrides[idx];
}
srcIdx *= params.dataSize;
@@ -587,11 +587,11 @@ void Pad::PadExecutor::padReflectOrSymmetric(MemoryPtr& srcMemPtr, MemoryPtr& ds
for (size_t iwork = start; iwork < end; ++iwork, dstIdx += params.lastDstDim) {
size_t srcIdx = 0;
for (size_t i = 0; i < params.nDimsForWork; ++i) {
size_t idx =
(indexes[i] < params.attrs.padsBegin[i])
? (params.attrs.padsBegin[i] - indexes[i] - shift)
: ((indexes[i] >= params.srcODims[i]) ? (params.srcDimsForReflectOrSymmetric[i] - indexes[i])
: (indexes[i] - params.attrs.padsBegin[i]));
size_t idx = (indexes[i] < params.attrs.padsBegin[i])
? (params.attrs.padsBegin[i] - indexes[i] - shift)
: ((static_cast<size_t>(indexes[i]) >= params.srcODims[i])
? (params.srcDimsForReflectOrSymmetric[i] - indexes[i])
: (indexes[i] - params.attrs.padsBegin[i]));
srcIdx += idx * params.srcStrides[i];
}
srcIdx *= params.dataSize;
+7 -7
View File
@@ -242,7 +242,7 @@ void Pooling::initEffectiveAttributes(const Shape &inShape, const Shape &outShap
const auto &inDims = inShape.getStaticDims();
const auto &outDims = outShape.getStaticDims();
for (int i = 0; i < poolingAttrs.effective_pad_end.size(); i++) {
for (size_t i = 0; i < poolingAttrs.effective_pad_end.size(); i++) {
int krn = poolingAttrs.kernel[i];
int dil = poolingAttrs.dilation[i];
int src = inDims[2 + i];
@@ -395,11 +395,11 @@ void Pooling::prepareParams() {
IE_THROW() << "Input memory didn't allocate.";
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < getOriginalInputsNumber(); i++) {
for (size_t i = 0; i < getOriginalInputsNumber(); i++) {
srcMemoryDescs.push_back(getParentEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < getOriginalOutputsNumber(); i++) {
for (size_t i = 0; i < getOriginalOutputsNumber(); i++) {
dstMemoryDescs.push_back(getChildEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
@@ -487,11 +487,11 @@ void Pooling::execute(dnnl::stream strm) {
dnnlExecPtr->exec(primArgs, strm);
} else if (execPtr) {
std::vector<MemoryCPtr> srcMemory;
for (int i = 0; i < getOriginalInputsNumber(); i++) {
for (size_t i = 0; i < getOriginalInputsNumber(); i++) {
srcMemory.push_back(getParentEdgeAt(i)->getMemoryPtr());
}
std::vector<MemoryPtr> dstMemory;
for (int i = 0; i < getOriginalOutputsNumber(); i++) {
for (size_t i = 0; i < getOriginalOutputsNumber(); i++) {
dstMemory.push_back(getChildEdgeAt(i)->getMemoryPtr());
}
@@ -599,11 +599,11 @@ void Pooling::initSupportedPrimitiveDescriptors() {
creatorsMap.at(format)->createSharedDesc(getOriginalOutputPrecisionAtPort(0), getOutputShapeAtPort(0)));
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < config.inConfs.size(); i++) {
for (size_t i = 0; i < config.inConfs.size(); i++) {
srcMemoryDescs.push_back(config.inConfs[i].getMemDesc());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
dstMemoryDescs.push_back(config.outConfs[i].getMemDesc());
}
@@ -166,7 +166,7 @@ void PriorBoxClustered::execute(dnnl::stream strm) {
float center_x = (w + offset) * step_w;
float center_y = (h + offset) * step_h;
for (size_t s = 0; s < number_of_priors; ++s) {
for (int s = 0; s < number_of_priors; ++s) {
float box_width = widths[s];
float box_height = heights[s];
+2 -2
View File
@@ -35,7 +35,7 @@ static std::vector<float> generate_anchors(proposal_conf &conf) {
const float center = 0.5f * (base_size - coordinates_offset);
// enumerate all transformed boxes
for (int ratio = 0; ratio < num_ratios; ++ratio) {
for (size_t ratio = 0; ratio < num_ratios; ++ratio) {
// transformed width & height for given ratio factors
float ratio_w;
float ratio_h;
@@ -52,7 +52,7 @@ static std::vector<float> generate_anchors(proposal_conf &conf) {
float * const p_anchors_wp = anchors_ptr + 2 * num_ratios * num_scales + ratio * num_scales;
float * const p_anchors_hp = anchors_ptr + 3 * num_ratios * num_scales + ratio * num_scales;
for (int scale = 0; scale < num_scales; ++scale) {
for (size_t scale = 0; scale < num_scales; ++scale) {
// transformed width & height for given scale factors
const float scale_w = 0.5f * (ratio_w * scales[scale] - coordinates_offset);
const float scale_h = 0.5f * (ratio_h * scales[scale] - coordinates_offset);
@@ -197,8 +197,8 @@ void PSROIPooling::unpackParams(const BlockedMemoryDesc& srcDesc, const BlockedM
unsigned long& inputChannelsPadding, unsigned long& outputChannelsPadding) {
const bool inpIsBlk = srcDesc.hasLayoutType(LayoutType::nCsp16c) || srcDesc.hasLayoutType(LayoutType::nCsp8c);
const bool outIsBlk = dstDesc.hasLayoutType(LayoutType::nCsp16c) || dstDesc.hasLayoutType(LayoutType::nCsp8c);
int expectedInBlockDimsSize = (inpIsBlk ? 5 : 4);
int expectedOutBlockDimsSize = (outIsBlk ? 5 : 4);
size_t expectedInBlockDimsSize = (inpIsBlk ? 5 : 4);
size_t expectedOutBlockDimsSize = (outIsBlk ? 5 : 4);
auto inBlkDims = srcDesc.getBlockDims();
auto outBlkDims = dstDesc.getBlockDims();
if (inBlkDims.size() != expectedInBlockDimsSize)
@@ -214,14 +214,14 @@ void PSROIPooling::unpackParams(const BlockedMemoryDesc& srcDesc, const BlockedM
outputChannelsPadding = dstDesc.getBlockDims()[1] * outBlockSize;
outBlockCount = outputChannelsPadding / outBlockSize;
int hOutStrIndex = 0, wOutStrIndex = 0, hInStrIndex = 0, wInStrIndex = 0;
size_t hOutStrIndex = 0, wOutStrIndex = 0, hInStrIndex = 0, wInStrIndex = 0;
const auto& outOrder = dstDesc.getOrder();
const auto& inOrder = srcDesc.getOrder();
for (int i = 0; i < outOrder.size(); i++) {
for (size_t i = 0; i < outOrder.size(); i++) {
if (outOrder[i] == 2) hOutStrIndex = i;
if (outOrder[i] == 3) wOutStrIndex = i;
}
for (int i = 0; i < inOrder.size(); i++) {
for (size_t i = 0; i < inOrder.size(); i++) {
if (inOrder[i] == 2) hInStrIndex = i;
if (inOrder[i] == 3) wInStrIndex = i;
}
+2 -2
View File
@@ -72,14 +72,14 @@ void Range::initSupportedPrimitiveDescriptors() {
getOriginalInputPrecisionAtPort(RANGE_DELTA) == Precision::FP32 &&
getOriginalOutputPrecisionAtPort(0) == Precision::FP32)) {
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
outDataConf.reserve(1);
outDataConf.emplace_back(LayoutType::ncsp, Precision::FP32);
addSupportedPrimDesc(inDataConf, outDataConf, impl_desc_type::ref_any);
} else {
inDataConf.reserve(inputShapes.size());
for (int i = 0; i < inputShapes.size(); ++i)
for (size_t i = 0; i < inputShapes.size(); ++i)
inDataConf.emplace_back(LayoutType::ncsp);
outDataConf.reserve(1);
outDataConf.emplace_back(LayoutType::ncsp);
+10 -9
View File
@@ -236,7 +236,7 @@ bool RDFT::axesChanged() const {
auto inputRank = inputShapes[DATA_INDEX].getRank() - inverse;
for (size_t i = 0; i < axes.size(); i++) {
auto newAxis = axesPtr[i] < 0 ? axesPtr[i] + inputRank : axesPtr[i];
if (axes[i] != newAxis) {
if (static_cast<size_t>(axes[i]) != newAxis) {
return true;
}
}
@@ -255,11 +255,12 @@ bool RDFT::signalSizesChanged() const {
if (getOriginalInputsNumber() <= SIGNAL_SIZE_INDEX) {
const auto& inputShape = getParentEdgeAt(DATA_INDEX)->getMemory().getStaticDims();
for (size_t i = 0; i < axes.size() - 1; i++) {
if (signalSizes[i] != inputShape[axes[i]]) {
if (static_cast<size_t>(signalSizes[i]) != inputShape[axes[i]]) {
return true;
}
}
return inverse ? signalSizes.back() != 2 * (inputShape[axes.back()] - 1) : signalSizes.back() != inputShape[axes.back()];
return inverse ? static_cast<size_t>(signalSizes.back()) != 2 * (inputShape[axes.back()] - 1)
: static_cast<size_t>(signalSizes.back()) != inputShape[axes.back()];
} else {
const auto& signalSizesMem = getParentEdgeAt(SIGNAL_SIZE_INDEX)->getMemoryPtr();
auto newSize = signalSizesMem->getStaticDims()[0];
@@ -328,7 +329,7 @@ void RDFTExecutor::execute(float* inputPtr, float* outputPtr,
static void coordsFromIndex(size_t index, std::vector<size_t>& coords, const std::vector<size_t>& shape, int excludeAxis) {
for (size_t i = coords.size(); i > 0; i--) {
if (excludeAxis == i - 1) {
if (static_cast<size_t>(excludeAxis) == i - 1) {
coords[i - 1] = 0;
continue;
}
@@ -771,17 +772,17 @@ struct RDFTJitExecutor : public RDFTExecutor {
parallel_for2d(outputSize / simdSize, inputSize, [&] (size_t K, size_t n) {
if (type == real_to_complex) {
for (size_t k = 0; k < simdSize; k++) {
for (int k = 0; k < simdSize; k++) {
double angle = 2 * PI * (K * simdSize + k) * n / inputSize;
twiddles[((K * inputSize + n) * simdSize + k) * 2] = std::cos(angle);
twiddles[((K * inputSize + n) * simdSize + k) * 2 + 1] = -std::sin(angle);
}
} else if (type == complex_to_real || type == complex_to_complex) {
for (size_t k = 0; k < simdSize; k++) {
for (int k = 0; k < simdSize; k++) {
double angle = 2 * PI * (K * simdSize + k) * n / inputSize;
twiddles[(K * inputSize + n) * 2 * simdSize + k] = std::cos(angle);
}
for (size_t k = 0; k < simdSize; k++) {
for (int k = 0; k < simdSize; k++) {
double angle = 2 * PI * (K * simdSize + k) * n / inputSize;
twiddles[((K * inputSize + n) * 2 + 1) * simdSize + k] = isInverse ? std::sin(angle) : -std::sin(angle);
}
@@ -895,7 +896,7 @@ struct RDFTRefExecutor : public RDFTExecutor {
}
if (isInverse) {
float* inp = inputPtr + 2 * (inputSize - 2 + outputSize % 2);
for (int n = inputSize; n < signalSize; n++, inp -= 2) {
for (size_t n = inputSize; n < signalSize; n++, inp -= 2) {
float cos = twiddlesPtr[2 * (k * outputSize + n)];
float sin = twiddlesPtr[2 * (k * outputSize + n) + 1];
float inputReal = inp[0];
@@ -945,7 +946,7 @@ struct RDFTRefExecutor : public RDFTExecutor {
if (parallelize) {
parallel_for(outputSize, dftIteration);
} else {
for (int k = 0; k < outputSize; k++) {
for (size_t k = 0; k < outputSize; k++) {
dftIteration(k);
}
}
+4 -4
View File
@@ -1848,11 +1848,11 @@ void Reduce::initSupportedPrimitiveDescriptors() {
if (useAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < config.inConfs.size(); i++) {
for (size_t i = 0; i < config.inConfs.size(); i++) {
srcMemoryDescs.push_back(config.inConfs[i].getMemDesc());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
for (int i = 0; i < config.outConfs.size(); i++) {
for (size_t i = 0; i < config.outConfs.size(); i++) {
dstMemoryDescs.push_back(config.outConfs[i].getMemDesc());
}
@@ -1923,7 +1923,7 @@ bool Reduce::isExecutable() const {
void Reduce::prepareParams() {
if (canUseAclExecutor) {
std::vector<MemoryDescPtr> srcMemoryDescs;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemoryDescs.push_back(getParentEdgeAt(i)->getMemoryPtr()->getDescPtr());
}
std::vector<MemoryDescPtr> dstMemoryDescs;
@@ -2090,7 +2090,7 @@ void Reduce::execute(dnnl::stream strm) {
reduce_type(src_data, dst_data, dst_size);
} else if (aclExecPtr) {
std::vector<MemoryCPtr> srcMemory;
for (int i = 0; i < getParentEdges().size(); i++) {
for (size_t i = 0; i < getParentEdges().size(); i++) {
srcMemory.push_back(getParentEdgeAt(i)->getMemoryPtr());
}
std::vector<MemoryPtr> dstMemory;
@@ -390,7 +390,7 @@ void RegionYolo::execute(dnnl::stream strm) {
size_t mask_size = mask.size();
int end_index = 0;
int num_ = 0;
int output_size = 0;
size_t output_size = 0;
if (do_softmax) {
// Region layer (Yolo v2)
end_index = IW * IH;
@@ -416,7 +416,7 @@ void RegionYolo::execute(dnnl::stream strm) {
cpu_convert(src_data, dst_data, getParentEdgeAt(0)->getMemory().getDesc().getPrecision(),
getChildEdgeAt(0)->getMemory().getDesc().getPrecision(), output_size);
for (int b = 0; b < B; b++) {
for (size_t b = 0; b < B; b++) {
for (int n = 0; n < num_; n++) {
size_t index = b * inputs_size + n * IW * IH * (classes + coords + 1);
calculate_logistic(index, total_size, dst_data);
@@ -429,7 +429,7 @@ void RegionYolo::execute(dnnl::stream strm) {
if (do_softmax) {
int index = IW * IH * (coords + 1);
int batch_offset = inputs_size / num;
for (int b = 0; b < B * num; b++) {
for (size_t b = 0; b < B * num; b++) {
softmax_kernel->execute(src_data + input_prec.size() * (index + b * batch_offset),
dst_data + output_prec.size() * (index + b * batch_offset), 1, classes, IH, IW);
}
+5 -5
View File
@@ -58,8 +58,8 @@ public:
size_t outputProduct = 1;
int32_t minusOneIdx = -1;
int32_t minusOneCount = 0;
for (size_t i = 0; i < outputPatternSize; ++i) {
if (outPattern[i] == 0 && m_specialZero && i < inputShapeSize) {
for (int32_t i = 0; i < outputPatternSize; ++i) {
if (outPattern[i] == 0 && m_specialZero && i < static_cast<int32_t>(inputShapeSize)) {
outputShape[i] = inputShape[i];
} else if (outPattern[i] == -1) {
minusOneIdx = i;
@@ -71,7 +71,7 @@ public:
}
size_t inputProduct = 1;
for (size_t i = 0; i < inputShapeSize; ++i) {
if (i < outputPatternSize && outPattern[i] == 0 && m_specialZero)
if (static_cast<int>(i) < outputPatternSize && outPattern[i] == 0 && m_specialZero)
continue;
inputProduct *= inputShape[i];
}
@@ -119,7 +119,7 @@ public:
ov::util::Cast<int64_t>());
std::vector<bool> removeMask(inputShapeSize, false);
bool existError = false;
for (size_t i = 0; i < outputPatternSize; i++) {
for (int i = 0; i < outputPatternSize; i++) {
if (outPattern[i] < 0) {
outPattern[i] = inputShapeSize + outPattern[i];
}
@@ -175,7 +175,7 @@ public:
size_t outputShapeSize = inputShapeSize + outputPatternSize;
VectorDims outputShape(outputShapeSize, 0);
bool existError = false;
for (size_t i = 0; i < outputPatternSize; i++) {
for (int i = 0; i < outputPatternSize; i++) {
if (outPattern[i] < 0) {
outPattern[i] = outputShapeSize + outPattern[i];
}
+4 -4
View File
@@ -713,10 +713,10 @@ void RNN::fillWeights(const int *gate_map, const size_t wIdx, const size_t rIdx)
const int step = SC * G;
for (int g = 0; g < G; g++) {
for (int out_i = 0; out_i < SC; out_i++) {
for (size_t g = 0; g < G; g++) {
for (size_t out_i = 0; out_i < SC; out_i++) {
Prec *l_w_ptr = w_ptr + gate_map[g] * SC + out_i;
for (int in_i = 0; in_i < DC; in_i++) {
for (size_t in_i = 0; in_i < DC; in_i++) {
*l_w_ptr = *ie_w_ptr;
ie_w_ptr++;
l_w_ptr += step;
@@ -762,7 +762,7 @@ void RNN::fillBiases(const int *gate_map) {
Prec,
elementsCount);
for (int g = 0; g < Gb; g++) {
for (size_t g = 0; g < Gb; g++) {
dataType *l_b_ptr = b_ptr + gate_map[g] * SC;
const dataType *l_ie_b_ptr = &ie_b_vec[g * SC];
cpu_memcpy(l_b_ptr, l_ie_b_ptr, SC * sizeof(typename PrecisionTrait<Prec>::value_type));
@@ -943,7 +943,7 @@ void ROIAlign::executeSpecified() {
int roiBatchInd = srcRoiIdx[n];
if (roiBatchInd < -1) { // -1 means switched off region
IE_THROW() << "Batch index cannot be less, than -1";
} else if (roiBatchInd >= inputDimVector[0]) {
} else if (static_cast<size_t>(roiBatchInd) >= inputDimVector[0]) {
IE_THROW() << "Demanded batch (id = " << roiBatchInd << ") doesn't exist";
}
@@ -290,7 +290,7 @@ void ScatterUpdate::execute(dnnl::stream strm) {
parallel_nt(0, [&](const int ithr, const int nthr) {
size_t start = 0, end = 0;
splitter(indicesBlockND[0], nthr, ithr, start, end);
for (int i = start; i < end; i++) {
for (size_t i = start; i < end; i++) {
int64_t idxValue = getIndicesValue(indicesPtr, i);
if (idxValue >= static_cast<int64_t>(srcDimAxis) || idxValue < 0) {
IE_THROW() << errorPrefix
@@ -307,7 +307,7 @@ void ScatterUpdate::execute(dnnl::stream strm) {
SizeVector expectUpdateShape(srcRank + indicesRank - 1, 0);
int axisIter = 0;
for (size_t rs = 0; rs < srcRank; rs++) {
if (rs != axis) {
if (rs != static_cast<size_t>(axis)) {
expectUpdateShape[axisIter] = srcDataDim[rs];
axisIter++;
} else {
@@ -382,7 +382,7 @@ void ScatterUpdate::scatterUpdate(uint8_t *indices, uint8_t *update, int axis, u
idxLength *= indicesDim[ri];
}
size_t batchToUpdate = mulIdentity;
for (size_t x = 0; x < axis; x++) {
for (int x = 0; x < axis; x++) {
batchToUpdate *= srcDataDim[x];
}
// blockToUpdate is srcBlockND[axis + 1], also is updateBlockND[axis + indicesRank]
@@ -417,7 +417,7 @@ void ScatterUpdate::scatterNDUpdate(uint8_t *indices, uint8_t *update, uint8_t *
parallel_for(idxTupleNum, [&](size_t tupleIdx) {
size_t indicesOffset = tupleIdx * k;
size_t dstOffset = 0;
for (int i = 0; i < k; i++) {
for (size_t i = 0; i < k; i++) {
size_t idxValue = getIndicesValue(indices, indicesOffset + i);
dstOffset += idxValue * srcBlockND[i + 1];
}
@@ -462,7 +462,7 @@ void ScatterUpdate::scatterElementsUpdate(uint8_t *indices, uint8_t *update, int
for (j = updateRank - 1; j >= 0; j--) {
tensorItr[j]++;
if (tensorItr[j] < updateDim[j]) {
if (j != static_cast<size_t>(axis))
if (j != axis)
dst_idx += srcBlockND[j + 1];
break;
} else {
@@ -268,7 +268,7 @@ ShuffleChannels::ShuffleChannelsExecutor::ShuffleChannelsExecutor(const ShuffleC
std::iota(params.src_block_order.begin(), params.src_block_order.end(), 0);
std::iota(params.dst_block_order.begin(), params.dst_block_order.end(), 0);
for (size_t i = 0; i < reshapedRank; i++)
for (int i = 0; i < reshapedRank; i++)
params.dst_block_dims[i] = params.src_block_dims[params.order[i]];
permuteKernel = std::unique_ptr<PermuteKernel>(new PermuteKernel(params));
+2 -2
View File
@@ -418,7 +418,7 @@ void Split::selectOptimalPrimitiveDescriptor() {
if (parent_spd != nullptr && !parent_spd->getConfig().outConfs.empty()) {
int inNum = parentEdge->getInputNum();
if (inNum < 0 || inNum >= parent_spd->getConfig().outConfs.size()) {
if (inNum < 0 || static_cast<size_t>(inNum) >= parent_spd->getConfig().outConfs.size()) {
inNum = 0;
}
if (supportedPrimitiveDescriptors[i].getConfig().inConfs[0].getMemDesc()->isCompatible(*parent_spd->getConfig().outConfs[inNum].getMemDesc())) {
@@ -455,7 +455,7 @@ void Split::selectOptimalPrimitiveDescriptor() {
}
bool hasMatchDesc = false;
for (auto& childSpd : vecChildSpd) {
if (inNum >= childSpd.getConfig().inConfs.size()) {
if (static_cast<size_t>(inNum) >= childSpd.getConfig().inConfs.size()) {
inNum = 0;
}
if (outputDesc->isCompatible(*childSpd.getConfig().inConfs[inNum].getMemDesc())) {
@@ -67,7 +67,7 @@ public:
auto endPtr = reinterpret_cast<int32_t *>(data_dependency.at(END_ID)->GetPtr());
auto stridePtr = reinterpret_cast<int32_t *>(data_dependency.at(STRIDE_ID)->GetPtr());
for (auto i = 0, new_idx = 0; i < shapeIn.size(); ++i) {
for (size_t i = 0, new_idx = 0; i < shapeIn.size(); ++i) {
if (m_new_axis_mask_set.count(i)) {
// deal with new_axis_mask
m_outputShape[new_idx] = 1;
@@ -114,7 +114,7 @@ public:
} else {
auto vec_to_set = [](const std::vector<int64_t>& vec){
std::unordered_set<int64_t> to_set;
for (auto i = 0; i < vec.size(); ++i) {
for (size_t i = 0; i < vec.size(); ++i) {
if (vec[i] == 1) {
to_set.emplace(i);
}
@@ -290,7 +290,7 @@ static void addHiddenDims(StridedSlice::StridedSliceAttributes& attrs, const siz
auto addHiddenDims = [&](std::vector<int>& data, const int bit = 0) {
std::vector<int> temp;
for (size_t i = 0; i < attrs.ellipsisPos1; i++)
for (int i = 0; i < attrs.ellipsisPos1; i++)
temp.push_back(data[i]);
for (size_t i = attrs.ellipsisPos1; i < ellipsisPos2 + 1; i++)
temp.push_back(bit);
@@ -402,12 +402,12 @@ void StridedSlice::prepareParams() {
updateLastInputDims();
if (srcMemory.empty()) {
for (int i = 0; i < getOriginalInputsNumber(); i++) {
for (size_t i = 0; i < getOriginalInputsNumber(); i++) {
srcMemory.push_back(getParentEdgeAt(i)->getMemoryPtr());
}
}
if (dstMemory.empty()) {
for (int i = 0; i < getOriginalOutputsNumber(); i++) {
for (size_t i = 0; i < getOriginalOutputsNumber(); i++) {
dstMemory.push_back(getChildEdgeAt(i)->getMemoryPtr());
}
}
@@ -673,9 +673,11 @@ void StridedSlice::StridedSliceCommonExecutor::dimsGluing() {
std::pair<size_t, size_t> secondDim = { 0, params.attrs.begin.size() };
VectorDims indexes(1, 0);
for (int idx = 0; idx < params.attrs.begin.size(); idx++) {
if (params.attrs.begin[idx] != 0 || params.attrs.end[idx] != params.srcBlockedDims[idx] - 1 || params.attrs.stride[idx] != 1) {
indexes.push_back(std::max(idx - 1, 0));
for (size_t idx = 0; idx < params.attrs.begin.size(); idx++) {
if (params.attrs.begin[idx] != 0 ||
static_cast<size_t>(params.attrs.end[idx]) != params.srcBlockedDims[idx] - 1 ||
params.attrs.stride[idx] != 1) {
indexes.push_back(0u == idx ? 0 : idx - 1);
indexes.push_back(params.attrs.stride[idx] == 1 ? idx : idx + 1);
if (idx != 0 && secondDim.first == 0)
@@ -784,7 +786,7 @@ void StridedSlice::StridedSliceCommonExecutor::indicesCalculation() {
auto getSrcIdx = [&](const VectorDims& indexes){
size_t srcIdx = 0;
for (int i = 0; i < params.nDimsForWork; ++i)
for (size_t i = 0; i < params.nDimsForWork; ++i)
srcIdx += (params.attrs.begin[i] + indexes[i] * params.attrs.stride[i]) * params.srcStrides[i];
return srcIdx * params.attrs.dataSize;
};
+3 -3
View File
@@ -262,11 +262,11 @@ bool Snippet::optimizeExecDomain(std::vector<VectorDims>& inputShapes, std::vect
auto collapseLastDims = [](VectorDims& dims, size_t dimsToCollapse) {
if (dimsToCollapse >= dims.size() - 1)
IE_THROW() << "Got invalid number of dims to collapse. Expected < " << dims.size() - 1 << " got " << dimsToCollapse;
for (int i = dims.size() - 2; i > dims.size() - dimsToCollapse - 2; i--) {
for (int i = dims.size() - 2; i > static_cast<int>(dims.size() - dimsToCollapse - 2); i--) {
dims[dims.size() - 1] *= dims[i];
}
for (int i = dims.size() - 2; i >= dimsToCollapse; i--) {
for (int i = dims.size() - 2; i >= static_cast<int>(dimsToCollapse); i--) {
dims[i] = dims[i - dimsToCollapse];
}
@@ -501,7 +501,7 @@ void Snippet::prepareParams() {
if (dims_collapsed) {
std::vector<ov::Shape> new_shapes;
for (int i = 0; i < normInputShapes.size(); i++) {
for (size_t i = 0; i < normInputShapes.size(); i++) {
const auto norm_shape = normInputShapes[i];
size_t ndims_to_skip = norm_shape.size() - original_input_shape_ranks[i];
new_shapes.emplace_back(norm_shape.begin() + ndims_to_skip, norm_shape.end());
@@ -230,7 +230,7 @@ DynamicBuffer::DynamicBuffer(const MemoryPtr &from_, const std::vector<MemoryPtr
}
void DynamicBuffer::execute(const dnnl::engine& eng, const int iter) {
if (from->getStaticDims()[map_rule.axis] != std::abs(map_rule.stride))
if (from->getStaticDims()[map_rule.axis] != static_cast<size_t>(std::abs(map_rule.stride)))
IE_THROW() << "TensorIterator (Loop) has incorrect output shape[axis] after iteration for concatenation. " << std::abs(map_rule.stride) <<
" is expected, but actual: " << from->getStaticDims()[map_rule.axis];
@@ -523,7 +523,7 @@ bool TensorIterator::needPrepareParams() const {
if (getAlgorithm() == Algorithm::TensorIteratorLoop) {
const auto tripCountPtr = reinterpret_cast<const uint32_t*>(getParentEdgesAtPort(loopTripCountIdx).front()->getMemoryPtr()->GetPtr());
const auto condPtr = reinterpret_cast<const uint8_t*>(getParentEdgesAtPort(loopExecutionConditionIdx).front()->getMemoryPtr()->GetPtr());
if (tripCountPtr[0] != lastUsedTripCount || static_cast<bool>(condPtr[0]) != lastUsedCond)
if (tripCountPtr[0] != static_cast<size_t>(lastUsedTripCount) || static_cast<bool>(condPtr[0]) != lastUsedCond)
return true;
}
+2 -2
View File
@@ -126,7 +126,7 @@ bool Tile::needShapeInfer() const {
return true;
const int32_t* repeatsData = reinterpret_cast<const int32_t *>(getParentEdgesAtPort(TILE_REPEATS)[0]->getMemory().GetPtr());
for (size_t i = 0lu; i < originRepeats.size(); i++) {
if (originRepeats[i] != repeatsData[i])
if (originRepeats[i] != static_cast<size_t>(repeatsData[i]))
return true;
}
}
@@ -161,7 +161,7 @@ void Tile::plainExecute(dnnl::stream strm) {
auto inDims = srcMemory.getStaticDims();
for (int i = 0; i < axis; i++ )
m_outer_dim *= inDims[i];
for (int i = axis; i < inDims.size(); i++ )
for (size_t i = axis; i < inDims.size(); i++ )
m_inner_dim *= inDims[i];
int MB = srcMemory.getStaticDims()[0];
+2 -2
View File
@@ -1995,7 +1995,7 @@ void TopK::prepareParams() {
if (isDynamicNode()) {
const int src_k = reinterpret_cast<int *>(getParentEdgeAt(TOPK_K)->getMemoryPtr()->GetPtr())[0];
if (src_k > src_dims[axis])
if (static_cast<size_t>(src_k) > src_dims[axis])
IE_THROW() << errorPrefix << " gets top_k out of range!";
if (top_k != src_k) {
top_k = src_k;
@@ -2030,7 +2030,7 @@ void TopK::prepareParams() {
// which algorithm should be used for specific N and K.
if (!isDynamicNode()) {
const size_t count_xmm = 16; // only 16 vector registers are valid in sse instructions even for avx512_core
if (top_k <= count_xmm / 2 - 2) {
if (static_cast<size_t>(top_k) <= count_xmm / 2 - 2) {
algorithm = TopKAlgorithm::topk_bubble_sort;
bubble_inplace = topk_innermost && top_k == 1 ? false : true;
} else if (stable) {
@@ -62,11 +62,11 @@ public:
const std::unordered_map<size_t, MemoryPtr>& data_dependency) override {
const VectorDims& shapeIn = input_shapes[0].get();
if (m_needReverse) {
for (auto i = 0; i < m_out_rank; ++i) {
for (size_t i = 0; i < m_out_rank; ++i) {
m_outputShape[i] = shapeIn[m_out_rank - 1 - i];
}
} else {
for (auto i = 0; i < m_out_rank; ++i) {
for (size_t i = 0; i < m_out_rank; ++i) {
m_outputShape[i] = shapeIn[m_axes_vec[i]];
}
}
@@ -411,9 +411,9 @@ void Transpose::TransposeRefExecutor::exec(Transpose* node, MemoryPtr& srcMemPtr
const size_t dataSize = srcMemPtr->getDesc().getPrecision().size();
TransposeContext ctx = {node, srcMemPtr, dstMemPtr, MB};
OV_SWITCH(intel_cpu, TransposeOptimizedEmitter, ctx, dataSize,
OV_CASE(1, PrecisionTrait<Precision::U8>::value_type),
OV_CASE(2, PrecisionTrait<Precision::U16>::value_type),
OV_CASE(4, PrecisionTrait<Precision::I32>::value_type));
OV_CASE(1u, PrecisionTrait<Precision::U8>::value_type),
OV_CASE(2u, PrecisionTrait<Precision::U16>::value_type),
OV_CASE(4u, PrecisionTrait<Precision::I32>::value_type));
}
bool Transpose::created() const {
+16 -16
View File
@@ -189,7 +189,7 @@ void Unique::flattenTensorExec() {
if (definedOutputs[FIRST_UNIQUE_IDX]) {
T* first = uniDataTmpPtr;
for (T* it = first; it < last; it++) {
for (int i = 0; i < inputLen; i++) {
for (size_t i = 0; i < inputLen; i++) {
if (srcDataPtr[i] == *it) {
*firstTmpPtr++ = i;
first++;
@@ -199,12 +199,12 @@ void Unique::flattenTensorExec() {
}
}
if (definedOutputs[INPUT_TO_UNIQ_IDX]) {
for (int i = 0; i < inputLen; i++) {
for (size_t i = 0; i < inputLen; i++) {
if (i > 0 && srcDataPtr[i] == srcDataPtr[i - 1]) {
inToOutTmpPtr[i] = inToOutTmpPtr[i - 1];
continue;
}
for (int j = 0; j < uniqueLen; j++) {
for (size_t j = 0; j < uniqueLen; j++) {
if (srcDataPtr[i] == uniDataTmpPtr[j]) {
inToOutTmpPtr[i] = j;
break;
@@ -214,8 +214,8 @@ void Unique::flattenTensorExec() {
}
if (definedOutputs[OCCURRENCES_NUM]) {
std::fill(occurTmpPtr, occurTmpPtr + uniqueLen, 0);
for (int j = 0; j < uniqueLen; j++) {
for (int i = 0; i < inputLen; i++) {
for (size_t j = 0; j < uniqueLen; j++) {
for (size_t i = 0; i < inputLen; i++) {
if (srcDataPtr[i] == uniDataTmpPtr[j]) {
occurTmpPtr[j]++;
}
@@ -235,9 +235,9 @@ void Unique::flattenTensorExec() {
}
uniqueLen = 1;
for (int i = 1; i < inputLen; i++) {
for (size_t i = 1; i < inputLen; i++) {
bool found = false;
int j = 0;
size_t j = 0;
for (; j < uniqueLen; j++) {
if (uniDataTmpPtr[j] == srcDataPtr[i]) {
found = true;
@@ -304,7 +304,7 @@ void Unique::slicedTensorExec() {
partsInBl = std::accumulate(srcDataShape.begin(), srcDataShape.begin() + axis, 1, std::multiplies<Dim>());
}
int64_t elPerPart = 1; // Elements number in part.
if (axis < srcDataShape.size() - 1) {
if (static_cast<size_t>(axis) < srcDataShape.size() - 1) {
elPerPart = std::accumulate(srcDataShape.begin() + axis + 1, srcDataShape.end(), 1, std::multiplies<Dim>());
}
const auto partLenB = elPerPart * dataPrecision.size();
@@ -323,11 +323,11 @@ void Unique::slicedTensorExec() {
uniqueLen = 1;
std::vector<int64_t> uniqIdx(cmpBlNum, 0);
for (int b1 = 1; b1 < cmpBlNum; b1++) {
for (size_t b1 = 1; b1 < cmpBlNum; b1++) {
auto first1 = srcDataPtr + b1 * elPerPart;
auto last1 = srcDataPtr + (b1 + 1) * elPerPart;
bool equal = true;
int b2 = 0;
size_t b2 = 0;
// Compare with unique blocks.
for (; b2 < uniqueLen; b2++) {
auto first2 = srcDataPtr + uniqIdx[b2] * elPerPart;
@@ -362,7 +362,7 @@ void Unique::slicedTensorExec() {
}
const auto dstPrtStep = elPerPart * uniqueLen;
for (int b1 = 0; b1 < uniqueLen; b1++) {
for (size_t b1 = 0; b1 < uniqueLen; b1++) {
auto first1 = srcDataPtr + uniqIdx[b1] * elPerPart;
auto first2 = uniDataTmpPtr + b1 * elPerPart;
for (int p = 0; p < partsInBl; p++) {
@@ -381,7 +381,7 @@ void Unique::slicedTensorExec() {
std::vector<OrdEl> colToSort(uniqueLen);
std::vector<int64_t> moveTo(uniqueLen);
for (int k = 0; k < uniqueLen; k++) {
for (size_t k = 0; k < uniqueLen; k++) {
moveTo[k] = k;
}
std::vector<T> buff1(elPerPart);
@@ -394,7 +394,7 @@ void Unique::slicedTensorExec() {
colToSort[i] = {uniDataTmpPtr[pos2], i};
}
std::stable_sort(colToSort.begin(), colToSort.end(), [](const OrdEl &el1, const OrdEl &el2) { return el1.val < el2.val; });
for (int k = 0; k < uniqueLen; k++) {
for (size_t k = 0; k < uniqueLen; k++) {
moveTo[colToSort[k].idx] = k;
}
@@ -427,7 +427,7 @@ void Unique::slicedTensorExec() {
if (definedOutputs[OCCURRENCES_NUM]) {
ocSrc = occurTmpPtr[0];
}
for (int k = 0; k < uniqueLen; k++) {
for (size_t k = 0; k < uniqueLen; k++) {
if (mPos == moveTo[mPos]) {
mPos = moveTo[mPos + 1];
continue;
@@ -452,11 +452,11 @@ void Unique::slicedTensorExec() {
}
if (definedOutputs[INPUT_TO_UNIQ_IDX]) {
for (int b1 = 0; b1 < cmpBlNum; b1++) {
for (size_t b1 = 0; b1 < cmpBlNum; b1++) {
auto first1 = srcDataPtr + b1 * elPerPart;
auto last1 = srcDataPtr + (b1 + 1) * elPerPart;
bool equal = true;
for (int b2 = 0; b2 < uniqueLen; b2++) {
for (size_t b2 = 0; b2 < uniqueLen; b2++) {
auto first2 = uniDataTmpPtr + b2 * elPerPart;
equal = true;
for (int p = 0; p < partsInBl; p++) {
+2 -2
View File
@@ -128,7 +128,7 @@ dnnl::memory::format_tag str2fmt(const char *str) {
int get_cache_size(int level, bool per_core) {
unsigned get_cache_size(int level, bool per_core) {
if (per_core) {
return dnnl::impl::cpu::platform::get_per_core_cache_size(level);
} else {
@@ -142,7 +142,7 @@ int get_cache_size(int level, bool per_core) {
unsigned l = level - 1;
return cpu().getDataCacheSize(l);
} else {
return 0;
return 0U;
}
}
DNNL_THROW_ERROR(dnnl_unimplemented, "get_cache_size has no mode per_core == false");

Some files were not shown because too many files have changed in this diff Show More