cpython: add support for experimental jit compilation#348786
cpython: add support for experimental jit compilation#348786mweinelt wants to merge 1 commit intoNixOS:masterfrom
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.
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.
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.