metal : avoid divisions in bin kernel (#20426)

* metal : avoid modulus in bin kernel when not broadcasting

* metal : fix capture_started flag
This commit is contained in:
Georgi Gerganov
2026-03-12 09:42:40 +02:00
committed by GitHub
parent 4cc6eb158c
commit e4cff0956b
4 changed files with 14 additions and 9 deletions
+1 -3
View File
@@ -3180,9 +3180,7 @@ int ggml_metal_op_bin(ggml_metal_op_t ctx, int idx) {
ggml_metal_encoder_set_buffer (enc, bid_dst, 3);
if (pipeline.cnt) {
const int n = pipeline.c4 ? ggml_nelements(op)/4 : ggml_nelements(op);
ggml_metal_encoder_dispatch_threadgroups(enc, n, 1, 1, 1, 1, 1);
ggml_metal_encoder_dispatch_threadgroups(enc, args.ne0, ggml_nrows(op), 1, 1, 1, 1);
} else {
const int nth_max = MIN(256, ggml_metal_pipeline_max_theads_per_threadgroup(pipeline));