PGO (Profile Guided Optimization)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PGO (Profile Guided Optimization)

Jan Wielemaker
Hi,

I was wondering whether there is a module or skeleton floating around to
deal with Profile Guided Optimization using a cmake build. If this rings
a bell you probably know the sequence (assuming GCC):

   - compile using -fprofile-generate
   - run a benchmark suite, this generates .gcda files for each object,
     which may be placed in a different directory.
   - recompile using -fprofile-use

Targetting Ninja, I now use a shell-script that performs

   - ninja -t clean my-target
   - cmake -DPROFILE_GUIDED_OPTIMIZATION=GENERATE ..
   - ninja my-target
   - <run benchmark>
   - cmake -DPROFILE_GUIDED_OPTIMIZATION=USE ..
   - ninja -t clean my-target
   - ninja my-target

Where my-target is the time critical sub-project and
PROFILE_GUIDED_OPTIMIZATION is picked up by cmake and sets the compile
and link flags for the affected targets.

This isn't nice. I guess that ideally I'd have a separate build
subdirectory that always uses -fprofile-generate and the main build dir
using -fprofile-use. Does that make sense? Is there an
example/module/...?

        Thanks --- Jan
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake