Skip to content

Commit

Permalink
Fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-gorokhov committed Aug 3, 2023
1 parent ec9cbd9 commit ca54646
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/plugins/intel_cpu/src/graph_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<node::FullyConnected*>(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;
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ class MatmulWeightsDecompression : public testing::WithParamInterface<MatmulWeig
}

std::map<std::string, std::string> 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);
Expand Down

0 comments on commit ca54646

Please sign in to comment.