Masked gather
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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