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-cuda / topk-moe.cuh

33 lines · 1227 bytes Raw Blame History
1#include "common.cuh"
2#include "ggml.h"
3
4#include <initializer_list>
5
6// Rows that one CUDA block handles.
7#define TOPK_MOE_ROWS_PER_BLOCK 8
8
9struct ggml_cuda_topk_moe_args {
10 bool sigmoid{};
11 bool sqrt_softplus{};
12 bool softmax{};
13 bool delayed_softmax{};
14 bool prob_bias{};
15 bool norm{};
16 bool scale{};
17 int n_groups{}; // > 0: pick experts only from the top n_group_used expert groups
18 int n_group_used{};
19};
20
21void ggml_cuda_op_topk_moe(ggml_backend_cuda_context & ctx,
22 const ggml_tensor * logits,
23 ggml_tensor * weights,
24 ggml_tensor * ids,
25 const ggml_tensor * clamp,
26 const ggml_tensor * scale,
27 const ggml_tensor * bias,
28 const ggml_cuda_topk_moe_args & args);
29
30bool ggml_cuda_should_use_topk_moe(const ggml_tensor * gating_op,
31 const ggml_tensor * weights,
32 const ggml_tensor * logits,
33 const ggml_tensor * ids);