OffTarget

Observed issues › fuzz/s1-9914-cce19

Appears to behave incorrectlyCompiler hangs · Fortran · OpenMP · Fixed in 20.0.2

ftn 19 does not finish compiling target regions with map(always, tofrom:) of a structure component and a depend on a declare target array

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.0behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectunknown
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.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
behaves incorrectlyCCE 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..
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0533-Clause 'THREAD_LIMIT' not allowed in OMP TARGET (s1-9914-cce19.f90: 25)
  0 inform,   0 warnings,   1 severes, 0 fatal for fuzz_prog

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

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 (73 lines)
! Finding: CCE 19 does not finish compiling this program (killed
! after 300 s; the campaign's limit was 600 s), while CCE 20, CCE 21 and
! AFAR compile it in seconds. The kernels: target constructs with
! map(always, tofrom:) of a structure component and thread_limit, and a
! target with a depend(out: go2(:)) on a declare target module array, in a
! bundle with a default declare mapper and a submodule.
!
! A compile that does not finish is the compiler's defect whatever the
! program (RUL-COMPILE-TIME); the program passed the fuzz legality checks
! (offload.engine.rules, gfortran -std=f2008, AFAR flang's front end).
!
! Observed (tuolumne, -O2, 2026-10-23, results/t28_probe/hangv.log): CCE
! 19.0.0 compile timeout; CCE 20.0.2, 21.0.3 and AFAR compile. Fuzz
! campaign s1: the CCE 19 compile timeouts (93 cells in s1 and s1x0; every
! one of those programs has target nowait with depend). Representative s1
! seed 9914, reduced by deleting while the CCE 19 compile still ran after
! 60 s (data/evidence/dataenv_probe/min_hang.py; 191 -> 99 lines).
!
! Fix: reduced further by line, clause and
! list-item deletion while the CCE 19 compile still ran after 90 s
! (data/evidence/dataenv_probe/min_ice.py with the compile-timeout oracle, 83 -> 34
! lines, results/t28_probe/short/; each kept candidate timed out). What
! remains: an empty target with thread_limit(1), an empty target with
! depend(out: go2(:)) on a declare target module array, and a module
! procedure in a submodule; CCE 20 compiles it in 5 s, CCE 21 in 10 s,
! AFAR in 2 s. (The reduction's empty fuzz_ext.f90, a translation unit of
! its own, is left out here.)
!
! ftn -fopenmp -O2 (a bundle: !@file marks start the files)
!@file fuzz_dmod.f90
module fuzz_dmod
  implicit none
  integer, parameter :: nm = 48
  integer :: go2(nm)
  !$omp declare target to(go2)
end module fuzz_dmod
!@file fuzz_smod.f90
module fuzz_smod
  implicit none
  interface
    module integer function gs1(x)
      integer, intent(in) :: x
    end function gs1
  end interface
end module fuzz_smod
!@file fuzz_ssub.f90
submodule (fuzz_smod) fuzz_ssub
  implicit none
contains
  module integer function gs1(x)
    integer, intent(in) :: x
  end function gs1
end submodule fuzz_ssub
!@file fuzz_prog.f90
program fuzz_prog
  use fuzz_dmod
  implicit none
  !$omp target thread_limit(1)
  !$omp end target
  !$omp target depend(out: go2(:))
  !$omp end target
end program fuzz_prog
! spec (requirement): a target construct accepts a depend clause (with an array section as list item) that is associated with
!   the target task, and a thread_limit clause that bounds the threads of the contention group; the specification says nothing
!   about compile time, so the requirement that these constructs are compiled at all is only implied.
! "The target construct generates a target task. The generated task region encloses the target region. If a depend clause is
!   present, it is associated with the target task. The device clause determines the device on which the target region executes.
!   If the nowait clause is present," (5.2 §13.8 p.284 l.14-16)
! "If the thread_limit clause is specified, the number of threads will be less than or equal to threadlim. Otherwise, if the"
!   (5.2 §13.3 p.277 l.19-20)
! spec (this program): an empty target with thread_limit(1) and an empty target with depend(out: go2(:)) on a declare target
!   module array are legal constructs; CCE 19 does not finish compiling the program (killed after 300 s), CCE 20, CCE 21 and AFAR
!   compile it in seconds.

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/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..

What the specification requires

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

OpenMP 5.2 §13.8 p.284 l.14-16

The target construct generates a target task. The generated task region encloses the target region. If a depend clause is present, it is associated with the target task. The device clause determines the device on which the target region executes. If the nowait clause is present,

OpenMP 5.2 §13.3 p.277 l.19-20

If the thread_limit clause is specified, the number of threads will be less than or equal to threadlim. Otherwise, if the

Evidence

Same compiler, one change

  • thread_limit(1) removed from the first target: 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
    module fuzz_dmod
      implicit none
      integer, parameter :: nm = 48
      integer :: go2(nm)
      !$omp declare target to(go2)
    end module fuzz_dmod
    module fuzz_smod
      implicit none
      interface
        module integer function gs1(x)
          integer, intent(in) :: x
        end function gs1
      end interface
    end module fuzz_smod
    submodule (fuzz_smod) fuzz_ssub
      implicit none
    contains
      module integer function gs1(x)
        integer, intent(in) :: x
      end function gs1
    end submodule fuzz_ssub
    program fuzz_prog
      use fuzz_dmod
      implicit none
      !$omp target
      !$omp end target
      !$omp target depend(out: go2(:))
      !$omp end target
    end program fuzz_prog
    

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0