On 7/16/26 11:17, Paul-Antoine Arras wrote:
On 16/07/2026 16:27, Tobias Burnus wrote:
I know that I am late in the game, however, I have some
comments + questions to this patch, i.e. to

   r17-2288-gab0dd7d5e16fcd
   openmp: Add OMPT entry points for worksharing-loop, single, and masked constructs
   https://gcc.gnu.org/r17-2288-gab0dd7d5e16fcd

First:

This commit addsGOMP_masked_end such that:

           #pragma omp masked filter(2)
           D.3135 = __builtin_GOMP_has_masked_thread_num (2);
           if (D.3135 != 0) goto <D.3136>; else goto <D.3134>;
           <D.3136>:
             ...
           __builtin_GOMP_masked_end ();  // only with -fopenmp-ompt
           <D.3134>:
           #pragma omp return(nowait)


Thus, it call num_threads() times the thread_num function and
only once (for the filtered thread) the 'masked_end' function.
[That's fine.]

Now to my question: How can the OMPT runtime distinguish whether
there is a single masked/master call vs. a begin/end
call?


For one version, one has to call the tool with:
    ompt_scope_beginend

while for the other version, one needs:
    ompt_scope_begin
and
    ompt_scope_end

but, currently, there is no way to distinguish the two.

Thus: Can you add a GOMP_masked_begin function in addition?

* * *

Regarding the documentation (current version at ...)
https://gcc.gnu.org/onlinedocs/gcc/OpenMP-and-OpenACC- Options.html#index-fopenmp-ompt


First, I find the second part/clause of the first sentence in
-fopenmp-ompt-detail in particular confusing:

   Like @option{-fopenmp-ompt}, and additionally emit calls into libgomp, enabling    OMPT dispatch callbacks that get called at the beginning of each workshare chunk
   for statically scheduled @code{for} and @code{distribute}.  Requires
   @option{-fopenmp}.

Maybe: "On top of -fopenmp-ompt, emit additional calls into libgomp,"
as minimal change - or even smaller change:
"Like -fopenmp-ompt, emit additional calls into libgomp,"


However, I wonder whether the whole should be completely differently worded;
for instance:

-fopenmp-ompt

   For some OpenMP constructs, generate calls before and after the
   region instead of only on region entry.  This improves the OMPT
   tracing at expense of additional calls.  In particular, the
   additional calls will be added for static worksharing loops,
   static worksharing @code{dispatch}, and the @code{single},
   @code{masked}, and @code{master} construct.
   Requires @option{-fopenmp}.

-fopenmp-ompt-details

   Add additional calls into the OpenMP runtime that might affect
   the performance but further improves OMPT tracing. In particular,
   dispatch callbacks are generated at the beginning of each workshare chunk for static worksharing loops and
   static worksharing @code{dispatch}.  This option implies
   @option{-fopenmp-ompt}.  Requires @option{-fopenmp}.
What do you think?

Tobias


I am happy to rephrase as you suggest but would like to hear from Thomas (who approved the original patch) and possibly from Sandra (who you already CC'd).

I have very little state on OMPT at present, and I didn't understand the terminology in Tobias's proposed text (e.g. "static worksharing loops", "workshare chunk"). I don't know if that is a bug in the text or if I just need to read something that defines those terms -- but in that case GCC users need to be pointed at the appropriate reference too, not just me.

-Sandra


Reply via email to