Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPU] Deconvolution int8 support #5565

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions inference-engine/src/mkldnn_plugin/mkldnn_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ MKLDNNDescriptor::operator std::shared_ptr<mkldnn::convolution_forward::desc>()
return typeDesc->getPtr();
}

MKLDNNDescriptor::MKLDNNDescriptor(std::shared_ptr<mkldnn::deconvolution_forward::desc> desc) {
this->desc.reset(new DescFwdImpl<mkldnn::deconvolution_forward::desc>(desc));
}

MKLDNNDescriptor::operator std::shared_ptr<mkldnn::deconvolution_forward::desc>() {
auto typeDesc = std::dynamic_pointer_cast<DescFwdImpl<mkldnn::deconvolution_forward::desc>>(desc);
if (typeDesc == nullptr) {
IE_THROW() << "Cannot cast descriptor!";
}
return typeDesc->getPtr();
}

MKLDNNDescriptor::MKLDNNDescriptor(std::shared_ptr<mkldnn::convolution_backward_data::desc> desc,
std::shared_ptr<mkldnn::convolution_forward::primitive_desc> prim) {
this->desc.reset(
Expand Down
4 changes: 4 additions & 0 deletions inference-engine/src/mkldnn_plugin/mkldnn_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class MKLDNNDescriptor {

MKLDNNDescriptor(std::shared_ptr<mkldnn::convolution_backward_data::desc> desc,
std::shared_ptr<mkldnn::convolution_forward::primitive_desc> prim);

explicit MKLDNNDescriptor(std::shared_ptr<mkldnn::deconvolution_forward::desc> desc);
operator std::shared_ptr<mkldnn::deconvolution_forward::desc>();

operator std::shared_ptr<mkldnn::convolution_backward_data::desc>();
operator std::shared_ptr<mkldnn::convolution_forward::primitive_desc>();

Expand Down
1 change: 1 addition & 0 deletions inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ void MKLDNNGraph::InitGraph() {
SortTopologically();

InitDescriptors();
RemoveDroppedEdges();

InitOptimalPrimitiveDescriptors();

Expand Down
3 changes: 2 additions & 1 deletion inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ static void Transformation(CNNNetwork& clonedNetwork, const Config& conf) {
LayerTransformation::Params(params).setPrecisionsOnActivations({ ngraph::element::u8 }).setSupportAsymmetricQuantization(true))
.addStandaloneCleanup<MultiplyToGroupConvolutionTransformation, ngraph::opset1::Multiply>(
LayerTransformation::Params(params).setPrecisionsOnActivations({ ngraph::element::u8 }))
.remove<ConvolutionBackpropDataTransformation, ngraph::opset1::ConvolutionBackpropData>());
.add<ConvolutionBackpropDataTransformation, ngraph::opset1::ConvolutionBackpropData>(
LayerTransformation::Params(params).setSupportAsymmetricQuantization(false)));

transformer.transform(nGraphFunc);
}
Expand Down
243 changes: 191 additions & 52 deletions inference-engine/src/mkldnn_plugin/nodes/mkldnn_deconv_node.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ class MKLDNNDeconvolutionNode : public MKLDNNNode {
private:
bool withGroups = false;
bool isDW = false;
bool isInt8 = false;
size_t groupNum = 1;
size_t outDepth;
size_t IC;
size_t OC;
std::vector<ptrdiff_t> kernel;
std::vector<ptrdiff_t> stride;
std::vector<ptrdiff_t> dilation;
std::vector<ptrdiff_t> paddingL;
Expand All @@ -57,6 +59,9 @@ class MKLDNNDeconvolutionNode : public MKLDNNNode {
void setPostOps(mkldnn::primitive_attr &attr);

std::string errorPrefix;

bool canBeExecutedInInt8();
InferenceEngine::Blob::Ptr createWeiBlobAsIO(InferenceEngine::SizeVector dims);
};

} // namespace MKLDNNPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*ClampLayerTest.*netPrc=U64.*)",
// TODO: 42538. Unexpected application crush
R"(.*CoreThreadingTestsWithIterations\.smoke_LoadNetwork.t.*)",
R"(.*CoreThreadingTestsWithIterations\.smoke_LoadNetworkAccuracy.*AUTO.*)",

// incorrect reference implementation
R"(.*NormalizeL2LayerTest.*axes=\(\).*)",
Expand Down