GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
openmp Performance Win

openmp: Adjust calls to OMPT variants depending on loop-end call

Corrects redundant calls to OMPT worksharing functions when GOMP_loop_end is already present.

This commit refactors OpenMP loop expansion to avoid redundant calls to OMPT worksharing functions when the inscan modifier is used. The inscan modifier already implies a call to GOMP_loop_end (or its variants), making subsequent calls to *_worksharing_end functions unnecessary. The changes adjust the expansion logic to prevent these redundant calls, ensuring correct and efficient handling of OpenMP loops with the inscan modifier.

In Details

When the inscan modifier is present on an OpenMP for construct, GCC's expansion logic for static scheduling already emits a GOMP_loop_end call. If -fopenmp-ompt is enabled, the compiler would then redundantly emit a call to a related *_worksharing_end function. This commit corrects the expand_omp_for_static_nochunk and expand_omp_for_static_chunk functions to account for the presence of GOMP_loop_end when inscan is used, preventing the duplicate worksharing-end call. It also ensures that GOMP_loop_end correctly implies a call to GOMP_loop_static_worksharing_start even wi…

For Context
OMP
OpenMP, an API that supports multi-platform shared-memory parallel programming in C, C++, and Fortran.
OMPT
OpenMP Tools Interface, an interface for tools to interact with and observe OpenMP runtime behavior, often used for profiling and debugging.
inscan modifier
An OpenMP clause that affects how loop iterations are scheduled, typically used in conjunction with static scheduling to influence the work distribution.
GOMP_loop_end
A function provided by the GCC OpenMP runtime library (libgomp) to signal the end of a parallel loop construct.
worksharing_end
Functions within the OMPT interface that mark the end of a worksharing construct, used by tools to track parallel regions.
libgomp
The GCC runtime library that implements the OpenMP standard.
Filed Under: openmpoptimizationruntime