File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON)
1111option (SYCL_ENABLE_COVERAGE "Enables code coverage for runtime and unit tests" OFF )
1212option (SYCL_ENABLE_STACK_PRINTING "Enables stack printing on crashes of SYCL applications" OFF )
1313option (SYCL_LIB_WITH_DEBUG_SYMBOLS "Builds SYCL runtime libraries with debug symbols" OFF )
14+ option (SYCL_ENABLE_IPO "Builds SYCL runtime libraries with interprocedural optimization" OFF )
1415
1516if (NOT SYCL_COVERAGE_PATH)
1617 set (SYCL_COVERAGE_PATH "${CMAKE_CURRENT_BINARY_DIR} /profiles" )
Original file line number Diff line number Diff line change 44#cmake_policy(SET CMP0057 NEW)
55#include(AddLLVM)
66include (CheckLinkerFlag)
7+ include (CheckIPOSupported)
78configure_file (
89 ${CMAKE_CURRENT_SOURCE_DIR} /version .rc.in
910 ${CMAKE_CURRENT_BINARY_DIR} /version .rc
@@ -16,13 +17,24 @@ if (SYCL_ENABLE_XPTI_TRACING)
1617 include_directories (${LLVM_EXTERNAL_XPTI_SOURCE_DIR} /include )
1718endif ()
1819
20+ if (SYCL_ENABLE_IPO)
21+ check_ipo_supported(RESULT SYCL_USE_IPO)
22+ if (NOT SYCL_USE_IPO)
23+ message (WARNING "Interprocedural optimization is not supported by the compiler, disabling" )
24+ endif ()
25+ endif ()
26+
1927function (add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
2028 # Add an optional argument so we can get the library name to
2129 # link with for Windows Debug version
2230 cmake_parse_arguments (ARG "" "XPTI_LIB;IMPLIB_NAME" "COMPILE_OPTIONS;SOURCES" ${ARGN} )
2331
2432 add_library (${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES} )
2533
34+ if (SYCL_USE_IPO)
35+ set_property (TARGET ${LIB_OBJ_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE )
36+ endif ()
37+
2638 # Common compilation step setup
2739
2840 check_cxx_compiler_flag(-Winstantiation-after-specialization
@@ -79,6 +91,10 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
7991 $<TARGET_OBJECTS:${LIB_OBJ_NAME} >
8092 ${CMAKE_CURRENT_BINARY_DIR} /version .rc)
8193
94+ if (SYCL_USE_IPO)
95+ set_property (TARGET ${LIB_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE )
96+ endif ()
97+
8298 find_package (Threads REQUIRED)
8399
84100 target_link_libraries (${LIB_NAME}
You can’t perform that action at this time.
0 commit comments