[Openmp-commits] [PATCH] D150156: [OpenMP] Fix incorrect interop type for number of dependencies

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon May 8 16:40:21 PDT 2023

jhuber6 created this revision.
jhuber6 added reviewers: tianshilei1992, tomdeakin, jdoerfert, ye-luo.
Herald added subscribers: sunshaoce, guansong, hiraditya, yaxunl.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, jplehr, sstefan1.
Herald added projects: OpenMP, LLVM.

The interop types use the number of dependencies in the function
interface. Every other function uses an `i32` to count the number of
dependencies except for the initialization function. This leads to
codegen issues when the rest of the compiler passes in an `i32` that
then creates an invalid call. Fix this to be consistent with the other

  rG LLVM Github Monorepo



Index: openmp/libomptarget/src/interop.cpp
--- openmp/libomptarget/src/interop.cpp
+++ openmp/libomptarget/src/interop.cpp
@@ -184,7 +184,7 @@
 void __tgt_interop_init(ident_t *LocRef, kmp_int32 Gtid,
                         omp_interop_val_t *&InteropPtr,
                         kmp_interop_type_t InteropType, kmp_int32 DeviceId,
-                        kmp_int64 Ndeps, kmp_depend_info_t *DepList,
+                        kmp_int32 Ndeps, kmp_depend_info_t *DepList,
                         kmp_int32 HaveNowait) {
   kmp_int32 NdepsNoalias = 0;
   kmp_depend_info_t *NoaliasDepList = NULL;
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3798,7 +3798,7 @@
     Device = ConstantInt::get(Int32, -1);
   Constant *InteropTypeVal = ConstantInt::get(Int32, (int)InteropType);
   if (NumDependences == nullptr) {
-    NumDependences = ConstantInt::get(Int64, 0);
+    NumDependences = ConstantInt::get(Int32, 0);
     PointerType *PointerTypeVar = Type::getInt8PtrTy(M.getContext());
     DependenceAddress = ConstantPointerNull::get(PointerTypeVar);
Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -402,7 +402,7 @@
 __OMP_RTL(__kmpc_free, false, Void, /* Int */ Int32, VoidPtr, VoidPtr)
 __OMP_RTL(__tgt_interop_init, false, Void, IdentPtr, Int32, VoidPtrPtr, Int32,
-          Int32, Int64, VoidPtr, Int32)
+          Int32, Int32, VoidPtr, Int32)
 __OMP_RTL(__tgt_interop_destroy, false, Void, IdentPtr, Int32, VoidPtrPtr,
           Int32, Int32, VoidPtr, Int32)
 __OMP_RTL(__tgt_interop_use, false, Void, IdentPtr, Int32, VoidPtrPtr, Int32,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150156.520515.patch
Type: text/x-patch
Size: 1970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230508/e967d3c1/attachment.bin>

More information about the Openmp-commits mailing list