Config to build a Propeller Optimized Clang.
I added a config to build clang with Propeller (without PGO). I will follow this up with a PGO + Propeller config. This collects profiles by building clang again. It automatically checks for perf PMU + LBR support. The profile conversion tool, create_llvm_prof, can be pointed at by setting variable: -DPATH_TO_CREATE_LLVM_PROF=
Doing the following will build a Propeller optimized clang:
$ cmake -G Ninja -DPATH_TO_CREATE_LLVM_PROF=/bin/create_llvm_prof -C ../llvm-project/clang/cmake/caches/Propeller.cmake ../llvm-project/llvm
$ ninja propeller-opt-binary
The optimized binary is in: tools/clang/propeller-artifacts/propeller-optimized-clang/bin/clang
Building Propeller with clang requires branch sampling support from the processor's PMU. This assumes that the config is being run on an Intel machine. If this is being run on an AMD machine, the perf command needs to be changed by setting the following variable:
-DPROPELLER_PERF_PROFILE_COLLECTION_PREFIX=
I measured a 20% performance speedup in building clang using a Propeller optimized clang.
I think this unnecessarily depends on the CMake generator being Ninja (and not e.g. Unix makefiles). What about modifying ExternalProject_Add(clang-propeller-profiles below to also include a BUILD_COMMAND which would start with ${PROPELLER_PERF_PROFILE_COLLECTION_PREFIX} -o ${PROPELLER_PERF_DATA} -- ${CMAKE_COMMAND} --build?