python / python/cpython

Make size of TOS cache configurable

Abierto
#145,665 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

3.15 interpreter-core performance topic-JIT
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

TOS caching was introduced by https://github.com/python/cpython/issues/135379, but it only supports a fixed number of registers.
We should make it configurable, so that we can choose the optimum number of registers for any hardware/OS combination.

Probably the simplest way to do this is to generate executor cases and stencils code for up to the overall maximum number of registers, and guard each case/function with an #if MAX_CACHED_REGISTER > N where N is the number of registers needed for that variant.
Some cases/functions will also need to guarded for when MAX_CACHED_REGISTER is too low.

For example the ideal number of output registers for _BINARY_OP variants is 3.
For machines where MAX_CACHED_REGISTER < 3, we will need to generate variants with outputs < 3, but we want to exclude those variants for machines with MAX_CACHED_REGISTER >= 3

Overall this could result in generating a lot more code, probably more than double, but if MAX_CACHED_REGISTER is unchanged then the executable size should also be unchanged.

If we increase the MAX_CACHED_REGISTER to 4 or 5 we would expect the stencils and supporting tables to increase by ~35% and ~80% respectively (growth being a bit more than linear as some instructions have N**2 variants)

Linked PRs
  • gh-145830

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Empieza leyendo el issue 135379 y el trabajo enlazado en el PR 145830; después, sigue las rutas de generación de registros y stencil de la caché de TOS descritas aquí. Se considera terminado cuando MAX_CACHED_REGISTER pueda seleccionar variantes adecuadas para distintas combinaciones de hardware y sistema operativo, preservando al mismo tiempo el comportamiento indicado del tamaño del ejecutable cuando no haya cambios.

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

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.