python / python/cpython

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

Aperta
#145,866 21 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

3.15 interpreter-core performance topic-JIT type-feature
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo la issue di follow-up 134584 per il pattern di conversione descritto e rivedi le uops rimanenti elencate: LIST_EXTEND, DICT_UPDATE, SET_UPDATE, DICT_MERGE, CALL_INTRINSIC_1 e CALL_INTRINSIC_2. Esamina anche come sono rappresentate POP_ITER, END_FOR e END_SEND; il lavoro si considera completato quando queste operazioni usano l'approccio proposto per la pulizia dello stack, ma le PR collegate mostrano che il lavoro è già in corso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
compilers, performance
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.