Use saturating counters for branch taken counters in `_POP_JUMP_IF_FALSE` and similar instructions.
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pela instrução _POP_JUMP_IF_FALSE e por implementações semelhantes de desvios condicionais; em seguida, rastreie como os dados desses desvios são registrados para os traces de JIT. A alteração estará concluída quando as contagens de direção usarem dois contadores saturantes, forem limitadas a 255 e fornecerem as informações de warmup propostas sem alterar o comportamento da instrução.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- c, python
- Domínio
- compilers, performance
- Tipo de issue
- Funcionalidade
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Pouca atividade
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 48/100