ml-explore / ml-explore/mlx

Masked gather

Open
#2,744 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
28.5k
Forks
2.3k
Avg merge
3d 8h
Merged PRs (30d)
62

Description

It would be great to support boolean-mask indexing, e.g.:

out = values[mask]

to gather all elements where mask == True.

Right now, this requires manual index construction and workarounds (e.g., prefix + scatter_add), which is both verbose and slower than a dedicated masked gather. A built-in op for boolean mask selection would simplify code and improve performance for common use cases where we extract values based on a mask.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name implementation files, tests, or entry points. Start by locating MLX's existing indexing and gather operations and their tests, then determine how boolean-mask selection should behave and how completion can be validated against the requested values[mask] example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.