Skip to content

Commit

Permalink
Fix row reduce with very few rows (ml-explore#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloskath authored Sep 30, 2024
1 parent 4a64d4b commit bacced5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mlx/backend/metal/reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ void row_reduce_general_dispatch(
}

// Case 2: Contiguous reduce without non-row reductions
if (plan.type == ContiguousReduce && args.reduce_ndim == 0) {
if (plan.type == ContiguousReduce && args.reduce_ndim == 0 &&
in.size() / args.row_size >= 32) {
return row_reduce_simple(in, out, op_name, args, compute_encoder, d, s);
}

Expand Down

0 comments on commit bacced5

Please sign in to comment.