-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
cpython: add support for experimental jit compilation #348786
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
base: master
Are you sure you want to change the base?
Conversation
|
Currently stuck on this error. Also happens with |
5b801a5 to
025a6cf
Compare
025a6cf to
bb71c07
Compare
Same error here on JIT compilation just works on Edit: This derivation is buildable on # Python 3.13.1 with JIT compiler.
with import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/tarball/890e5f24567d6d940b14241c8e05cb28129e3c59") { };
let
llvmPackages = llvmPackages_18;
in
python313.overrideAttrs (
final: prev: {
nativeBuildInputs = [
llvmPackages.libllvm # this must be prepended
llvmPackages.clang
] ++ prev.nativeBuildInputs;
env = prev.env // {
PYTHON_FOR_REGEN = lib.getExe pkgsBuildBuild.python3Minimal;
};
configureFlags = prev.configureFlags ++ [ "--enable-experimental-jit=yes-off" ];
}
) |
| @@ -161,6 +167,9 @@ let | |||
| pythonOnBuildForHost | |||
| ] ++ optionals (stdenv.cc.isClang && (!stdenv.hostPlatform.useAndroidPrebuilt or false) && (enableLTO || enableOptimizations)) [ | |||
| stdenv.cc.cc.libllvm.out | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To adapt for darwin system, this should be modified because it overrides llvm at the last of nativeBuildInputs. Python 3.13.1 tries to find llvm-readobj-18 and libllvm.out defaults to 16, which is not acceptable.
A possible solution is adding a condition && (!jitSupport), but this is a little ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to support this if it pins a specific llvm version. We have 19 on master for both darwin and linux in the meantime.
|
I've posted an issue to CPython: python/cpython#130673 |
|
This PR probably fixes our problem and it almost reaches the final stage. |
Picked and confirmed it builds on x86_64-linux and aarch64-darwin for Unfortunately I had no luck confirming that the JIT actually works. |
CPython 3.14 will pin to LLVM 19. Since LLVM is only used for building the JIT compiler (in fact, a header file |
|
This patch is backported (python/cpython#131749). So |
|
And in 3.13.3, which is on master. Unfortunately I'm currently a bit swamped. |
|
Rebased and updated to use llvm/clang 18. Please give it a whirl, if you can. |
5b4f6f3 to
ca75b89
Compare
|
Rebased. |
Things done
WIP JIT support.
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.