Handling materialization of lazy arrays
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
Comienza leyendo las definiciones de la Array API para Array.device y Array.to_device, y después revisa la discusión sobre la materialización y el issue enlazado #689. Compara las necesidades indicadas para sparse, Dask y JAX con los dos enfoques de API propuestos. Se considera terminado al alcanzar y documentar una decisión de la comunidad sobre el diseño de API requerido; no se nombran archivos de implementación ni tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background
Some colleagues and me were doing some work on sparse when we stumbled onto a limitation of the current Array API Standard, and @kgryte was kind enough to point out that it might have some wider implications than just sparse, so it would be prudent to discuss it with other relevant parties within the community before settling on an API design to avoid fragmentation.
Problem Statement
There are two notable things missing from the Array API standard today, which sparse, and potentially Dask, JAX and other relevant libraries might also need.
- Support for storage formats.
- In Dask, this might be the array metadata, such as the type of the inner array.
- In
sparse, this would be the format of the sparse array (CRS,CCS,COO, ...).
- Support for lazy arrays/materialization
sparse/JAX might use this to build up kernels before running a computation- Dask might use this for un-computed arrays stored as a task graph.
Potential solutions
Overload the Array.device attribute and the Array.to_device method.
One option is to overload the objects returned/accepted by these to contain a device + storage object. Something like the following:
class Storage:
@property
def device(self) -> Device:
...
@property
def format(self) -> Format:
...
def __eq__(self, other: "Storage") -> bool:
""" Compatible if combined? """
def __ne__(self, other: "Storage") -> bool:
""" Incompatible if combined? """
class Array:
@property
def device(self) -> Storage:
...
def to_device(self, device: Storage, ...) -> "Array":
...
To materialize an array, one could use to_device(default_device()) (possible after #689 is merged).
Advantages
As far as I can see, it's compatible with how the Array API standard works today.
Disadvantages
We're mixing the concepts of an execution context and storage format, and in particular overloading operators in a rather weird way.
Introduce an Array.format attribute and Array.to_format method.
Advantages
We can get the API right, maybe even introduce xp.can_mix_formats(...).
Disadvantages
Would need to wait till the 2024 revision of the standard at least.
Tagging potentially interested parties:
- @jakirkham @tomwhite for Dask
- @jakevdp for JAX
- Please add anyone I missed
- Lenguaje dominante
- Python
- Estrellas
- 281
- Forks
- 52
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de data-apis/array-api
-
bug Maintenance Narrative Content
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Maintenance
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de data-apis/array-api
Issues similares
-
essnmx good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
-
[Feature] 奇物选择添加优先级 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
syfoud/Simulated_Scepter#174 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Giskard-AI/giskard-oss#2840 · 1 comentario ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Abiertoarea: repo bug perceived difficulty: 2
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
yeti-platform/yeti#1380 ·