Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[dGPU] avoid strided_slice to be executed in cpu (#25601)

River Lif19282fe8106
diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/mark_shape_of_subgraphs.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/mark_shape_of_subgraphs.cpp
index aec9e8b5f49..3599e68301d 100644
--- a/src/plugins/intel_gpu/src/graph/graph_optimizer/mark_shape_of_subgraphs.cpp
+++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/mark_shape_of_subgraphs.cpp
@@ -7,6 +7,7 @@
#include "reshape_inst.h"
#include "eltwise_inst.h"
#include "select_inst.h"
+#include "strided_slice_inst.h"
#include "gather_inst.h"
#include "pass_manager.h"
@@ -78,6 +79,13 @@ bool mark_shape_of_subgraphs::can_mark_node(const program_node& node) {
return false;
}
+ // Exclude stride_slice primitive if it's input is big const ternsor, else CPU reference implementation
+ // will lead to huge performance drop.
+ if (node.is_type<strided_slice>() && node.get_dependency(0).is_constant() &&
+ node.get_dependency(0).get_output_layout().count() > 1024 * 1024) {
+ return false;
+ }
+
auto available_impls = node.type()->get_available_impls(node);
auto cpu_impl_found = available_impls.find(impl_types::cpu) != available_impls.end();