From 22fc79134e23feea5cbc1074eaae77143932ccbc Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 7 Apr 2026 15:28:27 +0300 Subject: [PATCH] ggml : deprecate GGML_OP_ADD1 (#21363) * ggml : deprecate GGML_OP_ADD1 * cont : remove tests * cont : re-enable vulkan check --- ggml/include/ggml.h | 10 ++++++---- tests/test-backend-ops.cpp | 35 ----------------------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/ggml/include/ggml.h b/ggml/include/ggml.h index 3bb2faa2c6..11d3e8a816 100644 --- a/ggml/include/ggml.h +++ b/ggml/include/ggml.h @@ -902,15 +902,17 @@ extern "C" { struct ggml_tensor * b, struct ggml_tensor * ids); - GGML_API struct ggml_tensor * ggml_add1( + GGML_DEPRECATED(GGML_API struct ggml_tensor * ggml_add1( struct ggml_context * ctx, struct ggml_tensor * a, - struct ggml_tensor * b); + struct ggml_tensor * b), + "use ggml_add instead"); - GGML_API struct ggml_tensor * ggml_add1_inplace( + GGML_DEPRECATED(GGML_API struct ggml_tensor * ggml_add1_inplace( struct ggml_context * ctx, struct ggml_tensor * a, - struct ggml_tensor * b); + struct ggml_tensor * b), + "use ggml_add_inplace instead"); // dst = a // view(dst, nb1, nb2, nb3, offset) += b diff --git a/tests/test-backend-ops.cpp b/tests/test-backend-ops.cpp index 781c621d93..093f17e23a 100644 --- a/tests/test-backend-ops.cpp +++ b/tests/test-backend-ops.cpp @@ -3129,39 +3129,6 @@ struct test_add_id : public test_case { } }; -// GGML_OP_ADD1 -struct test_add1 : public test_case { - const ggml_type type; - const std::array ne; - - std::string vars() override { - return VARS_TO_STR2(type, ne); - } - - test_add1(ggml_type type = GGML_TYPE_F32, - std::array ne = {10, 5, 4, 3}) - : type(type), ne(ne) {} - - ggml_tensor * build_graph(ggml_context * ctx) override { - ggml_tensor * a = ggml_new_tensor(ctx, type, 4, ne.data()); - ggml_set_param(a); - ggml_set_name(a, "a"); - - ggml_tensor * b = ggml_new_tensor_1d(ctx, type, 1); - // ggml_set_param(b); // TODO: implement - ggml_set_name(b, "b"); - - ggml_tensor * out = ggml_add1(ctx, a, b); - ggml_set_name(out, "out"); - - return out; - } - - float grad_eps() override { - return 0.1f * ne[0]*ne[1]*ne[2]*ne[3]; - } -}; - // GGML_OP_SCALE struct test_scale : public test_case { const ggml_type type; @@ -7886,8 +7853,6 @@ static std::vector> make_test_cases_eval() { test_cases.emplace_back(new test_bin_bcast(ggml_add, GGML_TYPE_F32, {16, 5, 4, 3}, {2, 2, 2, 2}, 8)); test_cases.emplace_back(new test_bin_bcast(ggml_add, GGML_TYPE_F32, {16, 5, 4, 3}, {1, 1, 1, 1}, 16)); - test_cases.emplace_back(new test_add1()); - test_cases.emplace_back(new test_add1(GGML_TYPE_F32, {1024, 1024, 1, 1})); test_cases.emplace_back(new test_scale()); test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {10, 10, 10, 10}, 2.0f, 1.0f)); test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {10, 10, 10, 10}, 2.0f, 1.0f, true)); // inplace test