Skip to content

IPE data compression

Finley McIlwaine requested to merge wip/t21766 into master

Compression of IPE data is one potential route to decreasing the size of -finfo-table-map enabled binaries.

  • Adds an --enable-ipe-data-compression flag to the configure script which exposes a supposedly installed zstd compression library to the compiler and RTS.
  • Restructures the IPE buffer node data layout to separate info table references from IPE data. We want to compress the IPE data, but not the info table references since those need to be translated to memory addresses during linking.
  • Adds the necessary compression/decompression logic to IPE data emission section of the compiler and the IPE data loading in the RTS.

I tested the impact of this feature on binary size by compiling GHC itself and then measuring the size of the build results using the following command:

du -hc _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-*.so

For a default GHC build (no IPE data), that command output the following:

102M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
332K    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
836K    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.4M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
44K     _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
768K    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
4.8M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
110M    total

For a default+ipe GHC build (without IPE data compression):

243M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
644K    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.7M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.8M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
88K     _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.8M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
14M     _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
263M    total

For a default+ipe GHC build (with IPE data compression by configuring with --enable-ipe-data-compression):

191M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
524K    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.3M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.7M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
72K     _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
1.4M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
9.2M    _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/
205M    total

Thus I conclude that the compression shrinks build results by about 20%.

Edited by Finley McIlwaine

Merge request reports