Open npatsakula opened 2 years ago
OK I managed to build this on NixOS, but with tons of patches. I think the upstream bolt is not ready for separate compilation yet, so I need to copy a bunch of stuff from elsewhere, but here is the build:
{ stdenv
, llvm_meta
, monorepoSrc
, runCommand
, cmake
, python3
, libxml2
, libllvm
, libclang
, version
}:
stdenv.mkDerivation rec {
pname = "bolt";
inherit version;
# Blank llvm dir just so relative path works
src = runCommand "llvm-src-${version}" { } ''
mkdir $out
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${pname} "$out"
cp -r ${monorepoSrc}/third-party "$out"
# tablegen stuff, probably not the best way but it works...
cp -r ${monorepoSrc}/llvm/ "$out"
'';
sourceRoot = "${src.name}/bolt";
patches = [ ./tons-of-stuff.patch ];
nativeBuildInputs = [ cmake python3 ];
buildInputs = [ libllvm libclang libxml2 ];
outputs = [ "out" "lib" ];
meta = llvm_meta // {
homepage = "https://github.com/llvm/llvm-project/tree/main/bolt";
description = "LLVM post-link optimizer (unwrpped).";
};
}
the patch:
The patch is really ugly and there are some things that are specific to NixOS (I integrated the gnu-install-dirs.patch
in other llvm packages). Not sure if we want to try to get the changes upstreamed before opening a PR.
The build is successful, but I haven't yet tested it. Patching this is quite painful and consumed me 4 hours already...
it seems that it works directly without the need for wrapping.
The upstream patch which makes packaging bolt possible in Nix has been merged. We'll have things here merged in not too long from now.
This project should be part of the
llvmPackage_14.bintools-unwrapped
, but it's missing.BOLT is a post-link optimizer developed to speed up large applications.
It achieves the improvements by optimizing application's code layout based on execution profile gathered by sampling profiler, such as Linux perf tool. An overview of the ideas implemented in BOLT along with a discussion of its potential and current results is available in CGO'19 paper.
Metadata