GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgomp/plugin-gcn

Fix kernarg allocation size in libgomp's GCN plugin.

Corrected kernarg allocation in GCC's libgomp GCN plugin to include the target variable table.

GCC’s libgomp plugin for AMD’s GCN (Graphics Core Next) architecture had a bug in kernarg allocation, leaving insufficient space for the target variable table. This commit fixes the allocate_session_kernargs function to use the correct kernargs_size instead of the size of the struct kernargs, preventing potential buffer overflows or incorrect behavior. A new test case is added to verify the fix.

In Details

The libgomp/plugin/plugin-gcn.c file's allocate_session_kernargs function incorrectly calculated the size for kernarg buffers. It used sizeof (struct kernargs) which does not account for the necessary space for the target variable table. This change rectifies the allocation by using kernargs_size, which presumably includes this additional required space. A new test, kernel-launch-many-vars.c, verifies this fix.

For Context
libgomp
GCC's runtime library for OpenMP, providing support for parallel programming.
GCN
Graphics Core Next is a GPU architecture developed by AMD, commonly used in their Radeon graphics cards.
kernarg
Kernel argument. In the context of GPGPU programming, these are the parameters passed from the host to the device when launching a compute kernel.
target variable table
A data structure used by the GCN compute runtime to manage variables accessible by the GPU kernel, including their sizes and offsets.
Filed Under: gpulibgompamdgcnbugfix