Observed issues › catalog/cce-c-ordered-link
ftn/craycc: constructs documented as unsupported in offload regions (single, masked, task, ordered, scan) give internal compiler errors or device link failures instead of a diagnostic
Legality: not independently confirmed. no independent review yet How this is checked
Same issue as cce19-target-parallel-single-ice; this program is another reproducer of it.
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 | correct | correct | correct | correct | correct | n/a | n/a |
| CCE 19.0.0 | not supported | not supported | not supported | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | not supported | not supported | not supported | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | not supported | not supported | not supported | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | not supported | not supported | not supported | 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 | correct | correct | correct | correct | correct | correct | 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 | CCE 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 | showUnknown KMPC: __kmpc_dispatch_init_4 Unknown KMPC: __kmpc_dispatch_next_4 Unknown KMPC: __kmpc_ordered Unknown KMPC: __kmpc_end_ordered Unknown KMPC: __kmpc_dispatch_fini_4 Unknown KMPC: __kmpc_dispatch_deinit Unknown KMPC: __kmpc_dispatch_init_4 Unknown KMPC: __kmpc_dispatch_next_4 |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed | showNVC++-F-1196-OpenMP - ordered is not supported in GPU region (cce-c-ordered-link.c: 31) NVC++/x86-64 Linux 25.11-0: compilation aborted |
| fails another way | NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showNVC++-F-1196-OpenMP - ordered is not supported in GPU region (cce-c-ordered-link.c: 31) NVC++/x86-64 Linux 26.9-0: compilation aborted |
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 (70 lines)
// # Draft finding: omp52-c-clause-ordered on cce19
//
// - compiler: cce19
// - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
// - program: catalog omp52-c-clause-ordered (c, version 52, sha256 2af75a6f949bff54)
// - expected: None (None; )
// - actual: rejected (link_undefined_symbol: lld: error: undefined symbol: __kmpc_dispatch_init_4)
// - verdict: compiler_bug by rule R10b-own-link-or-hang: a link failure on symbols the compiler's own generated code needs, or a compile that does not finish, on a legal program: the compiler's defect (never a rejection)
// - 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-ordered. Do not edit.
// id: omp52-c-clause-ordered
// primary atom: omp.clause.ordered
// legal: yes
// observable: yes
// ran_on_host: inside the target region of interest
// evidence: construct
// needs: none
// std: c11
#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 cnt;
int seq[n];
for (int i = 1; i <= n; i++) {
a[i - 1] = i;
b[i - 1] = 0;
ref[i - 1] = 2 * i + 1;
}
host_flag = 1;
cnt = 0;
for (int k1_ = 0; k1_ < n; k1_++)
seq[k1_] = -1;
#pragma omp target map(to: a) map(from: b) map(tofrom: cnt) map(from: seq) \
map(tofrom: host_flag)
{
host_flag = (omp_is_initial_device() ? 1 : 0);
#pragma omp parallel for default(none) shared(a, b, cnt, seq) ordered
for (int i = 1; i <= n; i++) {
b[i - 1] = 2 * a[i - 1] + 1;
#pragma omp ordered
{
cnt = cnt + 1;
seq[i - 1] = cnt;
}
}
}
bool t2_ = true;
for (int k3_ = 0; k3_ < n; k3_++)
t2_ = t2_ && (b[k3_] == ref[k3_]);
bool t4_ = true;
for (int k5_ = 0; k5_ < n; k5_++)
t4_ = t4_ && (2 * seq[k5_] + 1 == ref[k5_]);
ok = t2_ && t4_;
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
Observed where it behaves incorrectly
Unknown KMPC: __kmpc_dispatch_init_4 Unknown KMPC: __kmpc_dispatch_next_4 Unknown KMPC: __kmpc_ordered Unknown KMPC: __kmpc_end_ordered Unknown KMPC: __kmpc_dispatch_fini_4 Unknown KMPC: __kmpc_dispatch_deinit Unknown KMPC: __kmpc_dispatch_init_4 Unknown KMPC: __kmpc_dispatch_next_4
What the specification requires
The specification text this program relies on and the compiler is expected to support.
The same requirement as the issue cce19-target-parallel-single-ice.
OpenMP 5.2 §11.1 p.241 l.2-3
The single construct specifies that the associated structured block is executed by only one of the threads in the team
OpenMP 5.2 §11.1 p.241 l.5-6
An implicit barrier occurs at the end of a single region if the nowait clause is not specified.
Evidence
Same compiler, one change
- the same parallel for on the host (the target directive removed): AFAR 24.3.0: correct; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
Control program
#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 cnt; int seq[n]; for (int i = 1; i <= n; i++) { a[i - 1] = i; b[i - 1] = 0; ref[i - 1] = 2 * i + 1; } host_flag = 1; cnt = 0; for (int k1_ = 0; k1_ < n; k1_++) seq[k1_] = -1; { host_flag = (omp_is_initial_device() ? 1 : 0); #pragma omp parallel for default(none) shared(a, b, cnt, seq) ordered for (int i = 1; i <= n; i++) { b[i - 1] = 2 * a[i - 1] + 1; #pragma omp ordered { cnt = cnt + 1; seq[i - 1] = cnt; } } } bool t2_ = true; for (int k3_ = 0; k3_ < n; k3_++) t2_ = t2_ && (b[k3_] == ref[k3_]); bool t4_ = true; for (int k5_ = 0; k5_ < n; k5_++) t4_ = t4_ && (2 * seq[k5_] + 1 == ref[k5_]); ok = t2_ && t4_; printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail"); return 0; }
Other compilers run it correctly
AFAR 24.3.0, GCC 16.2.0