OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CPU] Add BF16 RoPE and remove Gather skip to reduce reorders (#33786)
Bo Liuc63c5795f59b
diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cppindex 1999e1e004c..735fd3d204d 100644--- a/src/plugins/intel_cpu/src/graph.cpp+++ b/src/plugins/intel_cpu/src/graph.cpp@@ -2019,7 +2019,8 @@ void Graph::EnforceInferencePrecision() const {Type::ScaledDotProductAttention,Type::QKVProjection,Type::GatherMatmul,- Type::LLMMLP);+ Type::LLMMLP,+ Type::RoPE);};// Backward DFS: traverse from node to its parents, stopping at mandatory BF16 nodes@@ -2107,22 +2108,6 @@ void Graph::EnforceInferencePrecision() const {}}}-- // Pattern 2: Gather with an integer type on data input is usually encountered in token embeddings (when- // compressed). It's better to preserve token embeddings preprocessing (e.g., normalization) in fp32- if (node->getType() == Type::Gather) {- // Note: ShapeOf subgraphs are excluded from skipping markup- // since they are always kept in integer precision- const bool shapeOfSubgraph = node->getParentEdgeAt(0)->getParent()->getType() == Type::ShapeOf;- const auto inputPrec = node->getOriginalInputPrecisionAtPort(0);- if (!shapeOfSubgraph && inputPrec.is_integral_number()) {- // Add Gather node to nodesToSkip- nodesToSkip.insert(node);-- // keep the child subtree in the original precision- forwardSkipSearch(node, nodesToSkip);- }- }}}