From: Georgi Gerganov Date: Tue, 30 May 2023 07:18:31 +0000 (+0300) Subject: ggml : rename conv_1d ops to reflect half-padding used X-Git-Tag: upstream/0.0.1642~1421 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=abe20d042a7c94fea784c67e6fb946259409730b;p=pkg%2Fggml%2Fsources%2Fggml ggml : rename conv_1d ops to reflect half-padding used --- diff --git a/examples/whisper/whisper.cpp b/examples/whisper/whisper.cpp index 6faa3f2f..198a1a9f 100644 --- a/examples/whisper/whisper.cpp +++ b/examples/whisper/whisper.cpp @@ -1468,7 +1468,7 @@ static bool whisper_encode_internal( { wstate.use_buf(ctx0, 1); - cur = ggml_conv_1d_1s(ctx0, model.e_conv_1_w, mel); + cur = ggml_conv_1d_1s_ph(ctx0, model.e_conv_1_w, mel); cur = ggml_add(ctx0, ggml_repeat(ctx0, model.e_conv_1_b, @@ -1479,7 +1479,7 @@ static bool whisper_encode_internal( wstate.use_buf(ctx0, 0); - cur = ggml_conv_1d_2s(ctx0, model.e_conv_2_w, cur); + cur = ggml_conv_1d_2s_ph(ctx0, model.e_conv_2_w, cur); cur = ggml_add(ctx0, ggml_repeat(ctx0, model.e_conv_2_b, diff --git a/include/ggml/ggml.h b/include/ggml/ggml.h index 60c0ad8b..fa0f5ecd 100644 --- a/include/ggml/ggml.h +++ b/include/ggml/ggml.h @@ -923,16 +923,16 @@ extern "C" { float min, float max); - // padding = 1 + // padding = half // TODO: we don't support extra parameters for now // that's why we are hard-coding the stride, padding, and dilation // not great .. - GGML_API struct ggml_tensor * ggml_conv_1d_1s( + GGML_API struct ggml_tensor * ggml_conv_1d_1s_ph( struct ggml_context * ctx, struct ggml_tensor * a, struct ggml_tensor * b); - GGML_API struct ggml_tensor * ggml_conv_1d_2s( + GGML_API struct ggml_tensor * ggml_conv_1d_2s_ph( struct ggml_context * ctx, struct ggml_tensor * a, struct ggml_tensor * b); diff --git a/src/ggml.c b/src/ggml.c index 4d17c54f..3a806d49 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -3607,8 +3607,8 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = { "rope_back(x)", "alibi(x)", "clamp(x)", - "conv_1d_1s(x)", - "conv_1d_2s(x)", + "conv_1d_1s_ph(x)", + "conv_1d_2s_ph(x)", "flash_attn(x)", "flash_ff(x)", @@ -6393,9 +6393,9 @@ struct ggml_tensor * ggml_clamp( return result; } -// ggml_conv_1d_1s +// ggml_conv_1d_1s_ph -struct ggml_tensor * ggml_conv_1d_1s( +struct ggml_tensor * ggml_conv_1d_1s_ph( struct ggml_context * ctx, struct ggml_tensor * a, struct ggml_tensor * b) { @@ -6420,9 +6420,9 @@ struct ggml_tensor * ggml_conv_1d_1s( return result; } -// ggml_conv_1d_2s +// ggml_conv_1d_2s_ph -struct ggml_tensor * ggml_conv_1d_2s( +struct ggml_tensor * ggml_conv_1d_2s_ph( struct ggml_context * ctx, struct ggml_tensor * a, struct ggml_tensor * b) { @@ -11575,9 +11575,9 @@ static void ggml_compute_forward_rope_back( } } -// ggml_compute_forward_conv_1d_1s +// ggml_compute_forward_conv_1d_1s_ph -static void ggml_compute_forward_conv_1d_1s_f16_f32( +static void ggml_compute_forward_conv_1d_1s_ph_f16_f32( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -11697,7 +11697,7 @@ static void ggml_compute_forward_conv_1d_1s_f16_f32( } } -static void ggml_compute_forward_conv_1d_1s_f32( +static void ggml_compute_forward_conv_1d_1s_ph_f32( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -11817,7 +11817,7 @@ static void ggml_compute_forward_conv_1d_1s_f32( } } -static void ggml_compute_forward_conv_1d_1s( +static void ggml_compute_forward_conv_1d_1s_ph( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -11825,11 +11825,11 @@ static void ggml_compute_forward_conv_1d_1s( switch (src0->type) { case GGML_TYPE_F16: { - ggml_compute_forward_conv_1d_1s_f16_f32(params, src0, src1, dst); + ggml_compute_forward_conv_1d_1s_ph_f16_f32(params, src0, src1, dst); } break; case GGML_TYPE_F32: { - ggml_compute_forward_conv_1d_1s_f32(params, src0, src1, dst); + ggml_compute_forward_conv_1d_1s_ph_f32(params, src0, src1, dst); } break; default: { @@ -11838,9 +11838,9 @@ static void ggml_compute_forward_conv_1d_1s( } } -// ggml_compute_forward_conv_1d_2s +// ggml_compute_forward_conv_1d_2s_ph -static void ggml_compute_forward_conv_1d_2s_f16_f32( +static void ggml_compute_forward_conv_1d_2s_ph_f16_f32( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -11960,7 +11960,7 @@ static void ggml_compute_forward_conv_1d_2s_f16_f32( } } -static void ggml_compute_forward_conv_1d_2s_f32( +static void ggml_compute_forward_conv_1d_2s_ph_f32( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -12080,7 +12080,7 @@ static void ggml_compute_forward_conv_1d_2s_f32( } } -static void ggml_compute_forward_conv_1d_2s( +static void ggml_compute_forward_conv_1d_2s_ph( const struct ggml_compute_params * params, const struct ggml_tensor * src0, const struct ggml_tensor * src1, @@ -12088,11 +12088,11 @@ static void ggml_compute_forward_conv_1d_2s( switch (src0->type) { case GGML_TYPE_F16: { - ggml_compute_forward_conv_1d_2s_f16_f32(params, src0, src1, dst); + ggml_compute_forward_conv_1d_2s_ph_f16_f32(params, src0, src1, dst); } break; case GGML_TYPE_F32: { - ggml_compute_forward_conv_1d_2s_f32(params, src0, src1, dst); + ggml_compute_forward_conv_1d_2s_ph_f32(params, src0, src1, dst); } break; default: { @@ -13064,11 +13064,11 @@ static void ggml_compute_forward(struct ggml_compute_params * params, struct ggm } break; case GGML_OP_CONV_1D_1S: { - ggml_compute_forward_conv_1d_1s(params, tensor->src0, tensor->src1, tensor); + ggml_compute_forward_conv_1d_1s_ph(params, tensor->src0, tensor->src1, tensor); } break; case GGML_OP_CONV_1D_2S: { - ggml_compute_forward_conv_1d_2s(params, tensor->src0, tensor->src1, tensor); + ggml_compute_forward_conv_1d_2s_ph(params, tensor->src0, tensor->src1, tensor); } break; case GGML_OP_FLASH_ATTN: {