Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
GH-135904: Add tests for the JIT build process#136766
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bedevere-bot commentedJul 18, 2025
🤖 New build scheduled with the buildbot fleet by@brandtbucher for commit867a686 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F136766%2Fmerge If you want to schedule another build, you need to add the🔨 test-with-buildbots label again. |
brandtbucher commentedJul 21, 2025
!buildbot aarch64 RHEL8 LTO |
bedevere-bot commentedJul 21, 2025
🤖 New build scheduled with the buildbot fleet by@brandtbucher for commit7c9c3ff 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F136766%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Uh oh!
There was an error while loading.Please reload this page.
| classTestJITStencils(unittest.TestCase): | ||
| def_build_jit_stencils(self,target:str)->str: | ||
| withtempfile.TemporaryDirectory()aswork: |
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.
I thinkos_helper.temp_dir is a bit more common in tests but either is fine :)
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.
Hm, I'll take a look!
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.
Is it, like, better? Haha.
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.
Couldn't tell you 😅 but it seems quite common. Though both are used so it probably doesn't matter :)
| parser.add_argument( | ||
| "-i", | ||
| "--input-file", | ||
| help="where to find the generated executor cases", |
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.
Do you think it's worth calling out that this is used to pass in the dummy file in our tests and/or that this could be useful for custom builds/debugging? Maybe not in help text but in a comment?
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.
I think I left a similar comment at the top of the PR. Is this the case of regenerating the file while in development so then be able to pass it?
diegorusso left a comment
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.
This is not fully related to this PR but sometime I change this linehttps://github.com/python/cpython/pull/136766/files#diff-700c6057d24addce74e8787edb5f5556f718299f6ef1742cbb1d79580cdb535cR199 and adddelete=False because I want to inspect the temporary files that have been generated.
Do you think that we should expose this to the user (it would be useful for me)?
| pyconfig_h=pathlib.Path(sysconfig.get_config_h_filename()).resolve() | ||
| result,args=test.support.script_helper.run_python_until_end( | ||
| _TOOLS_JIT_BUILD_PY, | ||
| "--input-file",_TOOLS_JIT_TEST_TEST_EXECUTOR_CASES_C_H, |
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.
This is just for my understanding. is this needed in case we need to regenerate this during development and we need to test it, right?
| HoleValue.JUMP_TARGET:"state->instruction_starts[instruction->jump_target]", | ||
| HoleValue.ERROR_TARGET:"state->instruction_starts[instruction->error_target]", | ||
| # These should all have raised an error if they were actually used: | ||
| #HoleValue.WRITABLE: "", |
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.
I'm not sure I fully understand this. Can you expland please?
| parser.add_argument( | ||
| "-i", | ||
| "--input-file", | ||
| help="where to find the generated executor cases", |
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.
I think I left a similar comment at the top of the PR. Is this the case of regenerating the file while in development so then be able to pass it?
diegorusso commentedJul 22, 2025
It's not a hard push back, but shouldn't be these changes go to a separate PR? |
Uh oh!
There was an error while loading.Please reload this page.
This is overdue, but it's especially valuable now that we're doing more subtle transformations on the machine code at JIT build time. This has a number of benefits:
musttaildoesn't optimize sibling calls llvm/llvm-project#147813The new test is in
Lib/test/test_jit_stencils.py. This test usesTools/jit/test/test_executor_cases.c.hto generate a few small test stencils, and compares them to the expected output in the correspondingTools/jit/test/test_jit_stencils-*.hfile.Most of the changes in
Tools/jit/_targets.pyare just cleanup to make the generated stencils simpler and more consistent, or to fix the writable-data bug I mentioned above.