Observed issues › catalog/cce21-c-declare-target-local-rejected
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
| 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 | fails another way | fails another way | fails another way | fails another way | fails another way | fails another way | 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 | showcce21-c-declare-target-local-rejected.c:8:28: error: unexpected 'local' clause, only 'enter', 'link', 'device_type' or 'indirect' clauses expected
8 | #pragma omp declare target local(dv)
| ^
cce21-c-declare-target-local-rejected.c:8:21: error: expected at least one 'enter', 'link' or 'indirect' clause
8 | #pragma omp declare target local(dv)
| ^
2 errors generated. |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | show"cce21-c-declare-target-local-rejected.c", line 8: error: invalid text in pragma
#pragma omp declare target local(dv)
^
"cce21-c-declare-target-local-rejected.c", line 8: error: extra text after expected end of preprocessing directive
#pragma omp declare target local(dv)
^
2 errors detected in the compilation of "cce21-c-declare-target-local-rejected.c". |
| fails another way | GCC 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 | showcce21-c-declare-target-local-rejected.c:8:28: error: expected an OpenMP clause before ‘local’
8 | #pragma omp declare target local(dv)
| ^~~~~ |
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=60 -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=60 -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=60 -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=60 -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=60 -fopenmp-version=60 -O2 repro.c -o repro HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (67 lines)
// # Draft finding: omp60-c-clause-local on cce21
//
// - compiler: cce21
// - toolchain: cce21; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
// - program: catalog omp60-c-clause-local (c, version 60, sha256 17d280d2796527ad)
// - expected: None (None; )
// - actual: rejected (diagnostic: <tmpdir>/omp60-c-clause-local.c:17:28: error: unexpected 'local' clause, only 'enter', 'link', 'device_type' or 'indirect' clauses expected)
// - 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 6.0, C11): the C port (offload.engine.f2c) of omp60-clause-local. Do not edit.
// id: omp60-c-clause-local
// primary atom: omp.clause.local
// 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 dv = 1;
int dw = 1;
#pragma omp declare target local(dv)
int f(int x) {
int r_;
r_ = 2 * x + 1;
return r_;
}
int main(void) {
int a[n];
int b[n];
int ref[n];
int host_flag;
bool ok;
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
{
dv = 5;
}
#pragma omp target map(to: a) map(from: b) map(tofrom: host_flag)
{
host_flag = (omp_is_initial_device() ? 1 : 0);
for (int i = 1; i <= n; i++) {
b[i - 1] = 2 * a[i - 1] + dv - 4;
}
}
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
Observed where it behaves incorrectly
cce21-c-declare-target-local-rejected.c:8:28: error: unexpected 'local' clause, only 'enter', 'link', 'device_type' or 'indirect' clauses expected
8 | #pragma omp declare target local(dv)
| ^
cce21-c-declare-target-local-rejected.c:8:21: error: expected at least one 'enter', 'link' or 'indirect' clause
8 | #pragma omp declare target local(dv)
| ^
2 errors generated.What the specification requires
The specification text this program relies on and the compiler is expected to support.
The same requirement as the issue catalog/cce-c-map-iterator-ice.
OpenMP 5.2 §3.2.6 p.67 l.6-8
An iterator modifier is a unique, complex modifier that defines a set of iterators, each of which is an iterator-identifier and an associated set of values.
OpenMP 5.2 §5.8.3 p.151 l.13-14
A list item in a map clause may reference any iterator-identifier defined in its iterator modifier.
Evidence
Same compiler, one change
- declare target enter(dv) instead of local(dv): 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 dv = 1; int dw = 1; #pragma omp declare target enter(dv) int f(int x) { int r_; r_ = 2 * x + 1; return r_; } int main(void) { int a[n]; int b[n]; int ref[n]; int host_flag; bool ok; 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 { dv = 5; } #pragma omp target map(to: a) map(from: b) map(tofrom: host_flag) { host_flag = (omp_is_initial_device() ? 1 : 0); for (int i = 1; i <= n; i++) { b[i - 1] = 2 * a[i - 1] + dv - 4; } } 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; }
Other compilers run it correctly
AFAR 24.3.0