File tree Expand file tree Collapse file tree 5 files changed +47
-18
lines changed
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree 5 files changed +47
-18
lines changed Original file line number Diff line number Diff line change @@ -901,9 +901,8 @@ The internal architecture is roughly as follows.
901
901
902
902
* There is a Tier 2 interpreter, but it is mostly intended for debugging
903
903
the earlier stages of the optimization pipeline. If the JIT is not
904
- enabled, the Tier 2 interpreter can be invoked by passing Python the
905
- ``-X uops `` option or by setting the ``PYTHON_UOPS `` environment
906
- variable to ``1 ``.
904
+ enabled, the Tier 2 interpreter can be enabled by configuring Python
905
+ with the ``--enable-experimental-tier2 `` option.
907
906
908
907
* When the ``--enable-experimental-jit `` option is used, the optimized
909
908
Tier 2 IR is translated to machine code, which is then executed.
Original file line number Diff line number Diff line change
1
+ Change how to use the tier 2 interpreter. Instead of running Python with
2
+ ``-X uops `` or setting the environment variable ``PYTHON_UOPS=1 ``, this
3
+ choice is now made at build time by configuring with
4
+ ``--enable-experimental-tier2 ``.
Original file line number Diff line number Diff line change @@ -1262,30 +1262,19 @@ init_interp_main(PyThreadState *tstate)
1262
1262
}
1263
1263
1264
1264
// Turn on experimental tier 2 (uops-based) optimizer
1265
+ // This is also needed when the JIT is enabled
1266
+ #if defined(_Py_JIT ) || defined(_Py_TIER2 )
1265
1267
if (is_main_interp ) {
1266
- #ifndef _Py_JIT
1267
- // No JIT, maybe use the tier two interpreter:
1268
- char * envvar = Py_GETENV ("PYTHON_UOPS" );
1269
- int enabled = envvar != NULL && * envvar > '0' ;
1270
- if (_Py_get_xoption (& config -> xoptions , L"uops" ) != NULL ) {
1271
- enabled = 1 ;
1272
- }
1273
- if (enabled ) {
1274
- #else
1275
- // Always enable tier two for JIT builds (ignoring the environment
1276
- // variable and command-line option above):
1277
- if (true) {
1278
- #endif
1279
1268
PyObject * opt = PyUnstable_Optimizer_NewUOpOptimizer ();
1280
1269
if (opt == NULL ) {
1281
1270
return _PyStatus_ERR ("can't initialize optimizer" );
1282
1271
}
1283
1272
if (PyUnstable_SetOptimizer ((_PyOptimizerObject * )opt )) {
1284
- return _PyStatus_ERR ("can't initialize optimizer" );
1273
+ return _PyStatus_ERR ("can't install optimizer" );
1285
1274
}
1286
1275
Py_DECREF (opt );
1287
- }
1288
1276
}
1277
+ #endif
1289
1278
1290
1279
if (!is_main_interp ) {
1291
1280
// The main interpreter is handled in Py_Main(), for now.
Original file line number Diff line number Diff line change @@ -1784,6 +1784,19 @@ AC_SUBST([REGEN_JIT_COMMAND])
1784
1784
AC_SUBST ( [ JIT_STENCILS_H] )
1785
1785
AC_MSG_RESULT ( [ $enable_experimental_jit] )
1786
1786
1787
+ # Check for --enable-experimental-tier2:
1788
+ AC_MSG_CHECKING ( [ for --enable-experimental-tier2] )
1789
+ AC_ARG_ENABLE ( [ experimental-tier2] ,
1790
+ [ AS_HELP_STRING ( [ --enable-experimental-tier2] ,
1791
+ [ use the experimental tier 2 interpreter (default is no)] ) ] ,
1792
+ [ ] ,
1793
+ [ enable_experimental_tier2=no] )
1794
+ AS_VAR_IF ( [ enable_experimental_tier2] ,
1795
+ [ no] ,
1796
+ [ ] ,
1797
+ [ AS_VAR_APPEND ( [ CFLAGS_NODIST] , [ " -D_Py_TIER2"] ) ] )
1798
+ AC_MSG_RESULT ( [ $enable_experimental_tier2] )
1799
+
1787
1800
# Enable optimization flags
1788
1801
AC_SUBST ( [ DEF_MAKE_ALL_RULE] )
1789
1802
AC_SUBST ( [ DEF_MAKE_RULE] )
You can’t perform that action at this time.
0 commit comments