GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-131798: fold super method lookups in JIT by kumaraditya303 · Pull Request #148231 · python/cpython

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Apr 7, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kumaraditya303 added 3 commits April 8, 2026 00:30
@kumaraditya303
JIT cache super methods
2abde7f
@kumaraditya303
some more work
bb55bdc
@kumaraditya303
fix lookup_attr
d472661
@kumaraditya303
kumaraditya303 requested review from Fidget-Spinner, markshannon, savannahostrowski and tomasr8 as code owners April 7, 2026 20:06
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 7, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 7, 2026
Better uop coverage in the JIT optimizer #131798
Open
@kumaraditya303 kumaraditya303 added the skip news label Apr 7, 2026
@Fidget-Spinner Fidget-Spinner changed the title gh-131798: cache super method lookups in JIT gh-131798: fold super method lookups in JIT Apr 7, 2026
@kumaraditya303
clean up
264732d
@Fidget-Spinner

Fidget-Spinner commented Apr 8, 2026

Copy link
Copy Markdown
Member

I see a 10% speedup on richards_super with this PR!

Mean +- std dev: [richards_super_main] 28.8 ms +- 0.5 ms -> [richards_super_fold] 26.1 ms +- 0.5 ms: 1.10x faster

kumaraditya303, AlexWaygood, and savannahostrowski reacted with hooray emoji stonebig and savannahostrowski reacted with heart emoji
All reactions
  • 🎉 3 reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner reviewed Apr 8, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one stylistic nit. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/optimizer_analysis.c
return sym_new_not_null(ctx);
}
/* Normal case: obj_type must be a subtype of su_type */
if (!PyType_IsSubtype(obj_type, su_type)) {

@Fidget-Spinner Fidget-Spinner Apr 8, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: this is not same as subclasscheck/instancecheck, which can call arbitrary code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/optimizer_analysis.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303 added 2 commits April 8, 2026 11:52
@kumaraditya303
address review
38f8396
@kumaraditya303
check _GUARD_NOS_TYPE_VERSION in test
902c089
@kumaraditya303
kumaraditya303 requested a review from Fidget-Spinner April 8, 2026 06:27
@kumaraditya303 kumaraditya303 added the topic-JIT label Apr 8, 2026
@Fidget-Spinner

Fidget-Spinner commented Apr 8, 2026

Copy link
Copy Markdown
Member

Please fix the merge conflicts. LOAD_CONST_UNDER_INLINE_BORROW was removed as it's a duplicate of _INSERT_1_LOAD_CONST_INLIE_BORROW #148235

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303 added 2 commits April 8, 2026 17:02
@kumaraditya303
use _INSERT_1_LOAD_CONST_INLINE
ce45aa4
@kumaraditya303
Merge branch 'main' of https://github.com/python/cpython into jit-super
f722179
@kumaraditya303

kumaraditya303 commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Please fix the merge conflicts.

Fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 8, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/optimizer_analysis.c
_Py_BloomFilter_Add(dependencies, su_type);
PyType_Watch(TYPE_WATCHER_ID, (PyObject *)obj_type);
_Py_BloomFilter_Add(dependencies, obj_type);
return sym_new_const_steal(ctx, lookup);

@Fidget-Spinner Fidget-Spinner Apr 8, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: need steal version because _PySuper_Lookup returns a strong reference, unlike _PyType_Lookup

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 8, 2026
@Fidget-Spinner

Fidget-Spinner commented Apr 8, 2026

Copy link
Copy Markdown
Member

Please pull in main and regen cases. Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markshannon

markshannon commented Apr 8, 2026

Copy link
Copy Markdown
Member

Can we have a test for the case where the superclass changes after optimization, to make sure that we de-opt properly?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303 added 2 commits April 9, 2026 00:30
@kumaraditya303
add test
13aad7b
@kumaraditya303
Merge branch 'main' of https://github.com/python/cpython into jit-super
8753264
@kumaraditya303

kumaraditya303 commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Added test and fixed merge conflicts.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 9, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kumaraditya303
kumaraditya303 merged commit 458aca9 into python:main Apr 9, 2026
74 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 9, 2026
@kumaraditya303
kumaraditya303 deleted the jit-super branch April 9, 2026 07:55
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@kumaraditya303 @ljfp
pythongh-131798: fold super method lookups in JIT (python#148231)
13a0ac6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news topic-JIT

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@kumaraditya303 @Fidget-Spinner @markshannon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.