Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-metal/ggml-metal-ops.h # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-metal / ggml-metal-ops.h` 113 lines ยท 5550 bytes Raw Blame History 1 #pragma once 2 3 #include "ggml-metal-device.h" 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 typedef struct ggml_metal_op * ggml_metal_op_t; 10 11 struct ggml_metal_fusion; // forward decl (ggml-metal-device.h) 12 13 ggml_metal_op_t ggml_metal_op_init( 14 ggml_metal_device_t dev, 15 ggml_metal_cmd_buf_t cmd_buf, 16 struct ggml_cgraph * gf, 17 struct ggml_metal_fusion_info * finfo, 18 int idx_start, 19 int idx_end, 20 bool use_concurrency, 21 bool use_capture, 22 int debug_graph); 23 24 void ggml_metal_op_free(ggml_metal_op_t ctx); 25 26 int ggml_metal_op_n_nodes(ggml_metal_op_t ctx); 27 28 int ggml_metal_op_encode(ggml_metal_op_t ctx, int idx); 29 30 // 31 // available ops: 32 // 33 34 // tokens per expert 35 size_t ggml_metal_op_mul_mat_id_extra_tpe(const struct ggml_tensor * op); 36 37 // id map [n_tokens, n_expert] 38 size_t ggml_metal_op_mul_mat_id_extra_ids(const struct ggml_tensor * op); 39 40 // return true if we should use the FA vector kernel for this op 41 bool ggml_metal_op_flash_attn_ext_use_vec(const struct ggml_tensor * op); 42 43 size_t ggml_metal_op_flash_attn_ext_extra_pad(const struct ggml_tensor * op); 44 size_t ggml_metal_op_flash_attn_ext_extra_blk(const struct ggml_tensor * op); 45 size_t ggml_metal_op_flash_attn_ext_extra_tmp(const struct ggml_tensor * op); 46 size_t ggml_metal_op_flash_attn_ext_extra_kv_f16(const struct ggml_tensor * op); 47 size_t ggml_metal_op_flash_attn_ext_extra_idx(const struct ggml_tensor * op); 48 size_t ggml_metal_op_flash_attn_ext_extra_rows(const struct ggml_tensor * op); 49 50 size_t ggml_metal_op_argmax_extra(const struct ggml_tensor * op); 51 52 int ggml_metal_op_concat (ggml_metal_op_t ctx, int idx); 53 int ggml_metal_op_repeat (ggml_metal_op_t ctx, int idx); 54 int ggml_metal_op_acc (ggml_metal_op_t ctx, int idx); 55 int ggml_metal_op_unary (ggml_metal_op_t ctx, int idx); 56 int ggml_metal_op_glu (ggml_metal_op_t ctx, int idx); 57 int ggml_metal_op_sum (ggml_metal_op_t ctx, int idx); 58 int ggml_metal_op_sum_rows (ggml_metal_op_t ctx, int idx); 59 int ggml_metal_op_cumsum (ggml_metal_op_t ctx, int idx); 60 int ggml_metal_op_get_rows (ggml_metal_op_t ctx, int idx); 61 int ggml_metal_op_set_rows (ggml_metal_op_t ctx, int idx); 62 int ggml_metal_op_diag (ggml_metal_op_t ctx, int idx); 63 int ggml_metal_op_lightning_indexer (ggml_metal_op_t ctx, int idx); 64 int ggml_metal_op_top_k_mask (ggml_metal_op_t ctx, int idx); 65 int ggml_metal_op_dsv4_hc (ggml_metal_op_t ctx, int idx); 66 int ggml_metal_op_soft_max (ggml_metal_op_t ctx, int idx); 67 int ggml_metal_op_ssm_conv (ggml_metal_op_t ctx, int idx); 68 int ggml_metal_op_ssm_scan (ggml_metal_op_t ctx, int idx); 69 int ggml_metal_op_rwkv (ggml_metal_op_t ctx, int idx); 70 int ggml_metal_op_gated_delta_net (ggml_metal_op_t ctx, int idx); 71 int ggml_metal_op_solve_tri (ggml_metal_op_t ctx, int idx); 72 int ggml_metal_op_set (ggml_metal_op_t ctx, int idx); 73 int ggml_metal_op_cpy (ggml_metal_op_t ctx, int idx); 74 int ggml_metal_op_pool_1d (ggml_metal_op_t ctx, int idx); 75 int ggml_metal_op_pool_2d (ggml_metal_op_t ctx, int idx); 76 int ggml_metal_op_fwht (ggml_metal_op_t ctx, int idx); 77 int ggml_metal_op_mul_mat (ggml_metal_op_t ctx, int idx); 78 int ggml_metal_op_mul_mat_id (ggml_metal_op_t ctx, int idx); 79 int ggml_metal_op_add_id (ggml_metal_op_t ctx, int idx); 80 int ggml_metal_op_flash_attn_ext (ggml_metal_op_t ctx, int idx); 81 int ggml_metal_op_bin (ggml_metal_op_t ctx, int idx); 82 int ggml_metal_op_silu_back (ggml_metal_op_t ctx, int idx); 83 int ggml_metal_op_l2_norm (ggml_metal_op_t ctx, int idx); 84 int ggml_metal_op_group_norm (ggml_metal_op_t ctx, int idx); 85 int ggml_metal_op_norm (ggml_metal_op_t ctx, int idx); 86 int ggml_metal_op_rope (ggml_metal_op_t ctx, int idx); 87 int ggml_metal_op_im2col (ggml_metal_op_t ctx, int idx); 88 int ggml_metal_op_conv_2d (ggml_metal_op_t ctx, int idx); 89 int ggml_metal_op_conv_2d_dw (ggml_metal_op_t ctx, int idx); 90 int ggml_metal_op_conv_3d (ggml_metal_op_t ctx, int idx); 91 int ggml_metal_op_conv_transpose_1d (ggml_metal_op_t ctx, int idx); 92 int ggml_metal_op_conv_transpose_2d (ggml_metal_op_t ctx, int idx); 93 int ggml_metal_op_col2im_1d (ggml_metal_op_t ctx, int idx); 94 int ggml_metal_op_snake_fused (ggml_metal_op_t ctx, int idx); 95 int ggml_metal_op_upscale (ggml_metal_op_t ctx, int idx); 96 int ggml_metal_op_pad (ggml_metal_op_t ctx, int idx); 97 int ggml_metal_op_pad_reflect_1d (ggml_metal_op_t ctx, int idx); 98 int ggml_metal_op_roll (ggml_metal_op_t ctx, int idx); 99 int ggml_metal_op_arange (ggml_metal_op_t ctx, int idx); 100 int ggml_metal_op_timestep_embedding(ggml_metal_op_t ctx, int idx); 101 int ggml_metal_op_argmax (ggml_metal_op_t ctx, int idx); 102 int ggml_metal_op_argsort (ggml_metal_op_t ctx, int idx); 103 int ggml_metal_op_top_k (ggml_metal_op_t ctx, int idx); 104 int ggml_metal_op_topk_moe (ggml_metal_op_t ctx, int idx); 105 int ggml_metal_op_moe_reduce (ggml_metal_op_t ctx, int idx); 106 int ggml_metal_op_tri (ggml_metal_op_t ctx, int idx); 107 int ggml_metal_op_opt_step_adamw (ggml_metal_op_t ctx, int idx); 108 int ggml_metal_op_opt_step_sgd (ggml_metal_op_t ctx, int idx); 109 int ggml_metal_op_count_equal (ggml_metal_op_t ctx, int idx); 110 111 #ifdef __cplusplus 112 } 113 #endif