Observed issues › gcc/gcc-c-uses-allocators-traits-unimplemented
uses_allocators with allocator traits or a memory space: "sorry, unimplemented"
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
GCC 16.2 stops with "sorry, unimplemented: 'uses_allocators' clause with traits and memory spaces" (Fortran) or "sorry, unimplemented: 'uses_allocators' clause" (C) on a target construct whose uses_allocators clause defines an allocator with traits or a memory space, in the 5.0 and 5.2 forms. Its implementation status table says only predefined allocators are supported.
Affected variants
| Compiler | MI300A gfx942 unified memory (XNACK 1) | MI300A gfx942 copy (XNACK 0) | MI250X gfx90a copy (XNACK 0) | MI300X gfx942 copy (XNACK 0) | MI350X gfx950 copy (XNACK 0) | A100 sm_80 separate memory | A100 sm_80 managed memory |
|---|---|---|---|---|---|---|---|
| AFAR 24.3.0 | fails another way | fails another way | unknown not run | fails another way | fails another way | n/a | n/a |
| CCE 19.0.0 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| NVHPC 25.11 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| NVHPC 26.9 | n/a | n/a | n/a | n/a | n/a | fails another way | fails another way |
| GCC 16.2.0 | not supported | not supported | not supported | not supported | not supported | not supported | n/a |
"behaves incorrectly" / "not supported": this issue, confirmed in up to four environments (another build directory, another node, a repeat). "fails another way": a different failure, not counted as this issue. "unknown": not run there, or the runs disagree.
Messages
| Result | Compiler and GPU | Message |
|---|---|---|
| not supported | GCC 16.2.0, MI300A unified GCC 16.2.0, MI300A copy GCC 16.2.0, MI300X GCC 16.2.0, MI350X | showsite-gcc--gcc-c-uses-allocators-traits-unimplemented.c: In function ‘main’:
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c:62:22: sorry, unimplemented: ‘uses_allocators’ clause
62 | uses_allocators(traits(my_traits): my_alloc)
| ^ |
| not supported | GCC 16.2.0, MI250X GCC 16.2.0, A100 separate | showsite-gcc--gcc-c-uses-allocators-traits-unimplemented.c: In function ‘main’:
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c:58:22: sorry, unimplemented: ‘uses_allocators’ clause
58 | uses_allocators(traits(my_traits): my_alloc)
| ^ |
| fails another way | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showsite-gcc--gcc-c-uses-allocators-traits-unimplemented.c:54:9: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
54 | const const omp_alloctrait_t my_traits[1] = {{omp_atk_alignment, 64}};
| ^
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c:62:23: error: call to undeclared function 'traits'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declarat
62 | uses_allocators(traits(my_traits): my_alloc)
| ^
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c:62:40: error: expected ',' or ')' in 'uses_allocators' clause
62 | uses_allocators(traits(my_traits): my_alloc) |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | show"site-gcc--gcc-c-uses-allocators-traits-unimplemented.c", line 50: warning: type qualifier specified more than once [dupl_type_qualifier]
const const omp_alloctrait_t my_traits[1] = {{omp_atk_alignment, 64}};
^
Remark: individual warnings can be suppressed with "--diag_suppress <warning-name>"
"site-gcc--gcc-c-uses-allocators-traits-unimplemented.c", line 58: error: invalid text in pragma
uses_allocators(traits(my_traits): my_alloc)
^
"site-gcc--gcc-c-uses-allocators-traits-unimplemented.c", line 58: error: extra text after expected end of preprocessing directive |
Reproduce
GCC 16.2.0, MI300A unified
export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib $GCC_16_2/bin/gcc -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.c -o repro HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
GCC 16.2.0, A100 separate
export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=$GCC_16_2/lib64 $GCC_16_2/bin/gcc -fopenmp -foffload=nvptx-none -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 repro.c -o repro OMP_TARGET_OFFLOAD=mandatory ./repro
Program (78 lines)
// # Finding (GCC 16.2): uses_allocators with traits or a memory space is not implemented (C); the reproducer is the catalog program
// omp52-c-clause-uses_allocators-traits
//
// - toolchains: gcc_g90 (GCC 16.2.0, AMD Instinct MI250X gfx90a, Tioga) and gcc_sm80 (GCC 16.2.0,
// NVIDIA A100 sm_80, wingtip); separate memory only; -O2; OMP_TARGET_OFFLOAD=mandatory
// - build: gcc -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx90a -O2 (gcc_g90); -foffload=nvptx-none
// -foffload-options=nvptx-none=-march=sm_80 -foffload-options=nvptx-none=-latomic -O2 (gcc_sm80)
// - failure: rejected: sorry, unimplemented: .uses_allocators. clause
// - observed: `sorry, unimplemented: 'uses_allocators' clause` on both GPUs.
// - expected: compiles; `RESULT ran_on_host=0 check=pass`
// - GCC 16.2 documentation (libgomp.texi of the GCC 16.2.0 release tarball, "OpenMP Implementation Status", OpenMP 5.2 table): "New
// memspace and traits modifiers for uses_allocators": P (partial), "Only predefined allocators". The message is GCC's own "sorry,
// unimplemented".
// - spec: the uses_allocators clause and its traits and memspace modifiers (5.2 §6.8 p.181).
// - other families: AFAR reports uses_allocators as not yet implemented; CCE rejects the 5.2 traits form
// (catalog/cce-c-uses-allocators-traits-rejected.c).
// - gate and confirmer: 10 cells (5 gcc_g90, 5 gcc_sm80), each confirmed in the gate's four environments (a-d;
// results/gcc/gate-tioga/ and gate-wingtip/ verdicts.jsonl); confirmer verdicts (results/gcc/confirm/batch.gcc_*.jsonl):
// unsupported (R05-unsupported) 10
// - catalog programs (5): omp50-c-clause-uses_allocators-traits, omp52-c-clause-uses_allocators-memspace,
// omp52-c-clause-uses_allocators-traits, omp60-c-clause-uses_allocators-memspace, omp60-c-clause-uses_allocators-traits
// - legality: the catalog programs are legal by construction (offload.engine.gen, c_gen and acc_gen
// check every program against the catalog rules and the offload scope as it is built; no
// compiler). GCC is a compiler under test only: never a legality witness, here or for another
// family's case (catalog/machines.yaml under_test_only).
// Generated by compliance.c_gen (OpenMP 5.2, C11): the C port (offload.engine.f2c) of omp52-clause-uses_allocators-traits. Do not edit.
// id: omp52-c-clause-uses_allocators-traits
// primary atom: omp.clause.uses_allocators.traits
// legal: yes
// observable: no (unverified: the check covers the device kernel, not the atom)
// ran_on_host: inside the target region of interest
// evidence: unverified
// needs: none
// std: c11
// unverified (oracle_not_written): re-categorised (was implementation_defined): memory from the allocator 'will be byte
// aligned to at least the value specified for the alignment trait' (5.2 §6.2 p.173, 6.0 §8.2 p.306), so a check that t's address is
// a multiple of 64 is a deterministic oracle of the original; it is not written. A mutant without the trait could still be 64-byte
// aligned (any alignment conforms then), AFAR rejects uses_allocators and CCE 19's mutant without the trait is an internal compiler
// error (final-review re-audit)
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>
enum { n = 64 };
int main(void) {
int a[n];
int b[n];
int ref[n];
int host_flag;
bool ok;
int t;
omp_allocator_handle_t my_alloc;
const const omp_alloctrait_t my_traits[1] = {{omp_atk_alignment, 64}};
for (int i = 1; i <= n; i++) {
a[i - 1] = i;
b[i - 1] = 0;
ref[i - 1] = 2 * i + 1;
}
host_flag = 1;
#pragma omp target map(to: a) map(from: b) map(tofrom: host_flag) \
uses_allocators(traits(my_traits): my_alloc)
{
host_flag = (omp_is_initial_device() ? 1 : 0);
#pragma omp parallel for default(none) shared(a, b, my_alloc) private(t) \
allocate(my_alloc: t)
for (int i = 1; i <= n; i++) {
t = 2 * a[i - 1];
b[i - 1] = t + 1;
}
}
bool t1_ = true;
for (int k2_ = 0; k2_ < n; k2_++)
t1_ = t1_ && (b[k2_] == ref[k2_]);
ok = t1_;
printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
return 0;
}
Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page
Expected and observed
Expected
check=pass
Observed where it behaves incorrectly
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c: In function ‘main’:
site-gcc--gcc-c-uses-allocators-traits-unimplemented.c:62:22: sorry, unimplemented: ‘uses_allocators’ clause
62 | uses_allocators(traits(my_traits): my_alloc)
| ^What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §6.8 p.181
OpenMP 5.2 §6.2 p.173
OpenMP 6.0 §8.2 p.306