[Openmp-commits] [openmp] r347907 - [OpenMP] Add stubs for Task affinity API

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 29 12:04:29 PST 2018


Author: jlpeyton
Date: Thu Nov 29 12:04:29 2018
New Revision: 347907

URL: http://llvm.org/viewvc/llvm-project?rev=347907&view=rev
Log:
[OpenMP] Add stubs for Task affinity API

This patch adds __kmpc_omp_reg_task_with_affinity to register affinity
information for tasks. For now, the affinity information is not used,
and the function always succeeds. This also adds the kmp_task_affinity_info_t
structure to store the task affinity information.

Patch by Terry Wilmarth

Differential Revision: https://reviews.llvm.org/D55026

Modified:
    openmp/trunk/runtime/src/dllexports
    openmp/trunk/runtime/src/kmp.h
    openmp/trunk/runtime/src/kmp_tasking.cpp

Modified: openmp/trunk/runtime/src/dllexports
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/dllexports?rev=347907&r1=347906&r2=347907&view=diff
==============================================================================
--- openmp/trunk/runtime/src/dllexports (original)
+++ openmp/trunk/runtime/src/dllexports Thu Nov 29 12:04:29 2018
@@ -405,6 +405,7 @@ kmpc_set_disp_num_buffers
         __kmpc_task_reduction_get_th_data   269
 # USED FOR 4.5 __kmpc_critical_with_hint    270
         __kmpc_get_target_offload           271
+	__kmpc_omp_reg_task_with_affinity   272
     %endif
 %endif
 

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=347907&r1=347906&r2=347907&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Thu Nov 29 12:04:29 2018
@@ -2222,6 +2222,18 @@ typedef struct kmp_dephash {
 #endif
 } kmp_dephash_t;
 
+#if OMP_50_ENABLED
+typedef struct kmp_task_affinity_info {
+  kmp_intptr_t base_addr;
+  size_t len;
+  struct {
+    bool flag1 : 1;
+    bool flag2 : 1;
+    kmp_int32 reserved : 30;
+  } flags;
+} kmp_task_affinity_info_t;
+#endif
+
 #endif
 
 #ifdef BUILD_TIED_TASK_STACK
@@ -3783,6 +3795,9 @@ KMP_EXPORT void __kmpc_taskloop(ident_t
 #if OMP_50_ENABLED
 KMP_EXPORT void *__kmpc_task_reduction_init(int gtid, int num_data, void *data);
 KMP_EXPORT void *__kmpc_task_reduction_get_th_data(int gtid, void *tg, void *d);
+KMP_EXPORT kmp_int32 __kmpc_omp_reg_task_with_affinity(
+    ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *new_task, kmp_int32 naffins,
+    kmp_task_affinity_info_t *affin_list);
 #endif
 
 #endif

Modified: openmp/trunk/runtime/src/kmp_tasking.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.cpp?rev=347907&r1=347906&r2=347907&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.cpp (original)
+++ openmp/trunk/runtime/src/kmp_tasking.cpp Thu Nov 29 12:04:29 2018
@@ -1392,6 +1392,28 @@ kmp_task_t *__kmpc_omp_task_alloc(ident_
   return retval;
 }
 
+#if OMP_50_ENABLED
+/*!
+ at ingroup TASKING
+ at param loc_ref location of the original task directive
+ at param gtid Global Thread ID of encountering thread
+ at param new_task task thunk allocated by __kmpc_omp_task_alloc() for the ''new
+task''
+ at param naffins Number of affinity items
+ at param affin_list List of affinity items
+ at return Returns non-zero if registering affinity information was not successful.
+ Returns 0 if registration was successful
+This entry registers the affinity information attached to a task with the task
+thunk structure kmp_taskdata_t.
+*/
+kmp_int32
+__kmpc_omp_reg_task_with_affinity(ident_t *loc_ref, kmp_int32 gtid,
+                                  kmp_task_t *new_task, kmp_int32 naffins,
+                                  kmp_task_affinity_info_t *affin_list) {
+  return 0;
+}
+#endif
+
 //  __kmp_invoke_task: invoke the specified task
 //
 // gtid: global thread ID of caller




More information about the Openmp-commits mailing list