Recently, I switched to an LLVM built kernel. Before I switched over, I ran a few build benchmarks. I chose the Linux kernel compiling with LLVM (pkgsLLVM.linux in nixpkgs). I ran 3 builds while on the GNU built kernel and all gave me an average of 20 minutes. Once I loaded over to the LLVM built kernel, I ran the same test on the same exact configuration of the kernel (pkgsLLVM.linux in nixpkgs). However, the 3 builds resulted in 15 minutes. I also noticed there’s less noise on my Focusrite Scarlett Solo connected to the built-in USB ports on the ALTRAD8UD-1L25. I’m curious as to why this is happening on my Ampere Altra M128-26. Has anyone tried using an LLVM built kernel on Ampere aside from myself?
Love it! 15 minutes vs 20 minutes is not a small difference. Details please! Kernel version, LLVM / Clang version, GNU version, compiler options, e.g. mcpu=native?, benchmarks, et al.
Kernel version: 6.12.47
GCC version: 14.3.0
LLVM version: 19.1.7
Compiler options are only -mcpu=generic because it’s using the unwrapped compiler.
I’ve also managed to get both kernel’s config files and I’ve put it into this gist. gnu.config · GitHub
Hopefully that helps with reproducing this. Otherwise, the solution is to nix it:
For the GNU kernel: nix build github:RossComputerGuy/dotfiles/dec036e9b0eacf632816d3baee32f0d6cd5ebd9a#nixosConfigurations.zeta3a.config.system.build.kernel
For the LLVM kernel: nix build github:RossComputerGuy/dotfiles/fd373d3ef4e5e7d373a929380dc8bbb0c416b3ad#nixosConfigurations.zeta3a.config.system.build.kernel
Hi and thanks for sharing your results. 20 vs. 15 minutes is a really big change. Did you or can you run the builds with /usr/bin/time with the different kernels and look at the fraction of time spent in system/kernel vs. user space? That can help show where the difference in time is coming from. The build is either using more CPU cores which /usr/bin/time percent CPU utilization will show, and/or the system time was really reduced or it’s possible this isn’t an apples to apples comparison.
As an example, I recently built LLM-MINGW on Altra Max. I see /usr/bin/time output as
user time 44508.42, system time 2989.09, elapsed time 889.05, and percent CPU utilization 5342%. The ratio of system/user time is 6.7%, which gives an estimate of how much it could speed up if the kernel time was reduced to 0.
The other thing is this build is only using 53/128 cores from the percent CPU utilization. This build example is complicated and cross compiles for a lot of different architectures and runs configure type scripts a lot of times and they are all single threaded, which reduces the overall CPU utilization. Initially I didn’t realize that this project build is fairly complicated, and it took me a while to fully understand it to make sure I wasn’t comparing apples vs. oranges ![]()
It would be interesting to see where the speedup is coming from for your build.
Also, I noticed you are using slightly different kernel versions - 6.12.45 vs. 6.12.47. I quickly looked at the other diffs and I’m not familiar with the slight differences so don’t know if they would impact performance.
thanks again for sharing, regards,
john
No, this was using nix-output-monitor’s counter. I could try using hyprfine and use –rebuild to force nix to rebuild the kernel. I think hyprfine will also say similar things to the time binary.
There’s a chance that the patch versions could’ve made a slight difference but I don’t think it would’ve.
Hi, I’m not familiar with nix-output-monitor’s counter or hyprfine and curious what that can tell us. Yes, I agree minor kernel difference is unlikely to cause the difference. I also think it’s unlikely that the original build is spending so much time in the kernel that the build time reduced from 900 to 600 s. The CPU utilization is another thing, would be good to see data to know what’s going on. I’m not sure how I can reproduce this, would be happy to measure it if it’s something I can run myself.
best regards,
john
Just for fun, llvm mingw:
usr 36380.10, sys 680.36, elap 974.03, util 3804%
On a Q64-30 Ubuntu 25, Kernel 6.14.0-33-generic-64k, 1DPC 3200 MT/s.