From b4a220c2ebc54f251416e14d5463f01fa7b79707 Mon Sep 17 00:00:00 2001 From: Mostafa Faheem Date: Thu, 3 Dec 2026 18:20:05 +0200 Subject: [PATCH] ggml-openvino : remove GGML_OPENVINO_NATIVE_SOFTPLUS environment variable --- .../dev_doc/OpenVINO-ENV-VARS.md | 1 - ggml/src/ggml-openvino/dev_doc/README.md | 2 +- .../src/ggml-openvino/ggml-openvino-extra.cpp | 1 - ggml/src/ggml-openvino/model-cache.cpp | 1 - ggml/src/ggml-openvino/openvino/op/unary.cpp | 34 ------------------- ggml/src/ggml-openvino/openvino/op_table.cpp | 2 +- ggml/src/ggml-openvino/openvino/op_table.h | 1 - 7 files changed, 2 insertions(+), 40 deletions(-) diff --git a/ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md b/ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md index 243a40c5cf2a..67eafd383e01 100644 --- a/ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md +++ b/ggml/src/ggml-openvino/dev_doc/OpenVINO-ENV-VARS.md @@ -70,7 +70,6 @@ Most of these options are off by default. They are not validated for general use | `GGML_OPENVINO_GDN_NATIVE_STATE` | NPU | Boolean | `0` | Keep the `GATED_DELTA_NET` state in the layout of the OpenVINO op instead of the GGML layout. Every `GATED_DELTA_NET` must then run on the OpenVINO backend; the load aborts if one would run on the CPU backend. Saved states and `GGML_OPENVINO_DEBUG_NODE` dumps hold the OpenVINO layout. `test-backend-ops` fails with it. | | `GGML_OPENVINO_FORCE_STATIC` | CPU, GPU | Boolean | `0` | Run the static-shape path of the NPU on the CPU or the GPU, to separate translation bugs from NPU plugin or driver problems. This includes the NPU translation of MoE blocks, which computes every expert on the CPU or the GPU and is slow. Cannot be used with `GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY`. | | `GGML_OPENVINO_ENABLE_FALLBACK` | all | Boolean | `0` | Detect graphs that the scheduler splits between OpenVINO and another backend, and translate them as partial graphs, without the compiled model cache. By default every graph is treated as a complete model graph. Cannot be used with `GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY`. | -| `GGML_OPENVINO_NATIVE_SOFTPLUS` | all | Boolean | `0` | Translate `SOFTPLUS` to the OpenVINO `SoftPlus` op instead of the default `relu(x) + log1p(exp(-abs(x)))`. | | `GGML_OPENVINO_KV_SCATTER_ELEMENTS` | all | Boolean | `0` | Use `ScatterElementsUpdate` instead of `ScatterUpdate` for single-row KV writes in stateless execution. | ## Memory optimization diff --git a/ggml/src/ggml-openvino/dev_doc/README.md b/ggml/src/ggml-openvino/dev_doc/README.md index ee169e909cf9..7844455c5316 100644 --- a/ggml/src/ggml-openvino/dev_doc/README.md +++ b/ggml/src/ggml-openvino/dev_doc/README.md @@ -74,7 +74,7 @@ Cache-only mode (`GGML_OPENVINO_COMPILED_MODEL_CACHE_ONLY=1`): Settings that must stay exactly the same between the runs, including set versus unset. A different value selects another cache entry, and cache-only mode then fails. Source: `cache_settings[]` in `model-cache.cpp`. -- `GGML_OPENVINO_GPU_CONFIG`, `GGML_OPENVINO_CPU_CONFIG`, `GGML_OPENVINO_REQUANT_KQUANT`, `GGML_OPENVINO_EXACT_ZERO_POINT`, `GGML_OPENVINO_NATIVE_SOFTPLUS`, `GGML_OPENVINO_MANUAL_GQA_ATTN` +- `GGML_OPENVINO_GPU_CONFIG`, `GGML_OPENVINO_CPU_CONFIG`, `GGML_OPENVINO_REQUANT_KQUANT`, `GGML_OPENVINO_EXACT_ZERO_POINT`, `GGML_OPENVINO_MANUAL_GQA_ATTN` - `GGML_OPENVINO_STATEFUL_EXECUTION`, `GGML_OPENVINO_DISABLE_KV_STATE_RELAYOUT`, `GGML_OPENVINO_KV_SCATTER_ELEMENTS` - `GGML_OPENVINO_GDN_NATIVE_STATE`, `GGML_OPENVINO_GDN_DECOMPOSE`, `GGML_OPENVINO_GDN_DECOMPOSE_CHUNK` - `GGML_OPENVINO_REDUCE_COMPILE_MEM`, `GGML_OPENVINO_MEMORY_OPTIMIZE`, `GGML_OPENVINO_DISABLE_SHAPE_FROM_MASK` diff --git a/ggml/src/ggml-openvino/ggml-openvino-extra.cpp b/ggml/src/ggml-openvino/ggml-openvino-extra.cpp index 2ab49ba53300..e760751c30af 100644 --- a/ggml/src/ggml-openvino/ggml-openvino-extra.cpp +++ b/ggml/src/ggml-openvino/ggml-openvino-extra.cpp @@ -187,7 +187,6 @@ constexpr env_var env_vars[] = { {"GGML_OPENVINO_LOG_SUPPORTS_OP", env_type::INT}, {"GGML_OPENVINO_DIAG_GRAPH_IO", env_type::BOOL}, {"GGML_OPENVINO_LOG_SWA_LAYERS", env_type::BOOL}, - {"GGML_OPENVINO_NATIVE_SOFTPLUS", env_type::BOOL}, {"GGML_OPENVINO_DISABLE_REMOTE_OUTPUTS", env_type::BOOL}, {"GGML_OPENVINO_DISABLE_KV_STATE_RELAYOUT", env_type::BOOL}, {"GGML_OPENVINO_NPU_FAST_MASK", env_type::BOOL}, diff --git a/ggml/src/ggml-openvino/model-cache.cpp b/ggml/src/ggml-openvino/model-cache.cpp index bb1ef896919d..3d2dfb858cc5 100644 --- a/ggml/src/ggml-openvino/model-cache.cpp +++ b/ggml/src/ggml-openvino/model-cache.cpp @@ -132,7 +132,6 @@ static const char * cache_settings[] = { "GGML_OPENVINO_GPU_CONFIG", "GGML_OPENVINO_CPU_CONFIG", "GGML_OPENVINO_REQUANT_KQUANT", - "GGML_OPENVINO_NATIVE_SOFTPLUS", // GGML_OPENVINO_KV_SLICE only changes dynamic runtime bindings. Dynamic // attention graphs accept either shape and share the same compiled blob. "GGML_OPENVINO_GDN_NATIVE_STATE", diff --git a/ggml/src/ggml-openvino/openvino/op/unary.cpp b/ggml/src/ggml-openvino/openvino/op/unary.cpp index 08751596daca..57a227854091 100644 --- a/ggml/src/ggml-openvino/openvino/op/unary.cpp +++ b/ggml/src/ggml-openvino/openvino/op/unary.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace ov { @@ -142,39 +141,6 @@ OutputVector translate_unary_expm1(const NodeContext & context) { return rename_outputs_with_suffix({res}, context.get_name()); } -OutputVector translate_unary_softplus(const NodeContext & context) { - num_inputs_check(context, 1, 1); - - if (ggml_openvino_getenv_int("GGML_OPENVINO_NATIVE_SOFTPLUS") != 0) { - return translate_1to1_match_1_input(context); - } - - auto input = process_view_input_new(context, 0); - const auto element_type = input.get_element_type(); - auto one = ov::op::v0::Constant::create(element_type, ov::Shape{}, {1.0f}); - - auto positive = std::make_shared(input); - auto abs = std::make_shared(input); - auto neg_abs = std::make_shared(abs); - auto y = std::make_shared(neg_abs); - // log1p(y) for y in (0, 1]. log(1 + y) loses a small y to rounding in 1 + y (all of it below x = -16 in f32), - // so y < 0.01 takes the series y - y^2/2 + y^3/3 - y^4/4, whose relative error there is below 2e-9. - auto c = [&](float v) { - return ov::op::v0::Constant::create(element_type, ov::Shape{}, {v}); - }; - std::shared_ptr series = std::make_shared(y, c(0.25f)); - series = std::make_shared(c(1.0f / 3), series); - series = std::make_shared(c(0.5f), std::make_shared(y, series)); - series = std::make_shared(one, std::make_shared(y, series)); - series = std::make_shared(y, series); - auto log_direct = std::make_shared(std::make_shared(one, y)); - auto small = std::make_shared(y, c(0.01f)); - auto log_term = std::make_shared(small, series, log_direct); - auto res = std::make_shared(positive, log_term); - - return rename_outputs_with_suffix({res}, context.get_name()); -} - } // namespace op } // namespace ggml } // namespace frontend diff --git a/ggml/src/ggml-openvino/openvino/op_table.cpp b/ggml/src/ggml-openvino/openvino/op_table.cpp index 835249b62a0d..cac22c705845 100644 --- a/ggml/src/ggml-openvino/openvino/op_table.cpp +++ b/ggml/src/ggml-openvino/openvino/op_table.cpp @@ -80,7 +80,7 @@ std::unordered_map get_supported_ops() { {"GGML_UNARY_OP_EXPM1", op::translate_unary_expm1 }, {"GGML_UNARY_OP_SIGMOID", op::translate_1to1_match_1_input }, {"GGML_UNARY_OP_SILU", op::translate_1to1_match_1_input }, - {"GGML_UNARY_OP_SOFTPLUS", op::translate_unary_softplus }, + {"GGML_UNARY_OP_SOFTPLUS", op::translate_1to1_match_1_input }, {"GGML_UNARY_OP_TANH", op::translate_1to1_match_1_input }, {"GGML_UNARY_OP_EXP", op::translate_1to1_match_1_input }, {"GGML_UNARY_OP_NEG", op::translate_1to1_match_1_input }, diff --git a/ggml/src/ggml-openvino/openvino/op_table.h b/ggml/src/ggml-openvino/openvino/op_table.h index 0f5305c4c025..2ef1e6984660 100644 --- a/ggml/src/ggml-openvino/openvino/op_table.h +++ b/ggml/src/ggml-openvino/openvino/op_table.h @@ -34,7 +34,6 @@ GGML_OP_CONVERTER(translate_sqr); GGML_OP_CONVERTER(translate_rope); GGML_OP_CONVERTER(translate_scale); GGML_OP_CONVERTER(translate_sqrt); -GGML_OP_CONVERTER(translate_unary_softplus); GGML_OP_CONVERTER(translate_soft_max); GGML_OP_CONVERTER(translate_transpose); GGML_OP_CONVERTER(translate_view);