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-138497: Support LLVM_VERSION configuration via env#138498
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
694b374386269542d1d124ce99f32a825376528daec45361d10175c7a60b02d8cea949File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| The LLVM version used by the JIT at build time can now be modified using | ||
| the ``LLVM_VERSION`` environment variable. Use this at your own risk, as | ||
| there is only one officially supported LLVM version. For more information, | ||
| please check ``Tools/jit/README.md``. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -50,6 +50,7 @@ class _Target(typing.Generic[_S, _R]): | ||
| debug: bool = False | ||
| verbose: bool = False | ||
| cflags: str = "" | ||
| llvm_version: str = _llvm._LLVM_VERSION | ||
| known_symbols: dict[str, int] = dataclasses.field(default_factory=dict) | ||
| pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve() | ||
| @@ -81,7 +82,9 @@ def _compute_digest(self) -> str: | ||
| async def _parse(self, path: pathlib.Path) -> _stencils.StencilGroup: | ||
| group = _stencils.StencilGroup() | ||
| args = ["--disassemble", "--reloc", f"{path}"] | ||
| output = await _llvm.maybe_run("llvm-objdump", args, echo=self.verbose) | ||
| output = await _llvm.maybe_run( | ||
| "llvm-objdump", args, echo=self.verbose, llvm_version=self.llvm_version | ||
| ) | ||
| if output is not None: | ||
| # Make sure that full paths don't leak out (for reproducibility): | ||
| long, short = str(path), str(path.name) | ||
| @@ -99,7 +102,9 @@ async def _parse(self, path: pathlib.Path) -> _stencils.StencilGroup: | ||
| "--sections", | ||
| f"{path}", | ||
| ] | ||
| output = await _llvm.run("llvm-readobj", args, echo=self.verbose) | ||
| output = await _llvm.run( | ||
| "llvm-readobj", args, echo=self.verbose, llvm_version=self.llvm_version | ||
| ) | ||
| # --elf-output-style=JSON is only *slightly* broken on Mach-O... | ||
| output = output.replace("PrivateExtern\n", "\n") | ||
| output = output.replace("Extern\n", "\n") | ||
| @@ -175,12 +180,16 @@ async def _compile( | ||
| # Allow user-provided CFLAGS to override any defaults | ||
| *shlex.split(self.cflags), | ||
| ] | ||
| await _llvm.run("clang", args_s, echo=self.verbose) | ||
| await _llvm.run( | ||
| "clang", args_s, echo=self.verbose, llvm_version=self.llvm_version | ||
| ) | ||
| self.optimizer( | ||
| s, label_prefix=self.label_prefix, symbol_prefix=self.symbol_prefix | ||
| ).run() | ||
| args_o = [f"--target={self.triple}", "-c", "-o", f"{o}", f"{s}"] | ||
| await _llvm.run("clang", args_o, echo=self.verbose) | ||
| await _llvm.run( | ||
| "clang", args_o, echo=self.verbose, llvm_version=self.llvm_version | ||
| ) | ||
| return await self._parse(o) | ||
| async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]: | ||
| @@ -224,6 +233,8 @@ def build( | ||
| if not self.stable: | ||
| warning = f"JIT support for{self.triple} is still experimental!" | ||
| request = "Please report any issues you encounter.".center(len(warning)) | ||
savannahostrowski marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| if self.llvm_version != _llvm._LLVM_VERSION: | ||
| request = f"Warning! Building with an LLVM version other than{_llvm._LLVM_VERSION} is not supported." | ||
| outline = "=" * len(warning) | ||
| print("\n".join(["", outline, warning, request, outline, ""])) | ||
| digest = f"//{self._compute_digest()}\n" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -42,13 +42,16 @@ | ||
| parser.add_argument( | ||
| "--cflags", help="additional flags to pass to the compiler", default="" | ||
| ) | ||
| parser.add_argument("--llvm-version", help="LLVM version to use") | ||
| args = parser.parse_args() | ||
| for target in args.target: | ||
| target.debug = args.debug | ||
| target.force = args.force | ||
| target.verbose = args.verbose | ||
| target.cflags = args.cflags | ||
| target.pyconfig_dir = args.pyconfig_dir | ||
| if args.llvm_version: | ||
savannahostrowski marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| target.llvm_version = args.llvm_version | ||
| target.build( | ||
| comment=comment, | ||
| force=args.force, | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.