OffTarget

Observed issues › fuzz/s1-91-cce21

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

ftn: default(none) on a parallel construct in one internal subroutine makes a variable of another subroutine's target region an error (ftn-1510)

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.0fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayunknown
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/acorrectcorrect
NVHPC 26.9n/an/an/an/an/acorrectcorrect
GCC 16.2.0correctcorrectcorrectcorrectcorrectcorrectn/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 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..
        hf2 = merge(1, 0, omp_is_initial_device())
        ^                                          
ftn-1510 ftn: ERROR KP2, File = s1-91-cce21-orig.f90, Line = 35, Column = 9 
  Variable "HF2" must have its data scope explicitly declared because DEFAULT(NONE) was specified.
fails another wayCCE 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..
MT_CONTEXT_MASTER
   Error message      ::  unhandled construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 7617
   Initiated from     ::  Line 660 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  s1-91-cce21-orig.f90
fails another wayCCE 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..
MT_CONTEXT_MASKED
   Error message      ::  unhandled acc construct type
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_openmp.c', line 7881
   Initiated from     ::  Line 660 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  s1-91-cce21-orig.f90

Reproduce

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 (84 lines)
! Finding: CCE 21 (and CCE 19/20 in the campaign) reports ftn-1510
! "Variable "HF2" must have its data scope explicitly declared because
! DEFAULT(NONE) was specified" for an assignment in a target region of the
! internal subroutine kp2, which has no default clause anywhere: the
! default(none) is on an (empty) parallel construct in a sibling internal
! subroutine kp1.
!
! Legal OpenMP 5.2: default(none) restricts only "each variable that is
! referenced in the construct" (5.2 §5.4.1 p.109); hf2 is referenced only
! in kp2's target region, which has no default clause. Legality: offload.engine.prerun.check accepts it
! (rerun: offload.engine.rules with the race rule and the restriction checks, and the AFAR
! flang front end, not under test here); no compiler under test, gfortran or gcc is a legality
! witness. (CCE also has the known ICE for masked in a target
! region, cce19-target-parallel-single-ice.f90; this diagnostic comes
! first.)
!
! : hand reductions that drop the unused module, types
! and dummies no longer show ftn-1510, and the program also needs the masked
! construct, which CCE documents as unsupported in offload regions; the vendor
! packet uses this generated program.
!
! Observed (tuolumne, -O2, 2026-10-23): CCE 21.0.3 ftn-1510 for HF2 at
! the assignment. Fuzz campaign s1: the ftn-1510 cells of CCE 19/20/21 for
! variables other than a loop's iteration variable (decision D3; R11 where
! AFAR compiles). Representative s1 seed 91 (cce21, copy mode; compile
! only): the confirmer's reduction (results/confirm/drafts/
! fuzz_s1_91_cce21_gfx942_copy, 223 -> 148 lines) reduced further by
! deleting lines while the diagnostic stays (data/evidence/dataenv_probe/min_ice.py,
! 148 -> 61 lines). A hand-written two-subroutine form without the
! structure maps compiles (it ICEs on the masked construct instead), so
! the trigger is not reduced further.
!
! Fix: the empty fuzz_ext file is gone and the
! program is reduced further by clause and list-item deletion as well as
! lines (data/evidence/dataenv_probe/min_ice.py, 61 -> 41 lines, results/t28_probe/
! short/): kp1 holds an empty parallel default(none) in a target region,
! its sibling kp2 a target region whose masked construct assigns hf2; CCE
! 21 reports ftn-1510 for HF2, CCE 19 and 20 stop earlier at their ICE for
! masked in a target region (results/t28_probe/icev_fr1.log); AFAR
! compiles it. kp2's unused dummies stay because min_ice does not edit
! argument lists.
!
! ftn -fopenmp -O2 (a bundle: 
!@file fuzz_dmod.f90
module fuzz_dmod
  implicit none
  type :: mt_t
  end type mt_t
end module fuzz_dmod
!@file fuzz_prog.f90
program fuzz_prog
  use omp_lib, only: omp_is_initial_device
  use fuzz_dmod
  implicit none
  type :: rec_t
  end type rec_t
  type(rec_t) :: dr
  integer :: hf2
  !$omp target data map(tofrom: dr)
  !$omp end target data
contains
  subroutine kp1(dr)
    type(rec_t), intent(inout) :: dr
    !$omp target 
      !$omp parallel default(none)
      !$omp end parallel
    !$omp end target
  end subroutine kp1
  subroutine kp2(ia, ic, xk1, xr8, dr, ms, p2)
    integer, intent(inout) :: ia(:)
    integer, allocatable, intent(inout) :: ic(:, :)
    integer(kind=1), intent(inout) :: xk1(:)
    real(kind=8), intent(in) :: xr8(:)
    type(rec_t), intent(inout) :: dr
    type(mt_t), intent(inout) :: ms
    integer, intent(in), optional :: p2
    !$omp target &
    !$omp& map(tofrom: hf2)
      !$omp masked
        hf2 = merge(1, 0, omp_is_initial_device())
      !$omp end masked
    !$omp end target
  end subroutine kp2
end program fuzz_prog

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

Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
        hf2 = merge(1, 0, omp_is_initial_device())
        ^                                          
ftn-1510 ftn: ERROR KP2, File = s1-91-cce21-orig.f90, Line = 35, Column = 9 
  Variable "HF2" must have its data scope explicitly declared because DEFAULT(NONE) was specified.

What the specification requires

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

OpenMP 5.2 §5.4.1 p.109

each variable that is referenced in the construct

Evidence

Same compiler, one change

  • default(none) removed from the empty parallel construct of kp1 (the ftn-1510 for HF2 goes away; CCE then stops at the masked construct, documented as unsupported in offload regions): AFAR 24.3.0: fails another way; CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct
    Control program
    module fuzz_dmod
      implicit none
      type :: mt_t
      end type mt_t
    end module fuzz_dmod
    program fuzz_prog
      use omp_lib, only: omp_is_initial_device
      use fuzz_dmod
      implicit none
      type :: rec_t
      end type rec_t
      type(rec_t) :: dr
      integer :: hf2
      !$omp target data map(tofrom: dr)
      !$omp end target data
    contains
      subroutine kp1(dr)
        type(rec_t), intent(inout) :: dr
        !$omp target
          !$omp parallel
          !$omp end parallel
        !$omp end target
      end subroutine kp1
      subroutine kp2(ia, ic, xk1, xr8, dr, ms, p2)
        integer, intent(inout) :: ia(:)
        integer, allocatable, intent(inout) :: ic(:, :)
        integer(kind=1), intent(inout) :: xk1(:)
        real(kind=8), intent(in) :: xr8(:)
        type(rec_t), intent(inout) :: dr
        type(mt_t), intent(inout) :: ms
        integer, intent(in), optional :: p2
        !$omp target &
        !$omp& map(tofrom: hf2)
          !$omp masked
            hf2 = merge(1, 0, omp_is_initial_device())
          !$omp end masked
        !$omp end target
      end subroutine kp2
    end program fuzz_prog
    

Other compilers run it correctly

AFAR 24.3.0, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0