From c18d7991c8c2465159ad5184c606a48867910203 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:24:44 +0800 Subject: [PATCH] rename tts.cpp ggml_round to ggml_ttsround to avoid conflict --- ggml/include/ggml.h | 6 +++--- ggml/src/ggml-cpu/ggml-cpu.c | 16 ++++++++-------- ggml/src/ggml.c | 12 ++++++------ otherarch/ttscpp/src/kokoro_model.cpp | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ggml/include/ggml.h b/ggml/include/ggml.h index c5793ebc3..83f0c3953 100644 --- a/ggml/include/ggml.h +++ b/ggml/include/ggml.h @@ -568,7 +568,7 @@ extern "C" { //kcpp: dirtypatch of unofficial ops for ttscpp GGML_OP_UPSCALE_LINEAR, // linear interpolate GGML_OP_RECIPROCAL, - GGML_OP_ROUND, + GGML_OP_TTSROUND, GGML_OP_MOD, GGML_OP_CUMSUM, GGML_OP_STFT, @@ -2589,10 +2589,10 @@ extern "C" { GGML_API bool ggml_threadpool_params_match (const struct ggml_threadpool_params * p0, const struct ggml_threadpool_params * p1); //kcpp: dirtypatch of ttscpp additions - GGML_API struct ggml_tensor * ggml_round( + GGML_API struct ggml_tensor * ggml_ttsround( struct ggml_context * ctx, struct ggml_tensor * a); - GGML_API struct ggml_tensor * ggml_round_inplace( + GGML_API struct ggml_tensor * ggml_ttsround_inplace( struct ggml_context * ctx, struct ggml_tensor * a); // This is a floating point mod by the mod_val parameter diff --git a/ggml/src/ggml-cpu/ggml-cpu.c b/ggml/src/ggml-cpu/ggml-cpu.c index e57a29649..810e15497 100644 --- a/ggml/src/ggml-cpu/ggml-cpu.c +++ b/ggml/src/ggml-cpu/ggml-cpu.c @@ -1678,7 +1678,7 @@ static void ggml_compute_forward_mul_mat_id( ///////////////////////////////// ///// kcpp: dirtypatch for tts cpp //////////// inline static void ggml_vec_reci_f32 (const int n, float * y, const float * x) { for (int i = 0; i < n; ++i) y[i] = 1.0f/x[i]; } -inline static void ggml_vec_round_f32 (const int n, float * y, const float * x) { for (int i = 0; i < n; ++i) y[i] = (float)((int) (x[i] + 0.5f)); } +inline static void ggml_vec_ttsround_f32 (const int n, float * y, const float * x) { for (int i = 0; i < n; ++i) y[i] = (float)((int) (x[i] + 0.5f)); } inline static void ggml_vec_mod_f32(const int n, float * y, const float * x, const float mod_val) { for (int i = 0; i < n; ++i) y[i] = fmod(x[i], mod_val); } void ggml_compute_forward_sin_f32_ffast_math(struct ggml_tensor * dst); static void ggml_compute_forward_reciprocal_f32( @@ -1817,7 +1817,7 @@ static void ggml_compute_forward_mod( } } } -static void ggml_compute_forward_round_f32( +static void ggml_compute_forward_ttsround_f32( const struct ggml_compute_params * params, struct ggml_tensor * dst) { @@ -1836,12 +1836,12 @@ static void ggml_compute_forward_round_f32( GGML_ASSERT(src0->nb[0] == sizeof(float)); for (int i = 0; i < n; i++) { - ggml_vec_round_f32(nc, + ggml_vec_ttsround_f32(nc, (float *) ((char *) dst->data + i*( dst->nb[1])), (float *) ((char *) src0->data + i*(src0->nb[1]))); } } -static void ggml_compute_forward_round( +static void ggml_compute_forward_ttsround( const struct ggml_compute_params * params, struct ggml_tensor * dst) { @@ -1850,7 +1850,7 @@ static void ggml_compute_forward_round( switch (src0->type) { case GGML_TYPE_F32: { - ggml_compute_forward_round_f32(params, dst); + ggml_compute_forward_ttsround_f32(params, dst); } break; default: { @@ -2840,9 +2840,9 @@ static void ggml_compute_forward(struct ggml_compute_params * params, struct ggm { ggml_compute_forward_reciprocal(params, tensor); } break; - case GGML_OP_ROUND: + case GGML_OP_TTSROUND: { - ggml_compute_forward_round(params, tensor); + ggml_compute_forward_ttsround(params, tensor); } break; case GGML_OP_CUMSUM: { @@ -3188,7 +3188,7 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) { } case GGML_OP_RECIPROCAL: //kcpp: dirtypatch tts cpp case GGML_OP_MOD: - case GGML_OP_ROUND: + case GGML_OP_TTSROUND: case GGML_OP_CUMSUM: case GGML_OP_STFT: case GGML_OP_AA_STFT: diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c index 9a9bc01d9..e27d1aa4e 100644 --- a/ggml/src/ggml.c +++ b/ggml/src/ggml.c @@ -7315,24 +7315,24 @@ struct ggml_tensor * ggml_istft( ggml_set_op_params(result, params, sizeof(params)); return result; } -static struct ggml_tensor * ggml_round_impl( +static struct ggml_tensor * ggml_ttsround_impl( struct ggml_context * ctx, struct ggml_tensor * a, bool inplace) { struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); - result->op = GGML_OP_ROUND; + result->op = GGML_OP_TTSROUND; result->src[0] = a; return result; } -struct ggml_tensor * ggml_round( +struct ggml_tensor * ggml_ttsround( struct ggml_context * ctx, struct ggml_tensor * a) { - return ggml_round_impl(ctx, a, false); + return ggml_ttsround_impl(ctx, a, false); } -struct ggml_tensor * ggml_round_inplace( +struct ggml_tensor * ggml_ttsround_inplace( struct ggml_context * ctx, struct ggml_tensor * a) { - return ggml_round_impl(ctx, a, true); + return ggml_ttsround_impl(ctx, a, true); } static struct ggml_tensor * ggml_mod_impl( struct ggml_context * ctx, diff --git a/otherarch/ttscpp/src/kokoro_model.cpp b/otherarch/ttscpp/src/kokoro_model.cpp index eb0d43aa9..5dde33afc 100644 --- a/otherarch/ttscpp/src/kokoro_model.cpp +++ b/otherarch/ttscpp/src/kokoro_model.cpp @@ -1041,8 +1041,8 @@ struct ggml_cgraph * kokoro_duration_runner::build_kokoro_duration_graph(kokoro_ cur = build_lstm(ctx, cur, model->prosody_pred->duration_proj_lstm, batch.n_tokens, gf); cur = ggml_sigmoid(ctx, ggml_add(ctx, ggml_mul_mat(ctx, model->prosody_pred->duration_proj, cur), model->prosody_pred->duration_proj_bias)); // If we were to support speed we would add a constant tensor for the speed and divide here. - len = ggml_round(ctx, ggml_sum_rows(ctx, cur)); - len = ggml_clamp(ctx, ggml_round(ctx, ggml_sum_rows(ctx, cur)), 1.0f, 50.0f); + len = ggml_ttsround(ctx, ggml_sum_rows(ctx, cur)); + len = ggml_clamp(ctx, ggml_ttsround(ctx, ggml_sum_rows(ctx, cur)), 1.0f, 50.0f); ggml_build_forward_expand(gf, len);