GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgomp Performance Win

Parallelize thread initialization in libgomp for faster parallel region setup.

libgomp now parallelizes thread initialization during parallel region setup, reducing overhead for many threads.

This patch parallelizes the initialization of thread-local data within libgomp’s parallel region setup, aiming to reduce overhead when using a large number of threads. Previously, each thread’s local values for task, team number, function pointers, and data were initialized sequentially by the primary thread. This change distributes this initialization work among the threads, significantly speeding up the setup process, especially when reusing thread teams.

In Details

This commit addresses performance regressions in libgomp related to the creation of many parallel regions. It parallelizes the initialization of several thread-local fields (thr->task, thr->num_teams, thr->team_num, fn, data, thr->ts.def_allocator) within gomp_team_start. Previously initialized by the primary thread, this work is now distributed, reducing the critical path length for parallel region setup and teardown, particularly when thread teams are reused.

For Context
libgomp
The GNU implementation of OpenMP runtime library, providing support for parallel programming constructs in C, C++, and Fortran.
parallel region
A section of code in an OpenMP program that can be executed in parallel by multiple threads. The runtime library manages the creation and synchronization of these threads.
thread initialization
The process of setting up the necessary data structures and initial values for a thread before it begins executing its assigned workload.
thread team
A group of threads managed by libgomp that work together to execute parallel regions. Reusing thread teams can reduce the overhead of creating and destroying threads.
ICV
Internal Control Variables. These are variables within the OpenMP runtime that control the behavior of parallel constructs, such as the number of threads or the team structure.
Filed Under: libgompOpenMPparallelismperformance