From 6ed44a3dffee5bf4c4aa49966b99ec13a5f65fb2 Mon Sep 17 00:00:00 2001 From: "Yu, Zijun" Date: Mon, 21 Apr 2025 15:14:43 +0800 Subject: [PATCH] FEAT: do PERMUTE eagerly --- ggml/src/ggml-openvino/ggml-decoder.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ggml/src/ggml-openvino/ggml-decoder.cpp b/ggml/src/ggml-openvino/ggml-decoder.cpp index b1fc8ec67e..c639d630f3 100644 --- a/ggml/src/ggml-openvino/ggml-decoder.cpp +++ b/ggml/src/ggml-openvino/ggml-decoder.cpp @@ -43,12 +43,8 @@ void GgmlOvDecoder::set_input_output(ggml_tensor* node, std::mapop) { case GGML_OP_CONT: { - if (ggml_is_contiguous(node->src[0]) && ggml_is_contiguous(node) && - (node->src[0]->ne[0] * node->src[0]->nb[0] == node->src[0]->nb[1])) { - m_continuous = true; - } else { - m_continuous = false; - } + // Currently only two cases, either the input comes from a VIEW which is subtensor or from a PERMUTE + m_continuous = ggml_nelements(node->src[0]) == ggml_nelements(node->src[0]->view_src); break; } case GGML_OP_CPY: { @@ -183,9 +179,9 @@ GgmlOvDecoder::GgmlOvDecoder(struct ggml_tensor * node, struct ggml_cgraph * cgr // Init model input and output set_input_output(cur_node, m_inputs, m_outputs); } - #ifdef GGML_OPENVINO_DEBUG - ggml_graph_op_print(m_cgraph); - #endif + if (getenv("GGML_OPENVINO_DEBUG")) { + ggml_graph_op_print(m_cgraph); + } } }