Skip to content

Commit 4292a41

Browse files
committed
Fix test-backend-ops
1 parent ae84719 commit 4292a41

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

ggml/src/ggml-openvino/ggml-decoder.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ ov::PartialShape GgmlOvDecoder::get_graph_input_shape(const ggml_tensor* src) co
272272
input_shape = ov::PartialShape{m_context_size, m_num_heads_kv, m_head_size};
273273
} else if (name.find("cache_v") == 0) {
274274
input_shape = ov::PartialShape{m_num_heads_kv, m_head_size, m_context_size};
275-
} else if (const auto* op = get_tensor_used_op(src); op->op == GGML_OP_SET_ROWS) {
275+
} else if (const auto* op = get_tensor_used_op(src); op && op->op == GGML_OP_SET_ROWS) {
276276
input_shape = ov::PartialShape{1, 1, -1};
277277
if (m_is_static) {
278278
if (m_is_first_token) {
@@ -324,6 +324,9 @@ void GgmlOvDecoder::add_extra_inputs() {
324324
}
325325

326326
const ggml_tensor* GgmlOvDecoder::get_tensor_used_op(const ggml_tensor* tensor) const {
327+
if (tensor == nullptr) {
328+
return nullptr;
329+
}
327330
for (int i = 0; i < m_cgraph->n_nodes; i++) {
328331
const auto* node = m_cgraph->nodes[i];
329332
for (int j = 0; j < GGML_MAX_SRC; j++) {
@@ -332,7 +335,7 @@ const ggml_tensor* GgmlOvDecoder::get_tensor_used_op(const ggml_tensor* tensor)
332335
}
333336
}
334337
}
335-
throw std::runtime_error("Tensor not found in cgraph");
338+
return nullptr;
336339
}
337340

338341
const ggml_tensor* GgmlOvDecoder::get_tensor_from_name(const std::string& name) const {

ggml/src/ggml-openvino/ggml-openvino.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ static ggml_backend_buffer_t ggml_backend_openvino_device_buffer_from_host_ptr(g
238238

239239
static bool is_op_unsupported_case(const ggml_tensor* op) {
240240
if (op->op == GGML_OP_SOFT_MAX) {
241+
if (op->src[2] != nullptr) {
242+
GGML_LOG_WARN("OpenVINO backend does not support SOFT_MAX with sinks\n");
243+
return true;
244+
}
241245
float scale = 1.0f;
242246
float max_bias = 0.0f;
243247
const auto* op_params = op->op_params;

ggml/src/ggml-openvino/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ ov::Tensor get_ov_input_tensor(std::shared_ptr<GgmlOvDecoder> ggml_decoder, cons
329329
}
330330

331331
} else if (const auto* op = ggml_decoder->get_tensor_used_op(ggml_decoder->get_tensor_from_name(param_name));
332-
op->op == GGML_OP_SET_ROWS && is_static && is_first_token) {
332+
op && op->op == GGML_OP_SET_ROWS && is_static && is_first_token) {
333333
input_tensor = ov::Tensor(ov::element::i64, ov::Shape{1});
334334
} else {
335335
input_tensor = convert_ggml_input_to_ov(ggml_decoder, param_name);

0 commit comments

Comments
 (0)