[wasm] Managed Wide-Vector (256, 512) SIMD Fallbacks are Very Expensive in Size

Abierto
#136,741 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, wasm

Línea de trabajo

Start by examining the Wasm fallback for Vector512.FusedMultiplyAdd<float> and compare its generated code size with the x64 example described in the issue. The issue names no files or tests, so first trace the fallback and its nested vector operations in the runtime codebase. Done means identifying and addressing one of the listed causes of oversized Wasm output, with code size and performance checked.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

arch-wasm area-CodeGen-coreclr tenet-performance

This is a broader issue that came up while investigating Wasm size outliers in System.Private.CoreLib as compared to x64 R2R codegen. Nearly all the statistical size outliers were in vector fallback code. For example, the fallback code for Vector512.FusedMultiplyAdd<float> is massive on Wasm; it's around 1.8 KB in size, as compared to only 47 bytes on x64. The comparison isn't fair necessarily because x64 has vector intrinsics that Wasm simply does not have, but this example exposes several things we might want to look into:

  • We don't seem to decompose larger vector widths into v128 locals; i.e., accessing elements of a Vector512 struct will end up as many separate loads and stores of v128. This could be complicated to improve but it is definitely a factor in the large code size and likely has significant negative perf impacts as well.
  • We null check addresses for loads of individual vector elements in stack allocated vectors which should be in bounds for the current stack frame;
  • We aggressively inline nested managed fallbacks which leads to a very large code size expansion. In this example we have the inline tree of Vector512.FusedMultiplyAdd -> 2*Vector256.FusedMultiplyAdd -> 2*Vector128.FusedMultiplyAdd -> 2*Vector64.FusedMultiplyAdd -> 2*Vector64.GetElementUnsafe
Lenguaje dominante
C#
Estrellas
18.4k
Forks
5.8k
Merge medio
2 d 15 h
PR fusionados (30 d)
596

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/runtime

Todos los issues de dotnet/runtime

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.