RFE: Add batching support (N-D tensors) to the gemm operator
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- machine-learning
- Área
- machine-learning
Línea de trabajo
The payload names only the MLGraphBuilder.gemm() and MLGraphBuilder.matmul() operations, so start from their definitions in the WebNN spec and compare how matmul handles leading batch dimensions. Work out the shape rules for c and the broadcasting of the result before editing anything. Done means the gemm spec accepts rank-2 and higher inputs with batch dimensions handled as matmul does, and that the change is agreed in the issue thread first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem Statement
Currently, the MLGraphBuilder.gemm() operation is restricted to 2D inputs for the a and b operands. However, MLGraphBuilder.matmul() fully supports batching via N-dimensional tensors.
If a developer wants to perform a batched General Matrix Multiplication — calculating $\alpha A B + \beta C$ across a batch — they cannot use the gemm operator natively.
Current Workaround & Limitations
To achieve a batched GEMM, developers currently have to manually emulate the operation by composing a subgraph of multiple operators:
matmul(to handle the batched multiplication of A and B)mul(to scale the result by $\alpha$)mul(to scale C by $\beta$)add(to combine the results)
This emulation is undesirable for a few reasons:
- Graph Bloat: It increases the number of nodes in the graph, adding overhead to graph construction and compilation.
- Performance Penalties: While some backend compilers might successfully fuse these separate
matmul,mul, andaddnodes back into a single batched GEMM operation, this fusion is not guaranteed. If the fusion step fails or isn't supported by a specific hardware backend, the execution will incur multiple memory read/write passes instead of utilizing a single, highly optimized hardware kernel (e.g., batched GEMM on GPUs or NPUs).
Proposed Solution
Update the gemm operator specification to accept N-dimensional tensors (where rank >= 2). For inputs of rank > 2, the leading dimensions should be treated as batch dimensions exactly like the matmul operation currently does.
- Lenguaje dominante
- Bikeshed
- Estrellas
- 566
- Forks
- 72
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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 webmachinelearning/webnn
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
webmachinelearning/webnn#972 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
webmachinelearning/webnn#971 · 1 reacción ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
webmachinelearning/webnn#970 · 2 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
webmachinelearning/webnn#968 · 2 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
webmachinelearning/webnn#967 ·
Todos los issues de webmachinelearning/webnn
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
tensorflow/tfjs#8754 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[BUG]: loo_eval crashes when the requested control count is zero or exceeds the eligible poolAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AOSSIE-Org/OpenVerifiableLLM#303 ·
Los mantenedores suelen responder en 1 día
-
needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
regression skipped skipped_bmg
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
intel/torch-xpu-ops#6089 ·
Los mantenedores suelen responder en 2 días