[OpenMP][Offloading] Add -g when compiling deviceRTLs in debug mode
authorShilei Tian <tianshilei1992@gmail.com>
Sun, 18 Jul 2021 13:34:35 +0000 (09:34 -0400)
committerShilei Tian <tianshilei1992@gmail.com>
Sun, 18 Jul 2021 13:34:54 +0000 (09:34 -0400)
Currently when we compile the project in debug mode, `-g` will not be added to
compilation flag. The bc files generated in different mode are of different size.
When using GPU debuggers like `cuda-gdb`, it is expected to provide more info
with a debug version of bc lib.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D106229

openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt

index 1c5b485..6371230 100644 (file)
@@ -54,7 +54,7 @@ set(optimization_level 2)
 
 # Activate RTL message dumps if requested by the user.
 if(LIBOMPTARGET_NVPTX_DEBUG)
-  set(CUDA_DEBUG -DOMPTARGET_NVPTX_DEBUG=-1)
+  set(CUDA_DEBUG -DOMPTARGET_NVPTX_DEBUG=-1 -g)
 endif()
 
 get_filename_component(devicertl_base_directory
index 243b0ff..5120a9c 100644 (file)
@@ -164,7 +164,7 @@ set(bc_flags -S -x c++ -O1 -std=c++14
              -I${devicertl_nvptx_directory}/src)
 
 if(${LIBOMPTARGET_NVPTX_DEBUG})
-  list(APPEND bc_flags -DOMPTARGET_NVPTX_DEBUG=-1)
+  list(APPEND bc_flags -DOMPTARGET_NVPTX_DEBUG=-1 -g)
 else()
   list(APPEND bc_flags -DOMPTARGET_NVPTX_DEBUG=0)
 endif()