python / python/cpython

Don't inline slow path functions in the interpreter loop

Ouverte
#132,336 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

interpreter-core performance type-feature
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

Feature or enhancement

Proposal:

I was looking at the IPA inlining dump as part of investigating the root cause of gh-132295 and noticed that we're inlining a number of slow path functions related to specialization, instrumentation, and error handling in the interpreter loop when performing LTO (full list here):

_Py_Specialize_CallKw
_Py_Specialize_CompareOp
_Py_Specialize_ContainsOp
_Py_Specialize_ForIter
_Py_Specialize_LoadGlobal
_Py_Specialize_LoadSuperAttr
_Py_Specialize_Send
_Py_Specialize_StoreAttr
_Py_Specialize_StoreSubscr
_Py_Specialize_ToBool
_Py_Specialize_UnpackSequence
_Py_call_instrumentation
_Py_call_instrumentation_instruction
_Py_call_instrumentation_line
get_exception_handler

I suspect these are being inlined because we use unit tests for collecting PGO data. These should be executed relatively infrequently for "normal" Python code. We should mark them as noinline.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-132337
  • gh-132424

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Examinez le dump d’inlining IPA et les points d’entrée du slow path indiqués, notamment les fonctions Py_Specialize*, les helpers d’instrumentation et get_exception_handler. Consultez d’abord les discussions ou les modifications de gh-132337 et gh-132424 ; c’est terminé lorsque ces fonctions ne sont plus inlinées pendant LTO, tandis que le comportement normal de l’interpréteur reste inchangé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
compilers, performance
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.