OffTarget

Observed issues › harvest/cce-named-constant-array-declare-target-routine-rejected

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

ftn rejects a module's named-constant array referenced in a declare target routine

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

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.0correctcorrectunknown
not run
correctcorrectn/an/a
CCE 19.0.0not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportedunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportedunknown
not run
unknown
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
show
Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
    x = c(i)
ftn-7066 ftn: ERROR PICK, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
ftn-7066 ftn: ERROR PICK$VPA_M__CCE$OMP_REDUN_CLONE, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
Cray Fortran : 64 source lines
not supportedCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
    x = c(i)
ftn-7066 ftn: ERROR PICK, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
ftn-7066 ftn: ERROR PICK$VPA_M__CCE$OMP_REDUN_CLONE, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
Cray Fortran : 64 source lines
not supportedCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
    x = c(i)
ftn-7066 ftn: ERROR PICK, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
ftn-7066 ftn: ERROR PICK$VPA_M__CCE$OMP_REDUN_CLONE, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
Cray Fortran : 64 source lines
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-W-0016-Identifier, struct_STATICS2_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c..., truncate
NVFORTRAN-W-0016-Identifier, struct_BSS2_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c0f4d..., truncate
NVFORTRAN-W-0016-Identifier, struct_STATICS3_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c..., truncate
NVFORTRAN-W-0016-Identifier, struct_BSS3_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c0f4d..., truncate
NVFORTRAN-W-0016-Identifier, struct_STATICS1_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c..., truncate
NVFORTRAN-W-0016-Identifier, struct_BSS1_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c0f4d..., truncate
  0 inform,   2 warnings,   0 severes, 0 fatal for vpa_m
NVFORTRAN-W-0016-Identifier, struct_STATICS2_261a11241b5c231b023504101966501a305e0b205b512644173f1917402a5d0d78121733574d6f0d11331b05462e1e0d340102244219300601241e0a5166411c3f16063553506c..., truncate
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
show
site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90:36:25: error: variable ‘c’ has been referenced in offloaded code but hasn’t been marked to be included in the offloaded code
   36 |   real(8), parameter :: c(2) = [1.5d0, 2.5d0]
      |                         ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
gcn mkoffload: fatal error: <home>/gcc-16.2/bin/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: <home>/gcc-16.2/libexec/gcc/x86_64-pc-linux-gnu/16.2.0//accel/amdgcn-amdhsa/mkoffload returned 1 exit status
fails another wayGCC 16.2.0, MI250X
show
site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90:34:25: error: variable ‘c’ has been referenced in offloaded code but hasn’t been marked to be included in the offloaded code
   34 |   real(8), parameter :: c(2) = [1.5d0, 2.5d0]
      |                         ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
gcn mkoffload: fatal error: <home>/gcc-16.2/bin/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: <home>/gcc-16.2/libexec/gcc/x86_64-pc-linux-gnu/16.2.0//accel/amdgcn-amdhsa/mkoffload returned 1 exit status
fails another wayGCC 16.2.0, MI300X
GCC 16.2.0, MI350X
show
site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90:36:25: error: variable ‘c’ has been referenced in offloaded code but hasn’t been marked to be included in the offloaded code
   36 |   real(8), parameter :: c(2) = [1.5d0, 2.5d0]
      |                         ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
gcn mkoffload: fatal error: <home>/<user>/gcc-16.2/bin/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: <home>/<user>/gcc-16.2/libexec/gcc/x86_64-pc-linux-gnu/16.2.0//accel/amdgcn-amdhsa/mkoffload returned 1 exit status
fails another wayGCC 16.2.0, A100 separate
show
site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90:34:25: error: variable ‘c’ has been referenced in offloaded code but hasn’t been marked to be included in the offloaded code
   34 |   real(8), parameter :: c(2) = [1.5d0, 2.5d0]
      |                         ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
