Changeset: f52719823bd4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f52719823bd4
Modified Files:
cmake/monetdb-options.cmake
cmake/monetdb-toolchain.cmake
Branch: default
Log Message:
initial support for PGO
diffs (58 lines):
diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake
--- a/cmake/monetdb-options.cmake
+++ b/cmake/monetdb-options.cmake
@@ -79,6 +79,14 @@ option(UNDEFINED
"Enable support for the GCC undefined sanitizer (default=OFF)"
OFF)
+option(PGOTRAIN
+ "Enable support for the profile generated optimization training
(default=OFF)"
+ OFF)
+
+option(PGOBUILD
+ "Enable support for the profile generated optimization build (using optained
data) (default=OFF)"
+ OFF)
+
option(STRICT
"Enable strict compiler flags (default=ON for development sources, OFF for
tarball installation)"
"${DEVELOPMENT}")
diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -56,6 +56,36 @@ function(monetdb_default_compiler_option
endif()
endif()
+ if(PGOTRAIN)
+ if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
+ SET(PGO_COMPILE_FLAGS
"-fprofile-generate=${CMAKE_BINARY_DIR}/profile-data")
+ endif()
+ if ("${CMAKE_C_COMPILER_ID}" MATCHES "^(Clang|AppleClang)$")
+ SET(PGO_COMPILE_FLAGS "-fprofile-instr-generate")
+ endif()
+ SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PGO_COMPILE_FLAGS}" PARENT_SCOPE)
+ endif()
+
+ if(PGOBUILD)
+ if(NOT PGO_TRAINING_DIR)
+ SET(PGO_TRAINING_DIR ../training)
+ endif()
+ SET(PGO_TRAINING_DATA ${CMAKE_BINARY_DIR}/${PGO_TRAINING_DIR}/profile-data)
+
+ if(NOT EXISTS ${PGO_TRAINING_DATA})
+ message(FATAL_ERROR "No profiling Data Found so can't Build. Ensure
that the training run was executed in the training build directory. Training
data expected in Directory: " ${PGO_TRAINING_DATA})
+ endif()
+
+ if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
+ SET(PGO_COMPILE_FLAGS "-fprofile-use=${PGO_TRAINING_DATA}
-fprofile-correction -Wno-missing-profile -Wno-coverage-mismatch")
+ endif()
+ if ("${CMAKE_C_COMPILER_ID}" MATCHES "^(Clang|AppleClang)$")
+ SET(PGO_COMPILE_FLAGS "-fprofile-instr-use")
+ endif()
+
+ SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PGO_COMPILE_FLAGS}" PARENT_SCOPE )
+ endif()
+
if(STRICT)
if(${CMAKE_C_COMPILER_ID} MATCHES "^(GNU|Clang|AppleClang)$")
add_compile_options("-Werror")
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]