char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aman Guptaggml: add SWIGLU_CLAMP (#27930)0190529ec

char/aliceai-t5-moe
5.5 KiB88 linesraw
1#include "op_table.h"
2
3#include "utils.h"
4
5#include <openvino/op/add.hpp>
6#include <openvino/op/divide.hpp>
7#include <openvino/op/exp.hpp>
8#include <openvino/op/gather.hpp>
9#include <openvino/op/gelu.hpp>
10#include <openvino/op/matmul.hpp>
11#include <openvino/op/multiply.hpp>
12#include <openvino/op/negative.hpp>
13#include <openvino/op/relu.hpp>
14#include <openvino/op/sigmoid.hpp>
15#include <openvino/op/subtract.hpp>
16#include <openvino/op/tanh.hpp>
17
18namespace ov {
19namespace frontend {
20namespace ggml {
21
22std::unordered_map<std::string, CreatorFunction> get_supported_ops() {
23    using namespace ov::op;
24    return {
25        {"GGML_OP_ADD",             op::translate_add                              },
26        {"GGML_OP_ADD1",            op::translate_1to1_match_2_inputs<v1::Add>     },
27        {"GGML_OP_ADD_ID",          op::translate_add_id                           },
28        {"GGML_OP_CONCAT",          op::translate_concat                           },
29        {"GGML_OP_CONT",            op::translate_cont                             },
30        {"GGML_OP_DIV",             op::translate_div                              },
31        {"GGML_OP_FILL",            op::translate_fill                             },
32        {"GGML_OP_GET_ROWS",        op::translate_get_rows                         },
33        {"GGML_OP_IM2COL",          op::translate_im2col                           },
34        {"GGML_OP_MUL",             op::translate_1to1_match_2_inputs<v1::Multiply>},
35        {"GGML_OP_MUL_MAT",         op::translate_mulmat                           },
36        {"GGML_OP_MUL_MAT_ID",      op::translate_mul_mat_id                       },
37        {"GGML_OP_PERMUTE",         op::translate_permute                          },
38        {"GGML_OP_RESHAPE",         op::translate_reshape                          },
39        {"GGML_OP_RMS_NORM",        op::translate_rms_norm                         },
40        {"GGML_OP_NORM",            op::translate_norm                             },
41        {"GGML_OP_L2_NORM",         op::translate_l2_norm                          },
42        {"GGML_OP_SUM_ROWS",        op::translate_sum_rows                         },
43        {"GGML_OP_ROPE",            op::translate_rope                             },
44        {"GGML_OP_SCALE",           op::translate_scale                            },
45        {"GGML_OP_SQR",             op::translate_sqr                              },
46        {"GGML_OP_SQRT",            op::translate_sqrt                             },
47        {"GGML_OP_SOFT_MAX",        op::translate_soft_max                         },
48        {"GGML_OP_ARGSORT",         op::translate_argsort                          },
49        {"GGML_OP_SUB",             op::translate_1to1_match_2_inputs<v1::Subtract>},
50        {"GGML_OP_TRANSPOSE",       op::translate_transpose                        },
51        {"GGML_UNARY_OP_GELU",      op::translate_1to1_match_1_input<v7::Gelu>     },
52        {"GGML_UNARY_OP_SIGMOID",   op::translate_1to1_match_1_input<v0::Sigmoid>  },
53        {"GGML_UNARY_OP_SILU",      op::translate_unary_silu                       },
54        {"GGML_UNARY_OP_SOFTPLUS",  op::translate_unary_softplus                   },
55        {"GGML_UNARY_OP_TANH",      op::translate_1to1_match_1_input<v0::Tanh>     },
56        {"GGML_UNARY_OP_SIGMOID",   op::translate_1to1_match_1_input<v0::Sigmoid>  },
57        {"GGML_UNARY_OP_EXP",       op::translate_1to1_match_1_input<v0::Exp>      },
58        {"GGML_UNARY_OP_NEG",       op::translate_1to1_match_1_input<v0::Negative> },
59        {"GGML_UNARY_OP_RELU",      op::translate_1to1_match_1_input<v0::Relu>     },
60        {"GGML_OP_VIEW",            op::translate_view                             },
61        {"GGML_GLU_OP_SWIGLU",      op::translate_glu_swiglu                       },
62        {"GGML_GLU_OP_SWIGLU_OAI",  op::translate_glu_swiglu_oai                   },
63        {"GGML_GLU_OP_SWIGLU_CLAMP", op::translate_glu_swiglu_clamp                 },
64        {"GGML_GLU_OP_GEGLU",       op::translate_glu_geglu                        },
65        {"GGML_GLU_OP_GEGLU_QUICK", op::translate_glu_geglu_quick                  },
66        {"GGML_OP_SET_ROWS",        op::translate_set_rows                         },
67        {"GGML_OP_CPY",             op::translate_cpy                              },
68        {"GGML_OP_FLASH_ATTN_EXT",  op::translate_flash_attn_ext                   },
69        {"GGML_OP_CLAMP",           op::translate_clamp                            },
70        {"GGML_OP_PAD",             op::translate_pad                              },
71        {"GGML_OP_SSM_CONV",        op::translate_ssm_conv                         },
72        {"GGML_OP_GATED_DELTA_NET", op::translate_gated_delta_net                  },
73        {"GGML_OP_REPEAT",          op::translate_repeat                           },
74        {"GGML_OP_CUMSUM",          op::translate_cumsum                           },
75        {"GGML_OP_FILL",            op::translate_fill                             },
76        {"GGML_OP_DIAG",            op::translate_diag                             },
77        {"GGML_OP_TRI",             op::translate_tri                              },
78        {"GGML_OP_SET",             op::translate_set                              },
79        {"GGML_OP_POOL_2D",         op::translate_pool_2d                          },
80        {"GGML_OP_ROLL",            op::translate_roll                             },
81        // solve_tri has accuracy issues on GPU
82        // {"GGML_OP_SOLVE_TRI",       op::translate_solve_tri                        },
83    };
84}
85
86}  // namespace ggml
87}  // namespace frontend
88}  // namespace ov