[Openmp-commits] [PATCH] D125315: [Libomptarget] Build the device runtime as a static library

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri May 13 10:23:12 PDT 2022


jhuber6 updated this revision to Diff 429288.
jhuber6 added a comment.

Rebase to not change the include directories.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125315

Files:
  openmp/libomptarget/DeviceRTL/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/src/CMakeLists.txt


Index: openmp/libomptarget/DeviceRTL/src/CMakeLists.txt
===================================================================
--- /dev/null
+++ openmp/libomptarget/DeviceRTL/src/CMakeLists.txt
@@ -0,0 +1,13 @@
+target_sources(omptarget.devicertl PRIVATE
+  Configuration.cpp
+  Debug.cpp
+  Kernel.cpp
+  Mapping.cpp
+  Misc.cpp
+  Parallelism.cpp
+  Reduction.cpp
+  State.cpp
+  Synchronization.cpp
+  Tasking.cpp
+  Utils.cpp
+  Workshare.cpp)
Index: openmp/libomptarget/DeviceRTL/CMakeLists.txt
===================================================================
--- openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -241,3 +241,22 @@
 foreach(mcpu ${amdgpu_mcpus})
   compileDeviceRTLLibrary(${mcpu} amdgpu -target amdgcn-amd-amdhsa -D__AMDGCN__ -nogpulib)
 endforeach()
+
+# Set the flags to build the device runtime from clang.
+set(clang_lib_flags -fopenmp -fopenmp-cuda-mode -foffload-lto -fvisibility=hidden -mllvm -openmp-opt-disable -nogpulib -nostdinc -DSHARED_SCRATCHPAD_SIZE=512)
+foreach(arch ${nvptx_sm_list})
+  set(clang_lib_flags ${clang_lib_flags} --offload-arch=sm_${arch})
+endforeach()
+foreach(arch ${amdgpu_mcpus})
+  set(clang_lib_flags ${clang_lib_flags} --offload-arch=${arch})
+endforeach()
+
+# Build the static library version of the device runtime.
+add_library(omptarget.devicertl STATIC)
+target_compile_features(omptarget.devicertl PRIVATE cxx_std_17)
+target_include_directories(omptarget.devicertl PRIVATE ${include_directory} ${devicertl_base_directory}/../include)
+target_compile_options(omptarget.devicertl PRIVATE ${clang_lib_flags})
+
+install(TARGETS omptarget.devicertl ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR})
+
+add_subdirectory(src)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125315.429288.patch
Type: text/x-patch
Size: 1732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220513/8d5a7ae2/attachment.bin>


More information about the Openmp-commits mailing list