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-hexagon/htp-kparams.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-hexagon / htp-kparams.h` 156 lines ยท 4589 bytes Raw Blame History 1 #ifndef HTP_KPARAMS_H 2 #define HTP_KPARAMS_H 3 4 #include "htp-common.h" 5 6 #include "htp/allreduce-ops.h" 7 #include "htp/argsort-ops.h" 8 #include "htp/binary-ops.h" 9 #include "htp/concat-ops.h" 10 #include "htp/conv2d-ops.h" 11 #include "htp/cpy-ops.h" 12 #include "htp/cumsum-ops.h" 13 #include "htp/diag-ops.h" 14 #include "htp/dsv4-hc-ops.h" 15 #include "htp/fill-ops.h" 16 #include "htp/flash-attn-ops.h" 17 #include "htp/gated-delta-net-ops.h" 18 #include "htp/get-rows-ops.h" 19 #include "htp/glu-ops.h" 20 #include "htp/im2col-ops.h" 21 #include "htp/lightning-indexer-ops.h" 22 #include "htp/matmul-ops.h" 23 #include "htp/pad-ops.h" 24 #include "htp/pool-ops.h" 25 #include "htp/repeat-ops.h" 26 #include "htp/roll-ops.h" 27 #include "htp/rope-ops.h" 28 #include "htp/set-rows-ops.h" 29 #include "htp/softmax-ops.h" 30 #include "htp/solve-tri-ops.h" 31 #include "htp/ssm-conv.h" 32 #include "htp/sum-rows-ops.h" 33 #include "htp/top-k-mask-ops.h" 34 #include "htp/unary-ops.h" 35 #include "htp/upscale-ops.h" 36 37 #include 38 #include 39 40 bool htp_rows_stride(const int64_t * ne, const size_t * nb, size_t * stride); 41 bool htp_matmul_can_collapse(const struct ggml_tensor * src0, const struct ggml_tensor * src1, const struct ggml_tensor * dst); 42 bool htp_matmul_add_can_collapse(const struct ggml_tensor * src0, const struct ggml_tensor * src1, const struct ggml_tensor * src2, const struct ggml_tensor * dst); 43 ggml_tensor htp_tensor_collapse_rows(const struct ggml_tensor * t); 44 45 template 46 auto htp_kparams_type(bool (*)(Args...)) -> std::remove_pointer_t(), ...))>>; 47 48 template 49 static inline bool htp_kparams_check(Args &&... args) { 50 decltype(htp_kparams_type(SolveFn)) kparams; 51 return SolveFn(std::forward(args)..., &kparams); 52 } 53 54 struct htp_opnode; 55 56 bool htp_kparams_solve( 57 const struct ggml_hexagon_session * sess, 58 struct htp_opnode & node 59 ); 60 61 void htp_opnode_collapse( 62 const struct ggml_hexagon_session * sess, 63 struct htp_opnode & node 64 ); 65 66 bool htp_kparams_solve( 67 const struct ggml_hexagon_session * sess, 68 const struct ggml_tensor * op, 69 void * kparams = nullptr 70 ); 71 72 static inline bool htp_kparams_check( 73 const struct ggml_hexagon_session * sess, 74 const struct ggml_tensor * op 75 ) { 76 return htp_kparams_solve(sess, op, nullptr); 77 } 78 79 bool htp_kparams_solve_allreduce( 80 const struct ggml_hexagon_session * sess, 81 const struct ggml_tensor * dst, 82 uint32_t rank, 83 uint32_t n_ranks, 84 bool has_add, 85 bool is_row_bcast, 86 bool is_shard_ok, 87 struct htp_allreduce_kernel_params * kparams 88 ); 89 90 bool htp_kparams_solve_rms_norm_mul( 91 const struct ggml_hexagon_session * sess, 92 const struct ggml_tensor * src0, 93 const struct ggml_tensor * src1, 94 const struct ggml_tensor * dst, 95 struct htp_unary_kernel_params * kparams 96 ); 97 98 bool htp_kparams_solve_matmul_add( 99 const struct ggml_hexagon_session * sess, 100 const struct ggml_tensor * src0, 101 const struct ggml_tensor * src1, 102 const struct ggml_tensor * src2, 103 const struct ggml_tensor * dst, 104 struct htp_mm_kernel_params * kparams 105 ); 106 107 bool htp_kparams_solve_mmnx( 108 const struct ggml_hexagon_session * sess, 109 const struct ggml_tensor * src0, 110 const struct ggml_tensor * act, 111 int32_t n_weights, 112 struct htp_mm_kernel_params * kparams 113 ); 114 115 bool htp_kparams_solve_mmidnx( 116 const struct ggml_hexagon_session * sess, 117 const struct ggml_tensor * src0, 118 const struct ggml_tensor * act, 119 const struct ggml_tensor * dst, 120 int32_t n_weights, 121 struct htp_mm_kernel_params * kparams 122 ); 123 124 bool htp_kparams_solve_repeat_get_rows( 125 const struct ggml_hexagon_session * sess, 126 const struct ggml_tensor * src0, 127 const struct ggml_tensor * src1, 128 const struct ggml_tensor * dst, 129 struct htp_get_rows_kernel_params * kparams 130 ); 131 132 bool htp_kparams_solve_unary_mul_glu( 133 const struct ggml_hexagon_session * sess, 134 uint32_t op, 135 const struct ggml_tensor * src0, 136 const struct ggml_tensor * src1, 137 const struct ggml_tensor * dst, 138 struct htp_glu_kernel_params * kparams 139 ); 140 141 bool htp_kparams_solve_upscale( 142 const struct ggml_hexagon_session * sess, 143 const struct ggml_tensor * src0, 144 const struct ggml_tensor * dst, 145 struct htp_upscale_kernel_params * kparams 146 ); 147 148 static inline bool htp_kparams_solve_upscale( 149 const struct ggml_hexagon_session * sess, 150 const struct ggml_tensor * op, 151 struct htp_upscale_kernel_params * kparams 152 ) { 153 return htp_kparams_solve_upscale(sess, op->src[0], op, kparams); 154 } 155 156 #endif // HTP_KPARAMS_H