Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-104584: Baby steps towards generating and executing traces#105924
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
68 commits Select commit Hold shift + click to select a range
3008fc7 Boilerplate for new uop optimizer+executor
gvanrossum 512b764 Make uop optimizer execute a LOAD_FAST
gvanrossum 52742c8 Generalize uop optimizer infrastructure
gvanrossum 4de0468 Give uop_execute an instruction decoding loop
gvanrossum 5ded690 Make the translator use a switch
gvanrossum e41acc0 Support LOAD_FAST_LOAD_FAST
gvanrossum 76ccf2d Support LOAD_CONST
gvanrossum 3001dde Fix edge case for LOAD_FAST_LOAD_FAST
gvanrossum a7d2cba Generate SET_IP after each instr
gvanrossum e00703c Turn stats into properties (tp_members)
gvanrossum 3d41ffe Comment out fprintfs
gvanrossum 7db1d12 Enable UOp optimizer by default in main interpreter
gvanrossum 17bcc61 The world isn't ready for 'const int X = 1;'
gvanrossum e07bc4c Avoid MSC warning about implicit cast
gvanrossum 02b0624 Add missing cast in pylifecycle.c
gvanrossum b5feec7 Use write_provenance_header() more
gvanrossum 775df6e Generate (some) cases for the executor
gvanrossum e2855ca Recompile flowgraph.c when opcodse_metadata.h changes
gvanrossum 0ad18cf Add uop status to opcode metadata
gvanrossum f5c8316 Use macros from ceval_macros.h
gvanrossum 13c6bd2 Interim -- opcode without oparg using cache entry
gvanrossum 1b1584c ERROR_IF is no longer a dirty word (but errors crash)
gvanrossum c2c1868 Regenerate generated_cases.c.h
gvanrossum 340570f Hacky way to avoid flagging macros as uops
gvanrossum 96fa5ef Support DEOPT_IF
gvanrossum f2d71f5 Support ERROR_IF (had to forbid unbound_local_error)
gvanrossum be5dcb2 Attempt to fix check-c-globals
gvanrossum 6ba3557 Add exceptions for static UOp*_Type to c-analyzer
gvanrossum 792f45f Add c-analyzer exceptions for real
gvanrossum 71ff09c More sophisticated uop tracing
gvanrossum 6d532c7 gh-105481: refactor instr flag related code into a new InstructionFla…
iritkatriel bf7abc2 Restore IS_UOP flag generation
gvanrossum 121fbad Trace uop optimizations if PYTHON_UOP_DEBUG is set
gvanrossum 4dc0019 Merge remote-tracking branch 'origin/main' into optim-exec
gvanrossum a5880da Move check for oparg-or-one-short-cache into is_viable_uop()
gvanrossum 59c84a3 Support SET_FUNCTION_CLOSURE
gvanrossum 8fd4a71 Move uop optimizer to ceval.c so it can use static functions defined …
gvanrossum f0ec658 Support tstate
gvanrossum 65a3c80 Rename 'adjust_cache[s]' to 'tier'
gvanrossum decfe4a Reformat Analyzer.__init__ header
gvanrossum f9db482 Merge remote-tracking branch 'origin/main' into optim-exec
gvanrossum 94441b6 Auto-generate uop values
gvanrossum 8a6bc14 Switch to using macro expansion
gvanrossum 88fbe66 Remove IS_UOP flag
gvanrossum 7f9349e Allow pointer-sized ints for Tier-2 oparg
gvanrossum 97aab6e Rename FORBIDDEN_INSTRUCTIONS
gvanrossum 67f7798 Remove separate UOpOptimizerObject type
gvanrossum 2848c3d Try to use pystats
gvanrossum 5b018c2 Rationalize errors
gvanrossum a228b5d Fix typo in pystats output
gvanrossum 2695bb7 Move uop_optimizer back to optimizer.c
gvanrossum 91dd86c Fix 4/6 failing tests
gvanrossum 7d1750e Receiving end of macro expansion
gvanrossum c1bcd0f Avoid warnings; subtler debug output levels
gvanrossum 9df20bb Add eval breaker check to _PyUopExecute; fixes test_threading
gvanrossum b0f6d18 Merge remote-tracking branch 'origin/main' into optim-exec
gvanrossum acfd143 Add opcode name to ADD_TO_TRACE debug output
gvanrossum e3471da Fix test_memoryview by excluding BEFORE_WITH
gvanrossum 44a1ffc Fix Windows test_mmap -- by removing BUILD_SLICE/STORE_SLICE
gvanrossum 2254f83 Fix bug in ENTER_EXECUTOR - on error go to resume_with_error
gvanrossum 2f6603e Silence warnings on Windows
gvanrossum 00f8f2c Replace oparg with operand in more debug output
gvanrossum 4bd7bb6 Fix test_memoryview again by excluding BEFORE_WITH
gvanrossum 9646b4e Add -Xuops flag and debug tweaks
gvanrossum 9c04e40 Revert "Fix 4/6 failing tests"
gvanrossum 39bc8fe Use PRIu64 instead of %lld/%llu formats
gvanrossum 6606c5d Remove superfluous INCREF -- hope it fixes the refleaks
gvanrossum c14e104 📜🤖 Added by blurb_it.
blurb-it[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #ifndef Py_INTERNAL_UOPS_H | ||
| #define Py_INTERNAL_UOPS_H | ||
| #ifdef __cplusplus | ||
| extern "C"{ | ||
| #endif | ||
| #ifndef Py_BUILD_CORE | ||
| # error "this header requires Py_BUILD_CORE define" | ||
| #endif | ||
| #define _Py_UOP_MAX_TRACE_LENGTH 16 | ||
| typedef struct{ | ||
| int opcode; | ||
| uint64_t operand; // Sometimes oparg, sometimes a cache entry | ||
| } _PyUOpInstruction; | ||
| typedef struct{ | ||
| _PyExecutorObject base; | ||
| _PyUOpInstruction trace[_Py_UOP_MAX_TRACE_LENGTH]; // TODO: variable length | ||
| } _PyUOpExecutorObject; | ||
| _PyInterpreterFrame *_PyUopExecute( | ||
| _PyExecutorObject *executor, | ||
| _PyInterpreterFrame *frame, | ||
| PyObject **stack_pointer); | ||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
| #endif /* !Py_INTERNAL_UOPS_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Core and Builtins/2023-06-27-00-58-26.gh-issue-104584.Wu-uXy.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
In its own file, please.
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.
The problem is that there are many instructions that use static functions defined in ceval.c. The rest can go in another file, sure.
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.
They can be renamed, as needed.
I'm fairly sure the limited set of instructions we are starting with don't use any static functions.
Uh oh!
There was an error while loading. Please reload this page.
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.
Alas, they do: