python / python/cpython

Convert more uops to leave their inputs on the stack to be cleaned up by `_POP_TOP`

Aberta
#145,866 21 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

3.15 interpreter-core performance topic-JIT type-feature
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Feature or enhancement

Proposal:

This is a follow up to https://github.com/python/cpython/issues/134584

We have, in the JIT, optimizations to eliminate many _POP_TOP operations. To take advantage of that we have converted many uops to leave their operands on the stack and added subsequent _POP_TOPs to remove them.
See https://github.com/python/cpython/issues/134584 for many examples of how to do this and why it works.

However, there are still a few uops yet to do. These are:

  • LIST_EXTEND
  • DICT_UPDATE @Sacul0457
  • SET_UPDATE @Sacul0457
  • DICT_MERGE @NekoAsakura
  • CALL_INTRINSIC_1 @Sacul0457
  • CALL_INTRINSIC_2 @KevinH15291

In addition, POP_ITER, END_FOR and END_SEND can be implemented as macro ops, using POP_TOP to gain the benefit of the the POP_TOP optimization.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Linked PRs
  • gh-145964
  • gh-145979
  • gh-146170
  • gh-146177
  • gh-146185
  • gh-146190
  • gh-146262
  • gh-146329
  • gh-146383
  • gh-148227
  • gh-148477

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece lendo a issue de acompanhamento 134584 para conhecer o padrão de conversão descrito e analise as uops restantes listadas: LIST_EXTEND, DICT_UPDATE, SET_UPDATE, DICT_MERGE, CALL_INTRINSIC_1 e CALL_INTRINSIC_2. Examine também como POP_ITER, END_FOR e END_SEND são representadas; considera-se concluído quando essas operações usam a abordagem proposta de limpeza da stack, mas os PRs vinculados mostram que esse trabalho já está em andamento.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
compilers, performance
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.