interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-hexagon / htp-fusion.h

33 lines · 1280 bytes Raw Blame History
1#ifndef HTP_FUSION_H
2#define HTP_FUSION_H
3
4#include "htp-common.h"
5
6enum htp_fusion_flags {
7 HTP_FUSE_ALLREDUCE_ADD = (1 << 1), // 2
8 HTP_FUSE_RMS_NORM_MUL = (1 << 2), // 4
9 HTP_FUSE_MUL_MAT_ADD = (1 << 3), // 8
10 HTP_FUSE_MUL_MAT_NX = (1 << 4), // 16
11 HTP_FUSE_MUL_MAT_ID_NX = (1 << 5), // 32
12 HTP_FUSE_GDN_CPY = (1 << 6), // 64
13 HTP_FUSE_REPEAT_GET_ROWS = (1 << 7), // 128
14 HTP_FUSE_UNARY_MUL_GLU = (1 << 8), // 256
15 HTP_FUSE_MUL_MUL_SCALAR = (1 << 9), // 512
16 HTP_FUSE_BINARY_NX = (1 << 10), // 1024
17 HTP_FUSE_RMS_NORM_SCALE = (1 << 11), // 2048
18 HTP_FUSE_SSM_CONV_SILU = (1 << 12), // 4096
19};
20
21static inline bool htp_fusion_enabled(int flag) {
22 if (opt_opfusion <= 0) return false;
23 if (opt_opfusion == 1) return true; // 1 enables all
24 return (opt_opfusion & flag) != 0;
25}
26
27bool htp_fusion_can_stack(const struct ggml_tensor * a);
28bool htp_fusion_can_stack(const struct ggml_tensor * a, const struct ggml_tensor * b);
29int htp_fusion_max(const struct ggml_cgraph * graph, int idx);
30void htp_fusion_tag_graph(struct ggml_cgraph * graph);
31bool htp_fusion_try_fuse(const struct ggml_hexagon_session * sess, struct htp_opnode & prev, const struct htp_opnode & cur);
32
33#endif // HTP_FUSION_H