@@ -81,7 +81,7 @@ enum ggml_status openvino_frontend_compute(ggml_backend_t backend, struct ggml_c
8181 config = get_npu_config ();
8282 }
8383
84- if (cgraph-> n_nodes == 1 ) {
84+ if (is_naive ( cgraph) ) {
8585 return naive_compute (cgraph, core, device, config);
8686 }
8787
@@ -250,11 +250,16 @@ ov::AnyMap get_npu_config() {
250250 return config;
251251}
252252
253+ bool is_naive (struct ggml_cgraph * cgraph) {
254+ constexpr int naive_graph_size_threshold = 20 ;
255+ return cgraph->n_nodes < naive_graph_size_threshold;
256+ }
257+
253258enum ggml_status naive_compute (struct ggml_cgraph * cgraph,
254259 ov::Core& core,
255260 const std::string& device,
256261 const ov::AnyMap& config) {
257- if (cgraph->nodes [0 ]->op == GGML_OP_NONE) {
262+ if (cgraph->n_nodes == 1 && cgraph-> nodes [0 ]->op == GGML_OP_NONE) {
258263 return GGML_STATUS_SUCCESS;
259264 }
260265
@@ -264,8 +269,6 @@ enum ggml_status naive_compute(struct ggml_cgraph* cgraph,
264269 auto model = ov::frontend::ggml::FrontEnd::convert (input_model, naive);
265270 auto infer_request = core.compile_model (model, device, config).create_infer_request ();
266271
267- ov::serialize (model, " IR.xml" );
268-
269272 auto ov_params = model->get_parameters ();
270273 for (size_t i = 0 ; i < ov_params.size (); i++) {
271274 auto param_name = ov_params[i]->get_friendly_name ();
0 commit comments