nvptx mkoffload: fatal error: <home>/gcc-16.2/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: <home>/gcc-16.2/libexec/gcc/x86_64-pc-linux-gnu/16.2.0//accel/nvptx-none/mkoffload returned 1 exit status

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
ftn -fopenmp -O2 repro.f90 -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
ftn -fopenmp -O2 repro.f90 -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
ftn -fopenmp -O2 repro.f90 -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
ftn -fopenmp -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (66 lines)
! # Finding (known-issues harvest): CCE rejects a module's named-constant array
!   referenced in a declare target routine
!
! - source: holdout (a case of the known-issues harvest, held out); this file is the
!   minimal form (data/reports/harvest-known/v-param-array-routine.f90)
! - compilers: CCE 19.0.0, 20.0.2, 21.0.3 (ftn -fopenmp), gfx942 and gfx90a
! - expected: the program compiles and prints RESULT ... check=pass: pick returns c(i), a
!   module named constant [1.5, 2.5]
! - actual: "ftn-7066 ftn: ERROR PICK ... Unsupported accelerator code error: Global in
!   accelerator routine without declare -- c" on every CCE release and both architectures. HPE
!   lists CAST-36609 ("ftn-7066 ... Global in accelerator routine without declare") as resolved
!   in CCE 19.0.0 (data/index/claims/hpe-cce-19.0.0-release_info.txt line 114); this trigger remains
! - control (same compiler): passes with a scalar named constant in the routine
!   (c-param-scalar-routine.f90), with the array a named constant of the routine itself
!   (c-param-array-local.f90), and with the array indexed in the target region itself
!   (c-param-array-region-only.f90); all in data/reports/harvest-known/
! - other families: AFAR compiles and runs it (check=pass); NVHPC 25.11 and 26.9 reject it too
!   (harvest/nvhpc-named-constant-array-declare-target-routine-rejected.f90)
! - legality: Fortran named constants are not variables; OpenMP 5.2's declare target
!   requirement covers variables only: "A variable referenced in a target region but not the
!   target construct that is not declared in the target region must appear in a declare target
!   directive" (§13.8 p.286 l.31-32), and named constants are predetermined shared (§5.1.1 p.98
!   l.11: "Assumed-size arrays and named constants are shared"); a named constant is a list
!   item only "in clauses where it is explicitly allowed" (§3.2.1 p.61 l.10), and declare
!   target's clauses do not name it. The pre-run check (rules and the AFAR front end) accepts the
!   program
! - the OpenACC form (routine seq; hk-015) fails the same way on CCE, but OpenACC 3.4
!   §2.15.2 p.98 l.3623-3625 asks a declare directive for "Fortran module ... variables or arrays"
!   used in accelerator routines, which may cover a named-constant array: not claimed here
! - evidence: results/harvest-known/main.tioga (gate: confirmed), main (Tuolumne),
!   the MI250X probe runs' output (results/harvest-known/logs/tioga/probe.f656gDkdAd9R.log and
!   probe.f656iLRSBypT.log; their rows file probes.tioga.jsonl was not kept); the three controls on CCE 19/20/21, both modes:
!   results/findings-baseline/harvest-cparam-controls.cce.jsonl
module vpa_m
  implicit none
  real(8), parameter :: c(2) = [1.5d0, 2.5d0]
contains
  subroutine pick(i, x)
    !$omp declare target
    integer, intent(in) :: i
    real(8), intent(out) :: x
    x = c(i)
  end subroutine pick
end module vpa_m

program vpa
  use omp_lib
  use vpa_m
  implicit none
  integer :: k, bad, hk_host
  real(8) :: r(100)
  r = 0
  !$omp target teams distribute parallel do map(from: r)
  do k = 1, 100
    call pick(1 + mod(k, 2), r(k))
  end do
  bad = 0
  do k = 1, 100
    if (r(k) /= c(1 + mod(k, 2))) bad = bad + 1
  end do
  hk_host = 1
  !$omp target map(tofrom: hk_host)
  if (.not. omp_is_initial_device()) hk_host = 0
  !$omp end target
  print '(a,i0,a,a)', 'RESULT ran_on_host=', hk_host, ' check=', merge('pass', 'fail', bad == 0)
end program vpa

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

Expected

check=pass

Observed where it behaves incorrectly

Warning:
 Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
    x = c(i)
ftn-7066 ftn: ERROR PICK, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
ftn-7066 ftn: ERROR PICK$VPA_M__CCE$OMP_REDUN_CLONE, File = site-harvest--cce-named-constant-array-declare-target-routine-rejected.f90, Line = 40 
  Unsupported accelerator code error: Global in accelerator routine without declare -- c
Cray Fortran : 64 source lines

What the specification requires

The specification text this program relies on and the compiler is expected to support.

OpenMP 5.2 §13.8 p.286 l.31-32

A variable referenced in a target region but not the target construct that is not declared in the target region must appear in a declare target directive

OpenMP 5.2 §5.1.1 p.98 l.11

Assumed-size arrays and named constants are shared

OpenMP 5.2 §3.2.1 p.61 l.10

in clauses where it is explicitly allowed

OpenACC 3.4 §2.15.2 p.98 l.3623-3625

Evidence

Other compilers run it correctly

AFAR 24.3.0