[Openmp-commits] [PATCH] D71988: [OpenMP][WIP] Make the kmp_depend_info type fit in 128 bits.

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Dec 29 23:21:31 PST 2019


jdoerfert created this revision.
Herald added subscribers: guansong, bollu.
Herald added a project: OpenMP.

NOTE: The clang codegen change is missing but this simplifies a
      OMPIRBuilder patch and makes the struct more compact. This is not
      to be commited like this!

The old type wasted 64 bits on a length value that is not used. While we
probably need to use the length value eventually, supporting a 64 bit
extend seems excessive. With this patch we have 61 bit extend (=length)
and we use the 3 highest bits for the kind encoding. Alternatively, we
could put some bits in the lower part of the base pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71988

Files:
  openmp/runtime/src/kmp.h
  openmp/runtime/src/kmp_gsupport.cpp


Index: openmp/runtime/src/kmp_gsupport.cpp
===================================================================
--- openmp/runtime/src/kmp_gsupport.cpp
+++ openmp/runtime/src/kmp_gsupport.cpp
@@ -1182,7 +1182,7 @@
 
       for (size_t i = 0U; i < ndeps; i++) {
         dep_list[i].base_addr = (kmp_intptr_t)depend[2U + i];
-        dep_list[i].len = 0U;
+        dep_list[i].flags.len = 0U;
         dep_list[i].flags.in = 1;
         dep_list[i].flags.out = (i < nout);
       }
Index: openmp/runtime/src/kmp.h
===================================================================
--- openmp/runtime/src/kmp.h
+++ openmp/runtime/src/kmp.h
@@ -2142,14 +2142,17 @@
 // Compiler sends us this info:
 typedef struct kmp_depend_info {
   kmp_intptr_t base_addr;
-  size_t len;
   struct {
+    kmp_uint64 len : 61;
     bool in : 1;
     bool out : 1;
     bool mtx : 1;
   } flags;
 } kmp_depend_info_t;
 
+static_assert(sizeof(kmp_depend_info_t) <= 2 * sizeof(uint64_t),
+              "KMP depend info type is larger than expected");
+
 // Internal structures to work with task dependencies:
 struct kmp_depnode_list {
   kmp_depnode_t *node;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71988.235553.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20191230/9f93ee40/attachment.bin>


More information about the Openmp-commits mailing list