FS#77644 - [llvm] Consider dropping some targets -

Attached to Project: Arch Linux
Opened by Emil (xexaxo) - Saturday, 25 February 2023, 16:47 GMT
Last edited by Evangelos Foutras (foutrelis) - Sunday, 26 February 2023, 16:08 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Disclaimer: I've opened similar  bug 6 -7 years ago https://bugs.archlinux.org/task/52021, which got a reply "... want to cross-compile software to those platforms." and was closed with "Seems beneficial to keep them."

Fast forward a few years, currently we have:

$ llvm-config --version
15.0.7

$ llvm-config --targets-built
AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore

$ pacman -Qi llvm llvm-libs | grep -E "Name|Size"
Name : llvm
Installed Size : 390.33 MiB
Name : llvm-libs
Installed Size : 120.49 MiB

LLVM gained 5 new targets and packages grew by a factor of 3.

Overall I agree with the original reply - people use these for cross-compilation. Off the top of my head, I cannot see (m)any users for Mips MSP430 PowerPC Sparc SystemZ XCore, so I would request dropping them fully or in part.

Note the goal here is to do some "string cleaning" and drop the dead weight, while not breaking people's workflows (not intentionally at least).
So if someone comes forward, saying hey "I'm using XCore" let's keep that.

Thanks

Additional info:
* package version(s)
llvm 15.0.7
This task depends upon

Closed by  Evangelos Foutras (foutrelis)
Sunday, 26 February 2023, 16:08 GMT
Reason for closing:  None
Additional comments about closing:  As discussed, I'm keeping all targets enabled but have removed the llvm-exegesis tool and most static libs from the llvm package.
Comment by John (graysky) - Saturday, 25 February 2023, 17:48 GMT
Is another option to ship two packages, one providing just x86_64 and a 2nd providing all supported?
Comment by Evangelos Foutras (foutrelis) - Saturday, 25 February 2023, 19:17 GMT
With the proposed removed targets, llvm-libs drops to 112.36 MiB. A difference of 8 MiB installed size is not worth pursuing IMO.
Comment by Emil (xexaxo) - Saturday, 25 February 2023, 23:46 GMT
Those 8M savings are from libLLVM.so alone right? I think that is a win it itself, albeit much smaller than I hoped for.
In particular - llvm gets pulled every time an app uses Mesa GL/vdpau/vdpau, even if you're _not_ using an AMD GPU.

The above proposal should cut 20-25M off llvm itself, just like llvm-libs is a bit over 5%. Perhaps too modest.

Looking around we have:
- /usr/bin/ 46M, of which
++ 31M llvm-exegesis
Seems to be static linking LLVM as per https://github.com/llvm/llvm-project/commit/1ad5e3cd6b8147d6919a2dbee9b905f86ba50c97. Trying literally every example from the manual (+ some more from the llvm tests) errors out with "benchmarking unavailable, LLVM was built without libpfm".

- /usr/include 25M
Nothing stands out

- /usr/lib/ 270M, of which
++ 104M libLLVM*CodeGen.a - CodeGen frontend + per target ones

targets larger than 5M - llbLLVMfoobar*.a
++ 30M AMDGPU
++ 18M X86
++ 15M AArch64
++ 12M ARM
++ 6.5M Mips

- /usr/share/docs/llvm/ 38M, of which
++ 16M html/AMDGPU

Building on the original idea, one could
- drop the targets originally proposed - 5%
- drop llvm-exegesis - 5%
- split AMDGPU into sub package - 10%

Ideally there is some clever trick we could use, until then these seem reasonable IMHO.
Comment by Evangelos Foutras (foutrelis) - Sunday, 26 February 2023, 08:10 GMT
Splitting llvm into more sub-packages isn't an attractive option as it increases complexity and maintenance overhead. CMake will also complain about missing targets if it can't find the installed libraries it expects.

Dropping the proposed targets for 8M smaller libLLVM doesn't seem worth it to me. Dropping llvm-exegesis might be fine (because, based on your findings, it doesn't do much without libpfm).

A bigger win could come from not shipping static libraries in the llvm package. Gentoo appears to keep the LLVMDemangle, LLVMSupport and LLVMTableGen ones (for clang-tblgen it seems).

In general, please avoid spending too much time on size reduction proposals because, as you might have guessed from  FS#72588 , I'm not very fast to act on them. Sorry about that. :3

To recap:

- 8M smaller libLLVM is a non-goal for me
- llvm-exegesis could likely be dropped
- I should look into dropping most static libs from llvm
- I definitely need to take a closer look at  FS#72588 
Comment by Evangelos Foutras (foutrelis) - Sunday, 26 February 2023, 11:24 GMT
testing/llvm-15.0.7-2 tentatively removes llvm-exegesis and almost all static libraries.
Comment by Emil (xexaxo) - Sunday, 26 February 2023, 14:22 GMT
Seems to work just fine over here. Note that some projects might insist on using static LLVM, but they should have a build toggle to opt for the DSO.

Thank you

Loading...