Paul-Antoine Arras wrote:
Add GOMP_has_masked_thread_num_with_end, which is semantically identically but
meant for -fopenmp-ompt.
Which solves the issue I mentioned in my other email
- sorry for the belated review due to vaccation - namely:
For OMPT, libgomp needs to know whether to pass ompt_scope_beginend
or ompt_scope_begin followed by a later ompt_scope_end to the
registered tool.
gcc/ChangeLog:
* omp-builtins.def (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END):
New builtin.
* omp-low.cc (lower_omp_master): Use it when -fopenmp-ompt.
libgomp/ChangeLog:
* libgomp.map: Add GOMP_has_masked_thread_num_with_end.
* libgomp.texi: Document it.
* libgomp_g.h (GOMP_has_masked_thread_num_with_end): Declare.
* parallel.c (GOMP_has_masked_thread_num_with_end): New function.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/masked-1.c: Check new builtin is not emitted.
* c-c++-common/gomp/masked-3.c: Check new builtin is emitted with
-fopenmp-ompt.
...
@@ -9098,7 +9098,11 @@ lower_omp_master (gimple_stmt_iterator *gsi_p,
omp_context *ctx)
gsi_replace (gsi_p, bind, true);
- bfn_decl = builtin_decl_explicit (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM);
+ if (flag_openmp_ompt)
+ bfn_decl
+ = builtin_decl_explicit (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END);
+ else
+ bfn_decl = builtin_decl_explicit (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM);
Elsewhere, you use such version:
bfn_decl = builtin_decl_explicit (
flag_openmp_ompt ? BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM
: BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END);
which seems to be tad more readable - however, not that it really
matters.
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
-@code{GOMP_has_masked_thread_num} encapsulates the following check, so that OMPT
-can distinguish the compiler-generated code from user-level thread-number
-queries:
+@code{GOMP_has_masked_thread_num} (or its variant
+@code{GOMP_has_masked_thread_num_with_end} enabled by @option{-fopenmp-ompt})
+encapsulates the following check, so that OMPT can distinguish the
+compiler-generated code from user-level thread-number queries:
I think it is more readable and clearer (+ more details) to keep the
current wording and add a sentence, i.e.
@code{GOMP_has_masked_thread_num} encapsulates the following check, so that OMPT
can distinguish the compiler-generated code from user-level thread-number
queries; with @option{-fopenmp-ompt}, a paired call to
@code{GOMP_has_masked_thread_num_with_end} and @code{GOMP_masked_end} is
generated instead.
Otherwise, LGTM.
Thanks,
Tobias