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

Configure Tier 2 interpreter at build time #118335

Closed
gvanrossum opened this issue Apr 26, 2024 · 5 comments
Closed

Configure Tier 2 interpreter at build time #118335

gvanrossum opened this issue Apr 26, 2024 · 5 comments

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Apr 26, 2024

It would be nice if by default we didn't ship the optimizer infrastructure, since approximately nobody is going to use it, so we should ship (and by default build) binaries that just don't include it.

I propose to enable it only when configured with --enable-experimental-jit-interpreter. We drop support for PYTHON_UOPS and -Xuops, in favor of PYTHON_JIT=0|1.

@mdboom this will have some consequences for the benchmarking infra; checking the Tier 2 box should use this configure option rather than setting the PYTHON_UOPS=1 env var. It should be possible to use both (./configure gives a warning but otherwise seems to ignore incorrect flags, and the env var will just be ignored).

Linked PRs

@mdboom
Copy link
Contributor

mdboom commented Apr 29, 2024

@mdboom this will have some consequences for the benchmarking infra; checking the Tier 2 box should use this configure option rather than setting the PYTHON_UOPS=1 env var. It should be possible to use both (./configure gives a warning but otherwise seems to ignore incorrect flags, and the env var will just be ignored).

That should be easy enough to deal with, but I'll hold off on shipping that change until #118339 is merged.

@gvanrossum
Copy link
Member Author

That should be easy enough to deal with, but I'll hold off on shipping that change until #118339 is merged.

Understood, but then how can I run a benchmark that tells me how Tier 2 fares with my changes before merging it? (Possibly we won't care. We should discuss this in today's meeting.)

@mdboom
Copy link
Contributor

mdboom commented Apr 29, 2024

Oh, good point. If I'm reading correctly, we could probably do both the ./configure flag and the environment variable for a while (and then remove the environment variable).

@gvanrossum
Copy link
Member Author

Off-line we decided on a different configure experience. The --configure-experimental-jit flag will be extended so you can write

./configure --enable-experimental-jit={off|yes|no|interp}

(enum names subject to bikeshedding) which selects whether the JIT or the Tier 2 interpreter is built, and whether it's on or off by default. An environment variable, PYTHON_JIT={0|1} can override whatever is built.

@gvanrossum
Copy link
Member Author

Meanwhile, Brandt and I solved the Windows failure, which was due to _Py_JIT being undefined when _testinternalcapi.c was being compiled in JIT mode. Fix forthcoming.

gvanrossum added a commit that referenced this issue May 1, 2024
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.
gvanrossum added a commit that referenced this issue May 1, 2024
…118493)

Also patch up news blurb for gh-118339
(add warning that PYTHON_UOPS is now PYTHON_JIT).
gvanrossum added a commit that referenced this issue May 2, 2024
…ntal-jit-interpreter (#118497)

Also fix docs for this in whatsnew.
SonicField pushed a commit to SonicField/cpython that referenced this issue May 8, 2024
…18339)

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.
SonicField pushed a commit to SonicField/cpython that referenced this issue May 8, 2024
…abled (python#118493)

Also patch up news blurb for pythongh-118339
(add warning that PYTHON_UOPS is now PYTHON_JIT).
SonicField pushed a commit to SonicField/cpython that referenced this issue May 8, 2024
…perimental-jit-interpreter (python#118497)

Also fix docs for this in whatsnew.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants