rename tts.cpp ggml_round to ggml_ttsround to avoid conflict

This commit is contained in:
Concedo
2025-10-16 14:24:44 +08:00
parent ebc1cb0641
commit c18d7991c8
4 changed files with 19 additions and 19 deletions
+3 -3
View File
@@ -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
+8 -8
View File
@@ -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:
+6 -6
View File
@@ -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,
+2 -2
View File
@@ -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);