[Openmp-commits] [PATCH] D101213: [libomptarget] Enable AMDGPU devicertl

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 23 17:18:03 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, tianshilei1992, grokos, ronlieb, ye-luo.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, mgorny, jvesely, kzhuravl.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1, wdng.
Herald added a project: OpenMP.

[libomptarget] Enable AMDGPU devicertl

The amdgpu devicertl is written in freestanding openmp and compiles to a
bitcode library (per listed gfx arch) with no unresolved symbols. It requires
a recent clang, preferably the one from the same monorepo checkout.

This is D98658 <https://reviews.llvm.org/D98658>, with printf explicitly stubbed out, after patching clang to no
longer require an llvm with the amdgpu target enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101213

Files:
  openmp/libomptarget/deviceRTLs/CMakeLists.txt
  openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
  openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h


Index: openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
@@ -67,6 +67,10 @@
   __kmpc_impl_all_lanes = ~(__kmpc_impl_lanemask_t)0
 };
 
-EXTERN int printf(const char *, ...);
+// The return code of printf is not checked in the call sites in this library.
+// A call to a function named printf currently hits some special case handling
+// for opencl, which translates to calls that do not presently exist for openmp
+// Therefore, for now, stub out printf while building this library.
+#define printf(...)
 
 #endif
Index: openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
@@ -154,6 +154,6 @@
   add_custom_target(lib${libname}-${mcpu} ALL DEPENDS ${bc_libname})
 
   install(FILES ${OUTPUTDIR}/${bc_libname}
-     DESTINATION "${OPENMP_INSTALL_LIBDIR}/libdevice"
+     DESTINATION "${OPENMP_INSTALL_LIBDIR}"
   )
 endforeach()
Index: openmp/libomptarget/deviceRTLs/CMakeLists.txt
===================================================================
--- openmp/libomptarget/deviceRTLs/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/CMakeLists.txt
@@ -10,4 +10,5 @@
 #
 ##===----------------------------------------------------------------------===##
 
+add_subdirectory(amdgcn)
 add_subdirectory(nvptx)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101213.340208.patch
Type: text/x-patch
Size: 1584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210424/3f00c749/attachment-0001.bin>


More information about the Openmp-commits mailing list