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

amdgcn, libgomp: Avoid power-of-two stack stride in GCN plugin

GPU plugin stack allocation stride adjusted to prevent memory conflicts.

The GCN plugin for libgomp now rounds its device thread stack allocation stride to an odd multiple of 4 kiB, avoiding performance degradation caused by power-of-two strides. Previously, a 32 kiB stride on certain AMD GPUs caused memory conflicts, as specific stack offsets mapped to the same hardware resources across different wavefronts. This change improves bandwidth in memory-intensive kernels, such as BabelStream’s dot product, by up to 13% (500 GB/s to 560 GB/s) and offers minor improvements for other kernels.

In Details

The GCN plugin's device-side stack allocation, which places wavefronts contiguously with a fixed stride (GCN_STACK_SIZE, 32 KiB default), suffered from memory bandwidth issues. The large power-of-two stride caused specific relative stack offsets to map to the same memory controllers or cache banks across wavefronts, leading to contention. This patch modifies init_environment_variables in plugin-gcn.c to round stack_size up to the nearest odd multiple of 4 KiB. This non-power-of-two stride breaks the problematic mapping, improving performance for memory-bound kernels like reductions.

For Context
GCN plugin
A loadable module for GCC's libgomp runtime library that enables OpenMP offloading to AMD's Graphics Core Next (GCN) architecture.
wavefront
A group of wavefronts (typically 64 work-items) that execute in lockstep on a GPU. Wavefronts are the basic scheduling unit on AMD GPUs.
stack stride
The amount of memory allocated between the starting points of consecutive thread stacks. In this context, it refers to the separation between the stacks of different wavefronts on the GPU.
libgomp
GCC's implementation of the OpenMP runtime library.
Filed Under: amd gcnlibgompperformancegpu