-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-134273: Allow setting JIT compiler flags with CFLAGS_JIT
#134276
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
Changes from 7 commits
7d12a8a
a6cfd1f
7ed82fe
f82633d
9c76580
6d22e99
1633f56
b24af27
6c4eb49
397c52e
a664071
5e752e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add support for configuring compiler flags for the JIT with CFLAGS_JIT | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
import sys | ||
import tempfile | ||
import typing | ||
import shlex | ||
|
||
import _llvm | ||
import _schema | ||
|
@@ -46,6 +47,7 @@ class _Target(typing.Generic[_S, _R]): | |
stable: bool = False | ||
debug: bool = False | ||
verbose: bool = False | ||
cflags: str = "" | ||
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict) | ||
pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve() | ||
|
||
|
@@ -62,6 +64,7 @@ def _compute_digest(self) -> str: | |
hasher = hashlib.sha256() | ||
hasher.update(self.triple.encode()) | ||
hasher.update(self.debug.to_bytes()) | ||
hasher.update(self.cflags.encode()) | ||
# These dependencies are also reflected in _JITSources in regen.targets: | ||
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes()) | ||
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes()) | ||
|
@@ -120,6 +123,7 @@ async def _compile( | |
) -> _stencils.StencilGroup: | ||
o = tempdir / f"{opname}.o" | ||
args = [ | ||
*shlex.split(self.cflags), | ||
|
||
f"--target={self.triple}", | ||
"-DPy_BUILD_CORE_MODULE", | ||
"-D_DEBUG" if self.debug else "-DNDEBUG", | ||
|
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.