[Openmp-commits] [PATCH] D111987: [libomptarget][nfc]Generalise DeviceRTL cmake to allow building for amdgpu

Michael Kruse via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 21 09:08:58 PDT 2021


Meinersbur added inline comments.


================
Comment at: openmp/libomptarget/DeviceRTL/CMakeLists.txt:145
 
-# Generate a Bitcode library for all the compute capabilities the user requested
-foreach(sm ${nvptx_sm_list})
-  # TODO: replace this with declare variant and isa selector.
-  set(cuda_flags -Xclang -target-cpu -Xclang sm_${sm} "-D__CUDA_ARCH__=${sm}0")
+macro(instantiate_DeviceRTL)
+  # parameters target_cpu, target_name, target_bc_flags
----------------
Consider
```
function(instantiate_DeviceRTL target_cpu target_name)
  set(target_bc_flags ${ARGN})
```
or maybe even `cmake_parse_arguments` of more options might be added in the future.


================
Comment at: openmp/libomptarget/DeviceRTL/CMakeLists.txt:217
   # Copy library to destination.
+  # Note: This is acting on the llvm-link'ed library, not the opt'ed one
   add_custom_command(TARGET ${bclib_target_name} POST_BUILD
----------------
[not related to this patch] There seems to be a serious mistake:
```
  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}_opt
      COMMAND ${OPT_TOOL} ${link_opt_flags} ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}
                      -o ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name}
```
Says it would generate the `${bclib_name}_opt` file, but the `-o` parameter points to `${bclib_name}`, overwriting the input file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111987/new/

https://reviews.llvm.org/D111987



More information about the Openmp-commits mailing list