OffTarget

Observed issues › catalog/cce-c-uses-allocators-traits-rejected

Appears not to supportRefused at compile time · C · OpenMP · Open

craycc/ftn: OpenMP 5.1/5.2/6.0 forms HPE does not claim are rejected, and some crash the compiler instead of a diagnostic

Legality: not independently confirmed. no independent review yet How this is checked

Same issue as catalog/cce-c-map-iterator-ice; this program is another reproducer of it.

Affected variants

CompilerMI300A 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.0correctcorrectcorrectcorrectcorrectn/an/a
CCE 19.0.0not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 20.0.2not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/afails another wayfails another way
NVHPC 26.9n/an/an/an/an/afails another wayfails another way
GCC 16.2.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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

ResultCompiler and GPUMessage
not supportedCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 19.0.0, MI250X
CCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 20.0.2, MI250X
CCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.3, MI250X
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
CCE 21.0.4, MI250X
show
cce-c-uses-allocators-traits-rejected.c:15:9: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
   15 |   const const omp_alloctrait_t my_traits[1] = {{omp_atk_alignment, 64}};
      |         ^
cce-c-uses-allocators-traits-rejected.c:23:23: error: call to undeclared function 'traits'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   23 |       uses_allocators(traits(my_traits): my_alloc)
      |                       ^
cce-c-uses-allocators-traits-rejected.c:23:40: error: expected ',' or ')' in 'uses_allocators' clause
   23 |       uses_allocators(traits(my_traits): my_alloc)
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
"cce-c-uses-allocators-traits-rejected.c", line 15: 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>"
"cce-c-uses-allocators-traits-rejected.c", line 23: error: invalid text in pragma
        uses_allocators(traits(my_traits): my_alloc)
        ^
"cce-c-uses-allocators-traits-rejected.c", line 23: error: extra text after expected end of preprocessing directive
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
cce-c-uses-allocators-traits-rejected.c: In function ‘main’:
cce-c-uses-allocators-traits-rejected.c:23:22: sorry, unimplemented: ‘uses_allocators’ clause
   23 |       uses_allocators(traits(my_traits): my_alloc)
      |                      ^

Reproduce

CCE 19.0.0, MI300A unified

module load cce/19.0.0 craype-accel-amd-gfx942 rocm/6.4.3
module unload cray-mpich
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 20.0.2, MI300A unified

module load cce/20.0.2 craype-accel-amd-gfx942 rocm/6.4.3
module unload cray-mpich
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 21.0.3, MI300A unified

module load cce/21.0.3 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 21.0.4, MI300A unified

module load cce/21.0.4 craype-accel-amd-gfx942 rocm/7.2.0
module unload cray-mpich
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -fopenmp-version=52 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (67 lines)
// # Draft finding: omp52-c-clause-uses_allocators-traits on cce19
//
// - compiler: cce19
// - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
// - program: catalog omp52-c-clause-uses_allocators-traits (c, version 52, sha256 a5d4d553d629ef11)
// - expected: None (None; )
// - actual: rejected  (diagnostic: <tmpdir>/omp52-c-clause-uses_allocators-traits.c:33:23: error: call to undeclared function 'traits'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-de)
// - no control: the 5.0 spelling uses_allocators(my_alloc(my_traits)), once the check case's control (dropped), is an
//   internal compiler error on CCE 19, 20, 21.0.3 and 21.0.4 in both modes and on both GPUs, and AFAR rejects it as old
//   syntax (its rows: data/vendor/checks/results-compact, results-site, variant control), so it does not isolate the
//   rejection
// - verdict: compiler_bug by rule R11-compile-rejection: a legal program the compiler rejects with a diagnostic (or whose link fails on symbols the compiler's own code needs, or whose compile does not finish) while another compiler family compiles it
// - reason: 
// - citations: RUL-COMPILE-TIME (rulings.md)
// - legality: legal (legal by construction: offload.engine.gen / c_gen / acc_gen check every program against the catalog rules and the offload scope as it is built (no compiler))
// - witnesses: none
// - withdrawn: none
//
// 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;
}

Source in the repository

Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page

Expected and observed

Observed where it behaves incorrectly

cce-c-uses-allocators-traits-rejected.c:15:9: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
   15 |   const const omp_alloctrait_t my_traits[1] = {{omp_atk_alignment, 64}};
      |         ^
cce-c-uses-allocators-traits-rejected.c:23:23: error: call to undeclared function 'traits'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   23 |       uses_allocators(traits(my_traits): my_alloc)
      |                       ^
cce-c-uses-allocators-traits-rejected.c:23:40: error: expected ',' or ')' in 'uses_allocators' clause
   23 |       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.2 p.173

OpenMP 6.0 §8.2 p.306

Evidence

Other compilers run it correctly

AFAR 24.3.0