Skip to content

Commit 1d05d18

Browse files
[SYCL][CMake] Build RelWithDebInfo sycl runtimes with frame pointers (#17342)
Enable frame pointers on sycl runtimes when the build configuration is Debug or RelWithDebInfo. (Though setting this will typically be a no-op for Debug builds.) Frame pointers improve the effectiveness of profilers, tracers, and other introspection tools.
1 parent e38db3a commit 1d05d18

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sycl/source/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
4242
target_compile_options(${LIB_NAME} PRIVATE ${CMAKE_CXX_FLAGS_DEBUG_SEPARATED})
4343
endif()
4444

45+
# To facilitate better tracing and profiling except on release builds.
46+
check_cxx_compiler_flag("-fno-omit-frame-pointer" CXX_HAS_NO_OMIT_FRAME_POINTER)
47+
if (CXX_HAS_NO_OMIT_FRAME_POINTER)
48+
target_compile_options(${LIB_NAME} PUBLIC
49+
$<$<CONFIG:Debug,RelWithDebInfo>:-fno-omit-frame-pointer>
50+
)
51+
target_compile_options(${LIB_OBJ_NAME} PUBLIC
52+
$<$<CONFIG:Debug,RelWithDebInfo>:-fno-omit-frame-pointer>
53+
)
54+
endif()
55+
4556
if (SYCL_ENABLE_COVERAGE)
4657
target_compile_options(${LIB_OBJ_NAME} PUBLIC
4758
-fprofile-instr-generate -fcoverage-mapping

0 commit comments

Comments
 (0)