#ifndef HTP_FUSION_H
#define HTP_FUSION_H
#include "htp-common.h"
enum htp_fusion_flags {
HTP_FUSE_ALLREDUCE_ADD = (1 << 1), HTP_FUSE_RMS_NORM_MUL = (1 << 2), HTP_FUSE_MUL_MAT_ADD = (1 << 3), HTP_FUSE_MUL_MAT_NX = (1 << 4), HTP_FUSE_MUL_MAT_ID_NX = (1 << 5), HTP_FUSE_GDN_CPY = (1 << 6), HTP_FUSE_REPEAT_GET_ROWS = (1 << 7), HTP_FUSE_UNARY_MUL_GLU = (1 << 8), HTP_FUSE_MUL_MUL_SCALAR = (1 << 9), HTP_FUSE_BINARY_NX = (1 << 10), HTP_FUSE_RMS_NORM_SCALE = (1 << 11), HTP_FUSE_SSM_CONV_SILU = (1 << 12), };
static inline bool htp_fusion_enabled(int flag) {
if (opt_opfusion <= 0) return false;
if (opt_opfusion == 1) return true; return (opt_opfusion & flag) != 0;
}
bool htp_fusion_can_stack(const struct ggml_tensor * a);
bool htp_fusion_can_stack(const struct ggml_tensor * a, const struct ggml_tensor * b);
int htp_fusion_max(const struct ggml_cgraph * graph, int idx);
void htp_fusion_tag_graph(struct ggml_cgraph * graph);
bool htp_fusion_try_fuse(const struct ggml_hexagon_session * sess, struct htp_opnode & prev, const struct htp_opnode & cur);
#endif