From ef3d42a3aa4ce01ce20b9f9bbcf3d8eabff40e94 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 13 May 2023 15:34:56 +0300 Subject: [PATCH] ggml : fix clang-tidy warnings --- ggml.c | 6 ------ ggml.h | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ggml.c b/ggml.c index 4e4fb0746..675eb0d2f 100644 --- a/ggml.c +++ b/ggml.c @@ -13715,17 +13715,11 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph) case GGML_OP_GET_ROWS_BACK: case GGML_OP_DIAG: case GGML_OP_DIAG_MASK_INF: - { - node->n_tasks = 1; - } break; case GGML_OP_DIAG_MASK_ZERO: { node->n_tasks = 1; } break; case GGML_OP_SOFT_MAX: - { - node->n_tasks = n_threads; - } break; case GGML_OP_ROPE: case GGML_OP_ROPE_BACK: { diff --git a/ggml.h b/ggml.h index 8730b7916..2745fb30b 100644 --- a/ggml.h +++ b/ggml.h @@ -612,10 +612,12 @@ extern "C" { struct ggml_context * ctx, struct ggml_tensor * a); - struct ggml_tensor * ggml_silu_back( + // a - x + // b - dy + GGML_API struct ggml_tensor * ggml_silu_back( struct ggml_context * ctx, - struct ggml_tensor * x, - struct ggml_tensor * dy); + struct ggml_tensor * a, + struct ggml_tensor * b); // normalize along rows // TODO: eps is hardcoded to 1e-5 for now @@ -627,10 +629,12 @@ extern "C" { struct ggml_context * ctx, struct ggml_tensor * a); + // a - x + // b - dy GGML_API struct ggml_tensor * ggml_rms_norm_back( struct ggml_context * ctx, - struct ggml_tensor * x, - struct ggml_tensor * dy); + struct ggml_tensor * a, + struct ggml_tensor * b); // A: m rows, n columns // B: p rows, n columns (i.e. we transpose it internally) @@ -870,9 +874,10 @@ extern "C" { int mode); // rotary position embedding backward, i.e compute dx from dy + // a - dy GGML_API struct ggml_tensor * ggml_rope_back( struct ggml_context * ctx, - struct ggml_tensor * dy, + struct ggml_tensor * a, int n_past, int n_dims, int mode); @@ -921,13 +926,13 @@ extern "C" { GGML_API struct ggml_tensor * ggml_map_unary_f32( struct ggml_context * ctx, struct ggml_tensor * a, - const ggml_unary_op_f32_t fun); + ggml_unary_op_f32_t fun); GGML_API struct ggml_tensor * ggml_map_binary_f32( struct ggml_context * ctx, struct ggml_tensor * a, struct ggml_tensor * b, - const ggml_binary_op_f32_t fun); + ggml_binary_op_f32_t fun); // // automatic differentiation