Paul-Antoine Arras wrote:
Replace the 5-argument OMPT dispatch builtins and libgomp implementations
(niter, start, incr, chunk_size, istart) with a 2-argument form (start,
iterations) describing the chunk actually being dispatched, which is all the
information OMPT needs.

Background for this patch:

For worksharing loops + distribute - both with static
scheduling, there is no need to call libgomp for the dispatch, except
for OMPT (via -fopenmp-ompt-details). And OMPT only needs two uint64_t
items for this: The start value in the logical iteration space (0 … (N-1))
and how many loop iterations / chunks of work are to be processed by this
dispatching (this thread). – A prior call tells the OMPT-using tool how
many logical iterations totally exist.

Hence, with this patch, just this data is passed. - The previous
interface was based on how the other functions are called but
when using (for no-collapse(n > 1)) a start value less than zero,
one ran into issues. - By just passing here what's needed, all those
issues can be avoided plus some pointless arithmetic as the data is
already readily available.

* * *

To the actual patch:

gcc/ChangeLog:
        * builtin-types.def (BT_FN_VOID_ULONGLONG_ULONGLONG): New.
        (BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG):
        Remove.
        * omp-builtins.def (BUILT_IN_GOMP_LOOP_STATIC_WORKSHARING_DISPATCH):
        (BUILT_IN_GOMP_DISTRIBUTE_STATIC_WORKSHARING_DISPATCH): Update
        signature.
        * omp-expand.cc (expand_omp_for_static_nochunk): Pass chunk start
        and iteration count instead of loop bounds.
        (expand_omp_for_static_chunk): Likewise.

gcc/fortran/ChangeLog:
        * types.def (BT_FN_VOID_ULONGLONG_ULONGLONG): New.
        (BT_FN_VOID_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG_ULONGLONG):
        Remove.

libgomp/ChangeLog:
        * config/gcn/teams.c (GOMP_distribute_static_worksharing_dispatch):
        Update signature and comment.
        * config/nvptx/teams.c (GOMP_distribute_static_worksharing_dispatch):
        Likewise.
        * libgomp_g.h (GOMP_loop_static_worksharing_dispatch,
        GOMP_distribute_static_worksharing_dispatch): Update prototypes.
        * loop.c (GOMP_loop_static_worksharing_dispatch): Update signature
        and comment.
        * teams.c (GOMP_distribute_static_worksharing_dispatch): Likewise.
        * testsuite/libgomp.c-c++-common/for-static-3.c: Update scan-dump
        pattern.

gcc/testsuite/ChangeLog:
        * c-c++-common/gomp/for-static-3.c: Update scan-dump pattern.

LGTM.

Thanks for the patch!

Tobias

Reply via email to