metal : fuse non-sequential nodes (#16102)

* metal : fuse non-sequential nodes

* cont : add comment

* cont : simplify bounds checks
This commit is contained in:
Georgi Gerganov
2025-09-28 09:34:05 +03:00
committed by GitHub
parent 1384abf8b8
commit 3b53634fe3
3 changed files with 161 additions and 135 deletions
+2 -2
View File
@@ -567,13 +567,13 @@ void ggml_metal_set_n_cb(ggml_metal_t ctx, int n_cb) {
ctx->debug_graph,
ctx->debug_fusion);
for (int idx = idx_start; idx < idx_end;) {
for (int idx = 0; idx < ggml_metal_op_n_nodes(ctx_op); ++idx) {
const int res = ggml_metal_op_encode(ctx_op, idx);
if (res == 0) {
break;
}
idx += res;
idx += res - 1;
}
ggml_metal_op_free(ctx_op);