[CPU] Fix problem with inplace input blob (#8506)

This commit is contained in:
Maxim Andronov 2021-11-16 15:04:39 +03:00 committed by GitHub
parent b9c5a477b4
commit b726aa2c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View File

@ -425,10 +425,18 @@ void MKLDNNPlugin::MKLDNNInferRequest::SetBlob(const std::string& name, const In
IE_THROW(ParameterMismatch) << "Failed to set input blob. Blocking descriptor mismatch.";
}
const auto &actualDesc = graph->getInputNodeByName(name)->getChildEdgesAtPort(0)[0]->getMemory().getDesc();
if (blobDesc.getLayout() != InferenceEngine::Layout::ANY &&
actualDesc.isCompatible(MemoryDescUtils::convertToCpuBlockedMemoryDesc(blobDesc)) &&
graph->_normalizePreprocMap.find(name) == graph->_normalizePreprocMap.end() && !graph->getProperty().batchLimit) {
MemoryDescPtr actualDesc = graph->getInputNodeByName(name)->getBaseMemDescAtOutputPort(0);
bool blobHasAnyLayout = blobDesc.getLayout() == InferenceEngine::Layout::ANY;
if (!blobHasAnyLayout && !actualDesc->isDefined()) {
// we must define desc for dynamic case
// otherwise we got incorrect check on shape compatibility inside isCompatible
// because lower and upper bound will be compared
actualDesc = actualDesc->cloneWithNewDims(blobDesc.getLayout() == InferenceEngine::Layout::SCALAR ? InferenceEngine::SizeVector{1} :
blobDesc.getDims());
}
if (!blobHasAnyLayout &&
actualDesc->isCompatible(MemoryDescUtils::convertToCpuBlockedMemoryDesc(blobDesc)) &&
graph->_normalizePreprocMap.find(name) == graph->_normalizePreprocMap.end() && !graph->getProperty().batchLimit) {
externalPtr[name] = data->buffer();
} else if (externalPtr.find(name) != externalPtr.end()) {
externalPtr.erase(name);

View File

@ -254,7 +254,16 @@ std::vector<std::vector<ov::Shape>> staticInputShapes5D2 = {
std::vector<std::vector<InputShape>> dynamicInputShapes5D2 = {
{
{{{-1, -1, -1, -1, -1}, {{48, 4, 3, 3, 3}, {24, 16, 5, 3, 5}, {24, 8, 7, 5, 5}}}},
{{{24, {8, 16}, {3, 5}, -1, -1}, {{24, 16, 3, 4, 3}, {24, 12, 5, 3, 5}, {24, 8, 4, 5, 5}}}}
{{{24, {8, 16}, {3, 5}, -1, -1}, {{24, 16, 3, 4, 3}, {24, 12, 5, 3, 5}, {24, 8, 4, 5, 5}}}},
// special case
{
{{{1, 24}, {1, 16}, {1, 10}, {1, 10}, {1, 10}},
{
{24, 16, 5, 3, 5},
{24, 16, 5, 3, 5},
{24, 16, 7, 5, 5}
}}
}
}
};