Use saturating counters for branch taken counters in `_POP_JUMP_IF_FALSE` and similar instructions.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Each conditional branch instruction contains a 16 bit field for recording the direction of the last 16 jumps.
uint16_t *branches;
uint16_t val = *branches;
val = (val << 1) | direction;
*branches =val;
This tells the direction of the last 16 branches.
When recording traces for the JIT, 16 branches is not a lot of information to guide region selection.
Instead, we could record the count of the two directions instead using a pair of saturating 8 bit counters.
uint8_t branches[2];
branches[direction] += (branches[direction] != 255);
Which is only one extra ALU instruction for most C compilers, and no extra memory accesses.
With a JIT warmup of up 500, we can get precise numbers of the branches taken.
With a warmup of a 1000, the saturating counters can still distinguish between branches that are rarely taken and those which are more balanced.
For example, if a branch switches direction every 20 times, the current counter might show a perfectly biased branch, but the saturating counter approach will show that the branch is roughly balanced.
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.
Línea de trabajo
Comienza por la instrucción _POP_JUMP_IF_FALSE y por implementaciones similares de saltos condicionales; después, sigue el rastro de cómo se registran sus datos de salto para las trazas JIT. El cambio estará terminado cuando los conteos de dirección usen dos contadores saturantes, tengan un límite de 255 y proporcionen la información de warmup propuesta sin cambiar el comportamiento de la instrucción.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, python
- Área
- compilers, performance
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100