-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
[BOLT] [3.12] Python 3.12.7 --enable bolt option not working #124948
Comments
cc @corona10 |
I will take a look |
leesm@leesm-ubuntu ~/Workspace/cpython ./configure --enable-bolt
leesm@leesm-ubuntu ~/Workspace/cpython make
->
BOLT-INFO: basic block reordering modified layout of 2699 functions (68.73% of profiled, 45.13% of total)
BOLT-INFO: UCE removed 36 blocks and 0 bytes of code
BOLT-INFO: splitting separates 1220980 hot bytes from 780031 cold bytes (61.02% of split functions is hot).
BOLT-INFO: 43 Functions were reordered by LoopInversionPass
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:
18740817903 : executed forward branches
7826248652 : taken forward branches
7349242935 : executed backward branches
2852718872 : taken backward branches
4004518103 : executed unconditional branches
3353239032 : all function calls
1262678534 : indirect calls
137784052 : PLT calls
259717127425 : executed instructions
77083459173 : executed load instructions
43910218984 : executed store instructions
4541628185 : taken jump table branches
0 : taken unknown indirect branches
30094578941 : total branches
14683485627 : taken branches
15411093314 : non-taken conditional branches
10678967524 : taken conditional branches
26090060838 : all conditional branches
21694777552 : executed forward branches (+15.8%)
1679657684 : taken forward branches (-78.5%)
4863157010 : executed backward branches (-33.8%)
2286864783 : taken backward branches (-19.8%)
1866969944 : executed unconditional branches (-53.4%)
2800009758 : all function calls (-16.5%)
673537882 : indirect calls (-46.7%)
137784052 : PLT calls (=)
256484195370 : executed instructions (-1.2%)
76738590906 : executed load instructions (-0.4%)
43910090648 : executed store instructions (-0.0%)
4541628185 : taken jump table branches (=)
0 : taken unknown indirect branches (=)
28424904506 : total branches (-5.5%)
5833492411 : taken branches (-60.3%)
22591412095 : non-taken conditional branches (+46.6%)
3966522467 : taken conditional branches (-62.9%)
26557934562 : all conditional branches (+1.8%)
BOLT-INFO: SCTC: patched 60 tail calls (57 forward) tail calls (3 backward) from a total of 60 while removing 3 double jumps and removing 50 basic blocks totalling 250 bytes of code. CTCs total execution count is 36614663 and the number of times CTCs are taken is 25417844
BOLT-INFO: FOP optimized 1 redundant load(s) and 0 unused store(s)
BOLT-INFO: Frequency of redundant loads is 15661399 and frequency of unused stores is 0
BOLT-INFO: Frequency of loads changed to use a register is 15661399 and frequency of loads changed to use an immediate is 0
BOLT-INFO: FOP deleted 1 load(s) (dyn count: 15661399) and 0 store(s)
BOLT-INFO: FRAME ANALYSIS: 2248 function(s) were not optimized.
BOLT-INFO: FRAME ANALYSIS: 1999 function(s) (88.8% dyn cov) could not have its frame indices restored.
BOLT-INFO: Shrink wrapping moved 14 spills inserting load/stores and 0 spills inserting push/pops
BOLT-INFO: Shrink wrapping reduced 117436164 store executions (0.0% total instructions executed, 0.3% store instructions)
BOLT-INFO: Shrink wrapping failed at reducing 0 store executions (0.0% total instructions executed, 0.0% store instructions)
BOLT-INFO: Allocation combiner: 22 empty spaces coalesced (dyn count: 84363257).
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting _end to 0xcf093c
BOLT-INFO: setting _end to 0xcf093c
BOLT-INFO: setting __hot_start to 0xa00000
BOLT-INFO: setting __hot_end to 0xb7d512
touch profile-bolt-stamp
make[1]: Leaving directory '/home/leesm/Workspace/cpython'
leesm@leesm-ubuntu ~/Workspace/cpython ./python
Python 3.12.7 (main, Nov 2 2024, 17:57:45) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
leesm@leesm-ubuntu ~/Workspace/cpython llvm-bolt --version
LLVM (http://llvm.org/):
LLVM version 19.1.0
Optimized build with assertions.
BOLT revision <unknown>
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64 I tested this issue on my setup with CPython 3.12 and LLVM-BOLT version 19.1.0 on a Ubuntu(20.04) environment, and I did not encounter any problems. The --enable-bolt function worked as expected. It appears that this issue might be other environment problems. @ptr1337 |
After Python 3.13 got pushed to archlinux stable, im still not able to bolt it with the same issues.
|
I can confirm this issue using Clang-20git (c660b281b60085cbe40d73d692badd43d7708d20) on CachyOS with Python 3.13.1:
And if I do as advised by BOLT, I see another function that errors out instead:
|
Also, another idea: |
Adding to the bolt commands: |
The I think a proper fix here is to add any functions with computed gotos to the BOLT exclusion list. Presumably a future LLVM release will gain the ability to perform these dynamic relocations, so we'll [eventually] want some form of LLVM version sniffing to control the behavior. |
@indygreg This might be the relevant LLVM-MR for gaining that functionality: llvm/llvm-project#120267 |
Nice find, @ms178! I agree that PR looks promising. Hopefully it makes LLVM 20. While I'm here, python-build-standalone is working around the issue with a patch at astral-sh/python-build-standalone#463. I needed to add |
@indygreg While at it, I'd suggest to modernize the BOLT flags a bit: |
Good idea! FWIW
But |
|
It's a bit off-topic here, but could you expand on this? Would it fail at build or runtime on aarch64? |
Is there something like Discord for CPython? Maybe it is more convenient we can chat there ? |
My Discord username is |
Ok, it seems that there is no notification in github. So I often miss important message... |
Bug report
Bug description:
Hi together,
After updating llvm-bolt to 19.1.0 it is not possible to use the --enable-bolt function anymore.
Following can be found in the log:
so, it appears to fail at the instrumentation and suggest to add
--skip-funcs=sre_ucs1_match/*
.CPython versions tested on:
3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: