Skip to content

Fix MLX advanced indexing and support boolean masks - #2402

Open
jessegrabowski wants to merge 5 commits into
pymc-devs:mainfrom
jessegrabowski:mlx-advanced-indexing-patch
Open

Fix MLX advanced indexing and support boolean masks#2402
jessegrabowski wants to merge 5 commits into
pymc-devs:mainfrom
jessegrabowski:mlx-advanced-indexing-patch

Conversation

@jessegrabowski

Copy link
Copy Markdown
Member

AdvancedIncSubtensor dropped the slices in op.idx_list, so x[:, idx] = y wrote down the leading axis. Separate bug in the same dispatches: slice bounds arrived as MLX arrays, so x[idx, 1:4] raised.

Boolean masks work now: existing rewrites tagged for mlx, plus a Nonzero dispatch.

Two of those rewrites moved from position 100 to 1.95 to run ahead of specialize, which changes JAX's ordering too.

Runtime masks can't be traced, so MLXLinker runs any graph containing Nonzero uncompiled and warns.

Closes #2387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLX: gradient of batched advanced indexing fails in broadcast_shapes

1 participant