From ca546463335627dcd918df959bf262269036c4ed Mon Sep 17 00:00:00 2001 From: dmitrygo Date: Thu, 3 Aug 2023 19:08:52 +0400 Subject: [PATCH] Fixed review comments --- src/plugins/intel_cpu/src/graph_optimizer.cpp | 6 +++--- src/plugins/intel_cpu/src/nodes/fullyconnected.cpp | 8 ++++---- .../subgraph_tests/src/matmul_weights_decompression.cpp | 4 +++- src/plugins/intel_cpu/thirdparty/onednn | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plugins/intel_cpu/src/graph_optimizer.cpp b/src/plugins/intel_cpu/src/graph_optimizer.cpp index 3dbe38ceaf372c..d40c7df913f1a3 100644 --- a/src/plugins/intel_cpu/src/graph_optimizer.cpp +++ b/src/plugins/intel_cpu/src/graph_optimizer.cpp @@ -287,15 +287,15 @@ void GraphOptimizer::FuseFCAndWeightsDecompression(Graph &graph) { return node->getType() == expectedType && node->getChildEdges().size() == 1; }; + if (!impl::cpu::x64::mayiuse(impl::cpu::x64::avx2)) + return; + auto& graphNodes = graph.GetNodes(); for (size_t i = 0; i < graphNodes.size(); i++) { const auto fcNode = dynamic_cast(graphNodes[i].get()); if (fcNode == nullptr) continue; - if (!impl::cpu::x64::mayiuse(impl::cpu::x64::avx2)) - continue; - const auto parent = fcNode->getParentEdgesAtPort(1)[0]->getParent(); const bool withTranspose = parent->getType() == Type::Transpose; const NodePtr transposeNode = withTranspose ? parent : nullptr; diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp index 0cf1099605e5aa..25af6f996f61d5 100644 --- a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp +++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp @@ -590,7 +590,8 @@ void FullyConnected::setPostOps(dnnl::primitive_attr& attr, const VectorDims& di DnnlPostOpsComposer dnnlpoc(getEngine(), attr, ops, postOpsArgs, dims, dims.size() - 1, canBeExecutedInInt8(), 1 << 0, getDQScales(), withBiases); - dnnlpoc.appendDecompressionScales(decompressionMultiply); + if (!decompressionMultiply.empty()) + dnnlpoc.appendDecompressionScales(decompressionMultiply); if (!decompressionSubtract.empty()) dnnlpoc.appendDecompressionZeroPoints(decompressionSubtract); @@ -680,10 +681,9 @@ void FullyConnected::createDescriptorInternal(const dnnl::memory::desc &inputDes dnnl::memory::data_type wdt = indt; dnnl::memory::data_type bdt = outdt; - dnnl::memory::data_type original_wdt = DnnlExtensionUtils::IEPrecisionToDataType(getOriginalInputPrecisionAtPort(WEIGHTS_ID)); - if (indt == dnnl::memory::data_type::f32 && original_wdt == dnnl::memory::data_type::u8) { + if (useWeightsDecompressionImpl) { // Weights decompression case - wdt = original_wdt; + wdt = DnnlExtensionUtils::IEPrecisionToDataType(getOriginalInputPrecisionAtPort(WEIGHTS_ID)); } else if (one_of(indt, dnnl::memory::data_type::bf16, dnnl::memory::data_type::f16)) { #if defined(OPENVINO_ARCH_X86_64) bdt = dnnl::memory::data_type::f32; diff --git a/src/plugins/intel_cpu/tests/functional/subgraph_tests/src/matmul_weights_decompression.cpp b/src/plugins/intel_cpu/tests/functional/subgraph_tests/src/matmul_weights_decompression.cpp index cf9ad8b9c3fcd4..f1d0ebb70e0848 100644 --- a/src/plugins/intel_cpu/tests/functional/subgraph_tests/src/matmul_weights_decompression.cpp +++ b/src/plugins/intel_cpu/tests/functional/subgraph_tests/src/matmul_weights_decompression.cpp @@ -189,7 +189,9 @@ class MatmulWeightsDecompression : public testing::WithParamInterface additional_config = std::get<5>(test_param); - const size_t expected_count = additional_config[PluginConfigParams::KEY_ENFORCE_BF16] == PluginConfigParams::YES ? 1 : 0; + const size_t expected_count = + InferenceEngine::with_cpu_x86_avx2() && + additional_config[PluginConfigParams::KEY_ENFORCE_BF16] != PluginConfigParams::YES ? 0 : 1; CheckNumberOfNodesWithType(compiledModel, "Convert", expected_count); CheckNumberOfNodesWithType(compiledModel, "Eltwise", expected_count); CheckNumberOfNodesWithType(compiledModel, "Subgraph", 0); diff --git a/src/plugins/intel_cpu/thirdparty/onednn b/src/plugins/intel_cpu/thirdparty/onednn index b44d2f2cac63d3..ec7a051b3f4a9e 160000 --- a/src/plugins/intel_cpu/thirdparty/onednn +++ b/src/plugins/intel_cpu/thirdparty/onednn @@ -1 +1 @@ -Subproject commit b44d2f2cac63d3e8392bc624d1c7b1a4bde21d83 +Subproject commit ec7a051b3f4a9e65b22382f3d787e84ce74efe07