array-api: Boolean array indexing is not compatible with static memory allocation
JAX is built on top of XLA which (currently) requires static memory allocation for operations. This means it is not possible to express operations like x[y] where y is a boolean, because the resulting array has value dependent size: https://data-apis.github.io/array-api/latest/API_specification/indexing.html#boolean-array-indexing
It’s definitely possible that the static memory allocation requirement could be relaxed in the future, but dynamic memory allocation is always going to be harder to implement in a performant way. For example, I would guess Numba also struggles with this sort of operation. I don’t think we should require it for array libraries implementing our standard, since it isn’t needed for the majority of array operations.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (18 by maintainers)
Commits related to this issue
- Clarify that boolean array indexing requirements We only require that boolean array indexing be supported when the array is the sole index. The previous text was ambiguous, and could be read as suppo... — committed to asmeurer/array-api by asmeurer 3 years ago
- Clarify that boolean array indexing requirements (#164) We only require that boolean array indexing be supported when the array is the sole index. The previous text was ambiguous, and could be read ... — committed to data-apis/array-api by asmeurer 3 years ago
The summary of a discussion we had a few days ago: