[Openmp-commits] [openmp] 224f51d - [OpenMP] Add interface for 5.1 scope construct
Hansang Bae via Openmp-commits
openmp-commits at lists.llvm.org
Tue Sep 7 09:23:17 PDT 2021
Author: Hansang Bae
Date: 2021-09-07T11:22:21-05:00
New Revision: 224f51d879b5060b5a4f57b2774f6f49a5e8951b
URL: https://github.com/llvm/llvm-project/commit/224f51d879b5060b5a4f57b2774f6f49a5e8951b
DIFF: https://github.com/llvm/llvm-project/commit/224f51d879b5060b5a4f57b2774f6f49a5e8951b.diff
LOG: [OpenMP] Add interface for 5.1 scope construct
The new interface only marks begin/end of a scope construct for
corresponding OMPT events, and we can use existing interfaces for
reduction operations.
Differential Revision: https://reviews.llvm.org/D108062
Added:
Modified:
openmp/runtime/src/dllexports
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_csupport.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/dllexports b/openmp/runtime/src/dllexports
index 473746887574f..dcaa8450c35ee 100644
--- a/openmp/runtime/src/dllexports
+++ b/openmp/runtime/src/dllexports
@@ -393,6 +393,8 @@ kmpc_set_disp_num_buffers 267
__kmpc_error 281
__kmpc_masked 282
__kmpc_end_masked 283
+ __kmpc_scope 286
+ __kmpc_end_scope 287
%endif
# User API entry points that have both lower- and upper- case versions for Fortran.
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index a815ee862a7e9..b120a19276557 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -4130,6 +4130,10 @@ typedef enum kmp_severity_t {
} kmp_severity_t;
extern void __kmpc_error(ident_t *loc, int severity, const char *message);
+// Support for scope directive
+KMP_EXPORT void __kmpc_scope(ident_t *loc, kmp_int32 gtid, void *reserved);
+KMP_EXPORT void __kmpc_end_scope(ident_t *loc, kmp_int32 gtid, void *reserved);
+
#ifdef __cplusplus
}
#endif
diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
index 0b5f899cfd8f0..0d333576467fa 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -4392,6 +4392,38 @@ void __kmpc_error(ident_t *loc, int severity, const char *message) {
__kmp_str_free(&src_loc);
}
+// Mark begin of scope directive.
+void __kmpc_scope(ident_t *loc, kmp_int32 gtid, void *reserved) {
+// reserved is for extension of scope directive and not used.
+#if OMPT_SUPPORT && OMPT_OPTIONAL
+ if (ompt_enabled.enabled && ompt_enabled.ompt_callback_work) {
+ kmp_team_t *team = __kmp_threads[gtid]->th.th_team;
+ int tid = __kmp_tid_from_gtid(gtid);
+ ompt_callbacks.ompt_callback(ompt_callback_work)(
+ ompt_work_scope, ompt_scope_begin,
+ &(team->t.ompt_team_info.parallel_data),
+ &(team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data), 1,
+ OMPT_GET_RETURN_ADDRESS(0));
+ }
+#endif // OMPT_SUPPORT && OMPT_OPTIONAL
+}
+
+// Mark end of scope directive
+void __kmpc_end_scope(ident_t *loc, kmp_int32 gtid, void *reserved) {
+// reserved is for extension of scope directive and not used.
+#if OMPT_SUPPORT && OMPT_OPTIONAL
+ if (ompt_enabled.enabled && ompt_enabled.ompt_callback_work) {
+ kmp_team_t *team = __kmp_threads[gtid]->th.th_team;
+ int tid = __kmp_tid_from_gtid(gtid);
+ ompt_callbacks.ompt_callback(ompt_callback_work)(
+ ompt_work_scope, ompt_scope_end,
+ &(team->t.ompt_team_info.parallel_data),
+ &(team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data), 1,
+ OMPT_GET_RETURN_ADDRESS(0));
+ }
+#endif // OMPT_SUPPORT && OMPT_OPTIONAL
+}
+
#ifdef KMP_USE_VERSION_SYMBOLS
// For GOMP compatibility there are two versions of each omp_* API.
// One is the plain C symbol and one is the Fortran symbol with an appended
More information about the Openmp-commits
mailing list