From 14c8a85c32decfb043a3b2320e6ac4d2c9681ef5 Mon Sep 17 00:00:00 2001 From: "Yu, Zijun" Date: Wed, 27 Aug 2025 17:06:35 +0800 Subject: [PATCH] Perf: RMS fused to OV internal RMS op --- ggml/src/ggml-openvino/openvino/op/rms_norm.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp b/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp index 211692a3c7..c9df4c42f3 100644 --- a/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp +++ b/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -19,18 +20,17 @@ OutputVector translate_rms_norm(const NodeContext& context) { num_inputs_check(context, 1, 1); auto input_node = context.get_input(0); - auto square = std::make_shared(input_node, input_node); + auto square = std::make_shared( + input_node, ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1}, {2.0f})); - auto mean = - std::make_shared(square, - ov::op::v0::Constant::create(ov::element::i64, ov::Shape{1}, {2}), - true); + auto mean = std::make_shared( + square, ov::op::v0::Constant::create(ov::element::i64, ov::Shape{1}, {-1}), true); float eps; memcpy(&eps, context.get_output_op_params(0), sizeof(float)); auto rms = std::make_shared( - std::make_shared(mean, ov::op::v0::Constant::create(ov::element::f32, ov::Shape{}, {eps}))); + std::make_shared(mean, ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1}, {eps}))); auto reciprocal = std::make_shared(ov::op::v0::Constant::create(ov::element::f32, ov::Shape{1}, {1.0f}), rms);