Commit 7ac5727d6 for llama.cpp
commit 7ac5727d6037ec99c31a28c6520f45de154199d9
Author: Ravi Panchumarthy <ravi.panchumarthy@intel.com>
Date: Wed Oct 28 21:11:13 2026 -0700
ggml-openvino: slice view inputs of SCALE (#31334)
SCALE now accepts a src0 view with arbitrary row strides. translate_scale
used the raw input, and on the dynamic path a VIEW translates to its whole
source tensor, so a strided view input scaled the entire source. The model
output then had the source's size, and copying it back overran the result
buffer, which crashes test-backend-ops on the SCALE view cases.
Slice the input with process_view_input_new, as the other translators do.
Reject an in-place SCALE on a non-contiguous view: its result is copied
back densely and would land in the wrong elements.
diff --git a/ggml/src/ggml-openvino/ggml-openvino.cpp b/ggml/src/ggml-openvino/ggml-openvino.cpp
index 22b2f45e2..8d9ba5dca 100644
--- a/ggml/src/ggml-openvino/ggml-openvino.cpp
+++ b/ggml/src/ggml-openvino/ggml-openvino.cpp
@@ -1446,6 +1446,10 @@ static ggml_openvino_op_support is_op_supported_case(const ggml_tensor * op) {
if (op->type == GGML_TYPE_BF16) {
return {false, "SCALE with BF16 type is not supported"};
}
+ // The result is copied back densely, so an in-place SCALE on a strided view would be written wrongly.
+ if (op->view_src != nullptr && !ggml_is_contiguous(op)) {
+ return {false, "SCALE in place on a non-contiguous view is not supported"};
+ }
break;
}
case GGML_OP_ADD_ID: {
diff --git a/ggml/src/ggml-openvino/openvino/op/scale.cpp b/ggml/src/ggml-openvino/openvino/op/scale.cpp
index 2947ee03c..4be2e700c 100644
--- a/ggml/src/ggml-openvino/openvino/op/scale.cpp
+++ b/ggml/src/ggml-openvino/openvino/op/scale.cpp
@@ -70,7 +70,7 @@ OutputVector translate_scale(const NodeContext & context) {
return rename_outputs_with_suffix({cleared_cache_rs}, context.get_name());
}
- auto scaled = std::make_shared<ov::op::v1::Multiply>(context.get_input(0), scale_node);
+ auto scaled = std::make_shared<ov::op::v1::Multiply>(process_view_input_new(context, 0), scale_node);
std::shared_ptr<ov::Node> res;
if (bias != 0.0f) {