Mark Shannon
1ab6356ebe
GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support of calls. (GH-118322)
...
* Add CALL_PY_GENERAL, CALL_BOUND_METHOD_GENERAL and call CALL_NON_PY_GENERAL specializations.
* Remove CALL_PY_WITH_DEFAULTS specialization
* Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize
2024-05-04 12:11:11 +01:00
Mark Shannon
67bba9dd0f
GH-117442: Check eval-breaker at start (rather than end) of tier 2 loops (GH-118482)
2024-05-02 13:10:31 +01:00
Guido van Rossum
7d83f7bcc4
gh-118335: Configure Tier 2 interpreter at build time ( #118339 )
...
The code for Tier 2 is now only compiled when configured
with `--enable-experimental-jit[=yes|interpreter]`.
We drop support for `PYTHON_UOPS` and -`Xuops`,
but you can disable the interpreter or JIT
at runtime by setting `PYTHON_JIT=0`.
You can also build it without enabling it by default
using `--enable-experimental-jit=yes-off`;
enable with `PYTHON_JIT=1`.
On Windows, the `build.bat` script supports
`--experimental-jit`, `--experimental-jit-off`,
`--experimental-interpreter`.
In the C code, `_Py_JIT` is defined as before
when the JIT is enabled; the new variable
`_Py_TIER2` is defined when the JIT *or* the
interpreter is enabled. It is actually a bitmask:
1: JIT; 2: default-off; 4: interpreter.
2024-04-30 18:26:34 -07:00
Mark Shannon
5b05d452cd
GH-118095: Add tier 2 support for YIELD_VALUE (GH-118380)
2024-04-30 11:33:13 +01:00
Mark Shannon
3e06c7f719
GH-118095: Add dynamic exit support and FOR_ITER_GEN support to tier 2 (GH-118279)
2024-04-26 18:08:50 +01:00
Mark Shannon
f180b31e76
GH-118095: Handle RETURN_GENERATOR in tier 2 (GH-118180)
2024-04-25 11:32:47 +01:00
Mark Shannon
77cd0428b6
GH-118095: Convert DEOPT_IFs on likely side exits to EXIT_IFs (GH-118106)
...
Covert DEOPT_IFs on likely side exits to EXIT_IFs
2024-04-24 14:37:55 +01:00
Mark Shannon
d3bd6b5f3f
GH-115419: Improve list of escaping functions (GH-118054)
2024-04-19 09:25:07 +01:00
Mark Shannon
c32dc47aca
GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115)
2024-04-02 11:59:21 +01:00
Mark Shannon
bf82f77957
GH-116422: Tier2 hot/cold splitting (GH-116813)
...
Splits the "cold" path, deopts and exits, from the "hot" path, reducing the size of most jitted instructions, at the cost of slower exits.
2024-03-26 09:35:11 +00:00
Mark Shannon
61e54bfcee
GH-116422: Factor out eval breaker checks at end of calls into its own micro-op. (GH-116817)
2024-03-14 16:31:47 +00:00
Mark Shannon
b6ae6da1bd
GH-116596: Better determination of escaping uops. (GH-116597)
2024-03-11 13:37:48 +00:00
Mark Shannon
4e5df2013f
GH-116468: Use constants instead of oparg in stack effects when oparg is known to be a constant. (GH-116469)
2024-03-11 09:30:15 +00:00
Ken Jin
41457c7fdb
gh-116381: Remove bad specializations, add fail stats (GH-116464)
...
* Remove bad specializations, add fail stats
2024-03-08 00:21:21 +08:00
Ken Jin
7114cf20c0
gh-116381: Specialize CONTAINS_OP (GH-116385)
...
* Specialize CONTAINS_OP
* 📜 🤖 Added by blurb_it.
* Add PyAPI_FUNC for JIT
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-03-07 03:30:11 +08:00
Mark Shannon
23db9c6227
GH-115685: Split _TO_BOOL_ALWAYS_TRUE into micro-ops (GH-116352)
2024-03-05 15:23:08 +00:00
Ken Jin
dcba21f905
gh-115687: Split up guards from COMPARE_OP (GH-115688)
2024-02-20 11:30:49 +00:00
Mark Shannon
626c414995
GH-115457: Support splitting and replication of micro ops. (GH-115558)
2024-02-20 10:50:59 +00:00
Mark Shannon
7b21403ccd
GH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142)
2024-02-20 09:39:55 +00:00
Ken Jin
7cce857622
gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)
...
---------
Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
2024-02-13 21:24:48 +08:00
Mark Shannon
981d172f7f
GH-112354: END_FOR instruction to only pop one value. (GH-114247)
...
* Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
2024-01-24 15:10:17 +00:00
Ken Jin
ac92527c08
gh-113710: Add types to the interpreter DSL ( #113711 )
...
Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-01-13 01:30:27 +08:00
Mark Shannon
a0c9cf9456
GH-113860: All executors are now defined in terms of micro ops. Convert counter executor to use uops. (GH-113864)
2024-01-10 15:44:34 +00:00
Mark Shannon
723f4d6698
GH-111485: Delete the old generator code. (GH-113321)
2023-12-21 12:46:28 +00:00
Mark Shannon
e96f26083b
GH-111485: Generate instruction and uop metadata (GH-113287)
2023-12-20 14:27:25 +00:00
Mark Shannon
e24eccbc1c
GH-111485: Sort metadata tables for easier checking of future diffs (GH-113101)
2023-12-14 16:41:52 +00:00
Mark Shannon
6873555955
GH-112354: Treat _EXIT_TRACE like an unconditional side exit (GH-113104)
2023-12-14 14:26:44 +00:00
Mark Shannon
956023826a
GH-108866: Guarantee forward progress in executors. (GH-113006)
2023-12-12 19:02:24 +00:00
Mark Shannon
c27e9d5d17
GH-111485: Factor out generation of uop IDs from cases generator. (GH-112877)
2023-12-11 14:14:36 +00:00
Mark Shannon
b449415b2f
GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code generator (GH-112299)
2023-12-07 12:49:40 +00:00
Irit Katriel
07ebd46f9e
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c ( #112520 )
2023-11-30 11:03:30 +00:00
Guido van Rossum
1995955173
gh-106529: Make FOR_ITER a viable uop ( #112134 )
...
This uses the new mechanism whereby certain uops
are replaced by others during translation,
using the `_PyUop_Replacements` table.
We further special-case the `_FOR_ITER_TIER_TWO` uop
to update the deoptimization target to point
just past the corresponding `END_FOR` opcode.
Two tiny code cleanups are also part of this PR.
2023-11-20 10:08:53 -08:00
Mark Shannon
4bbb367ba6
GH-111848: Set the IP when de-optimizing (GH-112065)
...
* Replace jumps with deopts in tier 2
* Fewer special cases of uop names
* Add target field to uop IR
* Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops
* Extend whitelist of non-escaping API functions.
2023-11-15 15:48:58 +00:00
Mark Shannon
a519b87958
GH-111848: Convert remaining jumps to deopts into tier 2 code. (GH-112045)
2023-11-14 15:30:33 +00:00
Mark Shannon
25c4956488
GH-109369: Exit tier 2 if executor is invalid (GH-111657)
2023-11-09 11:19:51 +00:00
Mark Shannon
06efb60264
GH-111848: Tidy up tier 2 handling of FOR_ITER specialization by using DEOPT_IF instead of jumps. (GH-111849)
2023-11-08 13:31:55 +00:00
Mark Shannon
931f4438c9
GH-111485: Allow arbitrary annotations on instructions and micro-ops. (GH-111697)
2023-11-07 09:42:39 +00:00
Brandt Bucher
3e99c9cbf6
GH-111485: Make BEFORE_WITH a uop (GH-111812)
2023-11-06 16:42:49 -08:00
Irit Katriel
d49aba5a7a
gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and frame state ( #111648 )
2023-11-03 10:01:36 +00:00
Irit Katriel
52cc4af6ae
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ( #111459 )
2023-11-02 10:18:43 +00:00
Mark Shannon
b14e882428
GH-111485: Use micro-ops to split specialization code from base action (GH-111561)
2023-11-01 10:53:27 +00:00
Mark Shannon
2904d99839
GH-111485: Remove some special cases from the code generator and bytecodes.c (GH-111540)
2023-10-31 13:21:07 +00:00
Mark Shannon
d27acd4461
GH-111485: Increment next_instr consistently at the start of the instruction. (GH-111486)
2023-10-31 10:09:54 +00:00
Irit Katriel
67a91f78e4
gh-109094: replace frame->prev_instr by frame->instr_ptr ( #109095 )
2023-10-26 13:43:10 +00:00
Brandt Bucher
e5168ff3f8
GH-109214: _SET_IP before _PUSH_FRAME (but not _POP_FRAME) (GH-111001)
2023-10-24 13:27:42 -07:00
Mark Shannon
19b7ead5eb
GH-109214: Convert _SAVE_CURRENT_IP to _SET_IP in tier 2 trace creation. (GH-110755)
2023-10-12 10:34:32 +01:00
Guido van Rossum
7c149a76b2
gh-104909: Split more LOAD_ATTR specializations (GH-110317)
...
* Split LOAD_ATTR_MODULE
* Split LOAD_ATTR_WITH_HINT
* Split _GUARD_TYPE_VERSION out of the latter
* Split LOAD_ATTR_CLASS
* Split LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES
* Fix indent of DEOPT_IF in macros
* Split LOAD_ATTR_METHOD_LAZY_DICT
* Split LOAD_ATTR_NONDESCRIPTOR_NO_DICT
* Fix omission of _CHECK_ATTR_METHOD_LAZY_DICT
2023-10-04 16:08:02 +01:00
Guido van Rossum
625ecbe92e
gh-109979: Unify _GUARD_TYPE_VERSION{,_STORE} ( #110301 )
...
Now the target for `DEOPT_IF()` is auto-filled,
we don't need a separate `_GUARD_TYPE_VERSION_STORE` uop.
2023-10-03 22:37:21 +00:00
Guido van Rossum
5bb6f0fcba
gh-104909: Split some more insts into ops ( #109943 )
...
These are the most popular specializations of `LOAD_ATTR` and `STORE_ATTR`
that weren't already viable uops:
* Split LOAD_ATTR_METHOD_WITH_VALUES
* Split LOAD_ATTR_METHOD_NO_DICT
* Split LOAD_ATTR_SLOT
* Split STORE_ATTR_SLOT
* Split STORE_ATTR_INSTANCE_VALUE
Also:
* Add `-v` flag to code generator which prints a list of non-viable uops
(easter-egg: it can print execution counts -- see source)
* Double _Py_UOP_MAX_TRACE_LENGTH to 128
I had dropped one of the DEOPT_IF() calls! :-(
2023-09-27 15:27:44 -07:00
Guido van Rossum
a7a079798d
gh-109287: Desugar inst(X) to op(X); macro(X) = X ( #109294 )
...
This makes the internal representation in the code generator simpler: there's a list of ops, and a list of macros, and there's no special-casing needed for ops that aren't macros. (There's now special-casing for ops that are also macros, but that's simpler.)
2023-09-15 08:39:05 -07:00