Skip to content

Add Array API support to sliding_win_oneaxis#211

Draft
cboulay wants to merge 2 commits intodeprecate_generatorfrom
xp_sliding_win
Draft

Add Array API support to sliding_win_oneaxis#211
cboulay wants to merge 2 commits intodeprecate_generatorfrom
xp_sliding_win

Conversation

@cboulay
Copy link
Member

@cboulay cboulay commented Feb 7, 2026

There's a very small performance hit when in numpy (a couple hasattr checks), and actually mlx is significantly slower because it doesn't have strides and therefore makes multiple copies of the data. Despite that, allowing the matrix to stay in mlx through windowing has huge gains for subsequent processing.

I think I can improve upon this further. Previously, I was relying on the fact that manipulating the strides creates a simple view on the data, so I could make a 1-sample-step array then simply index it with ::step_size with no data copies.

However, with non-strided array APIs, the 1-sample-step array is expensive. I think the non-strided code path should skip the 1-sample-step intermediate and copy only the data required in the output.

Converting this to draft while I work on that...

@cboulay cboulay marked this pull request as draft February 9, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant