[CPU] statically analyzed issues. (#2139)
This commit is contained in:
parent
0e34b392ee
commit
5403003d02
@ -71,7 +71,6 @@ private:
|
||||
std::vector<float> sum_scales;
|
||||
bool broadcast = false;
|
||||
int batch_dim = 5;
|
||||
std::vector<MKLDNNMemoryPtr> PostOpsIntBlobMemory;
|
||||
mkldnn::primitive_attr attr;
|
||||
|
||||
std::shared_ptr<jit_uni_eltwise_fq_kernel> eltiwse_fq_kernel;
|
||||
|
@ -125,8 +125,8 @@ namespace {
|
||||
auto const &lhsBlockingDesc = lhs.getBlockingDesc();
|
||||
auto const &rhsBlockingDesc = rhs.getBlockingDesc();
|
||||
|
||||
bool lhsDefaultStrides, rhsDefaultStrides;
|
||||
size_t lhsSize, rhsSize;
|
||||
bool lhsDefaultStrides = false, rhsDefaultStrides = false;
|
||||
size_t lhsSize = 0lu, rhsSize = 0lu;
|
||||
|
||||
std::tie(lhsDefaultStrides, lhsSize) = isDefaultStrides(lhsBlockingDesc.getStrides(), lhs.getDims());
|
||||
std::tie(rhsDefaultStrides, rhsSize) = isDefaultStrides(rhsBlockingDesc.getStrides(), rhs.getDims());
|
||||
|
@ -633,9 +633,15 @@ private:
|
||||
for (int i = 0; i < p.len_; i++) {
|
||||
auto& post_op = p.entry_[i];
|
||||
if (post_op.is_eltwise()) {
|
||||
if (eltwise_injectors.size() <= eltwise_inj_idx
|
||||
|| eltwise_injectors[eltwise_inj_idx] == nullptr)
|
||||
assert(!"Invalid eltwise injectors.");
|
||||
eltwise_injectors[eltwise_inj_idx]->compute_vector_range(vmm_val.getIdx(), vmm_val.getIdx() + 1);
|
||||
eltwise_inj_idx++;
|
||||
} else if (post_op.is_depthwise()) {
|
||||
if (depthwise_injectors.size() <= depthwise_inj_idx
|
||||
|| depthwise_injectors[depthwise_inj_idx] == nullptr)
|
||||
assert(!"Invalid depthwise injectors.");
|
||||
mov(reg_d_weights, reinterpret_cast<size_t>(post_op.depthwise.weights_data));
|
||||
mov(reg_d_bias, reinterpret_cast<size_t>(post_op.depthwise.biases_data));
|
||||
add(reg_d_weights, reg_oc_off);
|
||||
@ -644,6 +650,9 @@ private:
|
||||
depthwise_injectors[depthwise_inj_idx]->compute_vector_range(vmm_val.getIdx(), vmm_val.getIdx() + 1, reg_d_weights, reg_d_bias, is_broadcast);
|
||||
depthwise_inj_idx++;
|
||||
} else if (post_op.is_quantization()) {
|
||||
if (quantization_injectors.size() <= quantization_inj_idx
|
||||
|| quantization_injectors[quantization_inj_idx] == nullptr)
|
||||
assert(!"Invalid quantization injectors.");
|
||||
bool do_dequantization = post_op.quantization.alg == alg_kind::quantization_quantize_dequantize;
|
||||
bool do_rounding = do_dequantization || dst_dt == memory::f32 || i != p.len_ - 1;
|
||||
|
||||
|
@ -289,6 +289,7 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) {
|
||||
SizeVector indicesDim = getParentEdgeAt(INDICES_ID)->getDesc().getDims();
|
||||
size_t srcRank = srcDataDim.size();
|
||||
int axis = 0;
|
||||
std::string errorPrefix = std::string("'") + getTypeStr() + "'" + " layer with name '" + getName() + "'";
|
||||
if (axisRelaxed) {
|
||||
auto &axisMemPtr = getParentEdgeAt(AXIS_ID)->getMemoryPtr();
|
||||
uint8_t *axisPtr = reinterpret_cast<uint8_t*>(axisMemPtr->GetData()) +
|
||||
@ -302,8 +303,8 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) {
|
||||
}
|
||||
|
||||
if (axis >= static_cast<int>(srcRank) || axis < (static_cast<int>(srcRank) * - 1)) {
|
||||
THROW_IE_EXCEPTION << "'" << getType() << "'" << " layer with name '" << getName()
|
||||
<< "' should have axis value in range [-r, r - 1], where r is the rank of input data";
|
||||
THROW_IE_EXCEPTION << errorPrefix
|
||||
<< " should have axis value in range [-r, r - 1], where r is the rank of input data";
|
||||
}
|
||||
axis = axis < 0 ? (axis + srcRank) : axis;
|
||||
|
||||
@ -315,8 +316,8 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) {
|
||||
for (int i = start; i < end; i++) {
|
||||
int64_t idxValue = getIndicesValue(indicesPtr, i);
|
||||
if (idxValue >= static_cast<int64_t>(srcDimAxis) || idxValue < 0) {
|
||||
THROW_IE_EXCEPTION << "'" << getType() << "'" << " layer with name '" << getName()
|
||||
<< "' have indices value that points to non-existing output tensor element";
|
||||
THROW_IE_EXCEPTION << errorPrefix
|
||||
<< " have indices value that points to non-existing output tensor element";
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -336,10 +337,13 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updateRank > expectUpdateShape.size())
|
||||
THROW_IE_EXCEPTION << errorPrefix << " cannot update shape. New rank: "
|
||||
<< updateRank << ", expected: " << expectUpdateShape.size();
|
||||
for (size_t ru = 0; ru < updateRank; ru++) {
|
||||
if (updateDim[ru] != expectUpdateShape[ru]) {
|
||||
THROW_IE_EXCEPTION << "'" << getType() << "'" << " layer with name '" << getName()
|
||||
<< "' do not have matched tensor shape relationship for input, indices and update";
|
||||
THROW_IE_EXCEPTION << errorPrefix
|
||||
<< " do not have matched tensor shape relationship for input, indices and update";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,8 +374,8 @@ void MKLDNNScatterUpdateNode::execute(mkldnn::stream strm) {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
THROW_IE_EXCEPTION << "'" << getType() << "'" << " layer with name '" << getName()
|
||||
<< "' is not supported";
|
||||
THROW_IE_EXCEPTION << errorPrefix
|
||||
<< " is not supported";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user