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

GH-113464: Add a warning when building the JIT #118481

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Warn when building the JIT for an experimental platform
  • Loading branch information
brandtbucher committed May 1, 2024
commit 30c64db9f69e450c05b69939661a5baad79f2bba
8 changes: 7 additions & 1 deletion Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class _Target(typing.Generic[_S, _R]):
args: typing.Sequence[str] = ()
ghccc: bool = False
prefix: str = ""
stable: bool = False
debug: bool = False
force: bool = False
verbose: bool = False
Expand Down Expand Up @@ -188,6 +189,11 @@ async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]:

def build(self, out: pathlib.Path, *, comment: str = "") -> None:
"""Build jit_stencils.h in the given directory."""
if not self.stable:
warning = f"JIT support for {self.triple} is still experimental!"
request = "Please report any issues you encounter.".center(len(warning))
outline = "=" * len(warning)
print("\n".join(["", outline, warning, request, outline, ""]))
digest = f"// {self._compute_digest(out)}\n"
jit_stencils = out / "jit_stencils.h"
if (
Expand Down Expand Up @@ -478,7 +484,7 @@ def _handle_relocation(
return _stencils.Hole(offset, kind, value, symbol, addend)


def get_target(host: str) -> _COFF | _ELF | _MachO:
def target(host: str) -> _COFF | _ELF | _MachO:
"""Build a _Target for the given host "triple" and options."""
# ghccc currently crashes Clang when combined with musttail on aarch64. :(
if re.fullmatch(r"aarch64-apple-darwin.*", host):
Expand Down
2 changes: 1 addition & 1 deletion Tools/jit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
comment = f"$ {shlex.join([sys.executable] + sys.argv)}"
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"target", type=_targets.get_target, help="a PEP 11 target triple to compile for"
"target", type=_targets.target, help="a PEP 11 target triple to compile for"
)
parser.add_argument(
"-d", "--debug", action="store_true", help="compile for a debug build of Python"
Expand Down