Skip to content

Commit 3b53634

Browse files
authored
metal : fuse non-sequential nodes (#16102)
* metal : fuse non-sequential nodes * cont : add comment * cont : simplify bounds checks
1 parent 1384abf commit 3b53634

File tree

3 files changed

+161
-135
lines changed

3 files changed

+161
-135
lines changed

ggml/src/ggml-metal/ggml-metal-context.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,13 +567,13 @@ void ggml_metal_set_n_cb(ggml_metal_t ctx, int n_cb) {
567567
ctx->debug_graph,
568568
ctx->debug_fusion);
569569

570-
for (int idx = idx_start; idx < idx_end;) {
570+
for (int idx = 0; idx < ggml_metal_op_n_nodes(ctx_op); ++idx) {
571571
const int res = ggml_metal_op_encode(ctx_op, idx);
572572
if (res == 0) {
573573
break;
574574
}
575575

576-
idx += res;
576+
idx += res - 1;
577577
}
578578

579579
ggml_metal_op_free(ctx_op);

0 commit comments

Comments
 (0)