Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-119786: Add jit.md. Move adaptive.md to a section of interpreter.md. #127175

Merged
merged 13 commits into from
Dec 6, 2024

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Nov 22, 2024

@iritkatriel iritkatriel changed the title gh-119786: add intro to adaptive.md. Update index headings gh-119786: add intro to adaptive.md. Add tier2.md. Nov 22, 2024
InternalDocs/tier2.md Outdated Show resolved Hide resolved
InternalDocs/tier2.md Outdated Show resolved Hide resolved
InternalDocs/tier2.md Outdated Show resolved Hide resolved
InternalDocs/tier2.md Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

A lot of the terminology here is confusing, as we haven't put a lot of effort into choosing good names.
I'd suggest using "interpreter" for tier 1 including the specializations and "jit" for tier 2.

This leads to some odd terminology like "jit interpreter" for the tier 2 interpreter, but I think it is clearer overall.

I think a lot of core devs and the wider community think that what we currently call the "jit", i.e. the machine code generation pass, is where the performance gains will come from, but they will come from all of tier 2. The earlier passes will be vital for good performance.

Also, maybe add a diagram like this: faster-cpython/ideas#557 (comment)

InternalDocs/README.md Outdated Show resolved Hide resolved
InternalDocs/adaptive.md Outdated Show resolved Hide resolved
InternalDocs/adaptive.md Outdated Show resolved Hide resolved
InternalDocs/adaptive.md Outdated Show resolved Hide resolved
InternalDocs/interpreter.md Outdated Show resolved Hide resolved
@@ -0,0 +1,124 @@
# The Tier 2 Interpreter
Copy link
Member

Choose a reason for hiding this comment

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

This is potentially confusing. The tier 2 interpreter is, in my mind, only used to debug tier 2 code. It is the jit-compiled machine code that executes tier 2 normally.

Also, I think we want to move away from "tier 2" and use "JIT". See faster-cpython/ideas#614 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm making this change, but the code does refer to tier 2 in various places so I think it needs to be mentioned, otherwise future devs will be confused.

InternalDocs/tier2.md Outdated Show resolved Hide resolved
InternalDocs/tier2.md Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Dec 3, 2024

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@iritkatriel iritkatriel changed the title gh-119786: add intro to adaptive.md. Add tier2.md. gh-119786: Add jit.md. Move adaptive.md to a section of interpreter.md. Dec 5, 2024
@iritkatriel
Copy link
Member Author

I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented Dec 5, 2024

Thanks for making the requested changes!

@markshannon, @mdboom: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from markshannon December 5, 2024 20:45
@bedevere-app bedevere-app bot requested a review from mdboom December 5, 2024 20:45
InternalDocs/code_objects.md Outdated Show resolved Hide resolved
InternalDocs/interpreter.md Outdated Show resolved Hide resolved

### Maintaining stats

Finally, take care that stats are gathered correctly.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we currently have docs about pystats, we may want to link to that here. (If we don't, don't worry about that now...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know of any.

InternalDocs/jit.md Outdated Show resolved Hide resolved
InternalDocs/jit.md Outdated Show resolved Hide resolved
InternalDocs/jit.md Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

This is excellent, thanks.

I have a few (minor) suggestions, otherwise it looks very good.

InternalDocs/jit.md Outdated Show resolved Hide resolved
InternalDocs/jit.md Outdated Show resolved Hide resolved
and a `_PyUOpExecutor_Type` is created to contain it.

## Debugging a uop executor in the JIT interpreter

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a sentence or two saying why we have this strange looking interpreter?
Being able to debug and analyze the optimizations prior independent of machine code generation is vey valuable.

InternalDocs/jit.md Outdated Show resolved Hide resolved
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

One typo to fix, otherwise looks good.

InternalDocs/jit.md Outdated Show resolved Hide resolved
@iritkatriel iritkatriel merged commit 89fa7ec into python:main Dec 6, 2024
23 checks passed
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants