Skip to content

Commit 17c3927

Browse files
committed
use ggml_can_fuse_subgraph
1 parent 2de54df commit 17c3927

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,16 +2845,7 @@ static bool ggml_cuda_can_fuse(const struct ggml_cgraph * cgraph, int node_idx,
28452845
}
28462846

28472847
if (ops.size() == topk_moe_ops_delayed_softmax.size() &&
2848-
std::equal(ops.begin(), ops.end(), topk_moe_ops_delayed_softmax.begin())) {
2849-
if (node_idx + topk_moe_ops_delayed_softmax.size() > (size_t) cgraph->n_nodes) {
2850-
return false;
2851-
}
2852-
for (size_t i = 0; i < topk_moe_ops_delayed_softmax.size(); i++) {
2853-
if (cgraph->nodes[node_idx + i]->op != topk_moe_ops_delayed_softmax.begin()[i]) {
2854-
return false;
2855-
}
2856-
}
2857-
2848+
ggml_can_fuse_subgraph(cgraph, node_idx, topk_moe_ops_delayed_softmax, { node_idx + 2, node_idx + 5 })) {
28582849
ggml_tensor * softmax = cgraph->nodes[node_idx + 4];
28592850
ggml_tensor * weights = cgraph->nodes[node_idx + 5];
28602851

0 commit comments

Comments
 (0)