OffTarget

Observed issues › harvest/cce-ftn-target-parallel-thread-query-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

ftn: internal compiler error ("Could not find call") when a target parallel region assigns omp_get_num_threads() or omp_get_thread_num()

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.2behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlyunknown
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
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..
   Error message      ::  Could not find call
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_acc_dataplacement.c', line 4289
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  site-harvest--cce-ftn-target-parallel-thread-query-ice.f90
   Function           ::  tp_guarded
behaves incorrectlyCCE 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..
   Error message      ::  Could not find call
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_acc_dataplacement.c', line 4343
   Initiated from     ::  Line 1859 (v_main.c)
   Optimizer built    ::  2025-11-17 (production)
   File               ::  site-harvest--cce-ftn-target-parallel-thread-query-ice.f90
   Function           ::  tp_guarded
behaves incorrectlyCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
show
Warning:
 Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
   Error message      ::  Could not find call
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_acc_dataplacement.c', line 4378
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-07-14 (production)
   File               ::  site-harvest--cce-ftn-target-parallel-thread-query-ice.f90
   Function           ::  tp_guarded
behaves incorrectlyCCE 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..
   Error message      ::  Could not find call
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_acc_dataplacement.c', line 4378
   Initiated from     ::  Line 1939 (v_main.c)
   Optimizer built    ::  2026-09-24 (production)
   File               ::  site-harvest--cce-ftn-target-parallel-thread-query-ice.f90
   Function           ::  tp_guarded

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 (63 lines)
! # Finding: CCE ftn ICE "Could not find call"
! # (v_acc_dataplacement.c) when a target parallel region assigns the result
! # of omp_get_num_threads() or omp_get_thread_num()
!
! - compilers: CCE ftn 19.0.0, 20.0.2, 21.0.3, -O2: this file on MI300A
!   gfx942 (HSA_XNACK 0 and 1); its variants on MI250X gfx90a (19.0.0,
!   21.0.3); the upstream test on gfx942 (both modes) and gfx90a (gate
!   confirmed)
! - expected: compiles; prints x= <the team's size> (at least 1)
! - actual: ftn: INTERNAL COMPILER ERROR: "Could not find call"
!   (/workspace/crayftn/pdgcs/v_acc_dataplacement.c, line 4289 in 19.0.0,
!   4343 in 20.0.2, 4378 in 21.0.3) (results/harvest/probe/f6.jsonl,
!   findings_gfx942.jsonl)
! - rule: a legal program (OpenMP 5.2 §10.1 parallel, §18.2.2
!   omp_get_num_threads, §18.2.4 omp_get_thread_num; both routines are
!   among the five CCE documents as supported in offload regions:
!   intro_openmp, data/index/claims/hpe-cce-21.0.3-intro_openmp.txt). An ICE
!   is a compiler bug.
! - conditions (each a one-change variant, CCE 19.0.0 and 21.0.3): the same
!   ICE with x = omp_get_thread_num(); with the result assigned to a private
!   n, then x = n; with `target` and a nested `parallel` instead of the
!   combined construct; with x an array element; with map(tofrom: x); with
!   `use omp_lib, only: ...`; in a main program or a subroutine, with or
!   without SAVE. No ICE: `x = 7` (no call); a call in an IF condition only
!   (`if (omp_get_thread_num() == 0) then` ..., as in
!   cce19-target-parallel-guarded-loop.f90); `target teams` with
!   x = omp_get_num_teams() (x= 220).
! - other families: AFAR amdflang compiles and runs it (x= 256, gfx942 at
!   HSA_XNACK 0 and 1; parallel = T on the upstream test); NVHPC nvfortran
!   25.11 and 26.9 compile and run it (x= 13824, A100, separate and
!   managed).
! - upstream: llvm-project offload/test/offloading/fortran/
!   basic-target-parallel-region.f90 (CCE ICE on every CCE cell, gate
!   confirmed on gfx90a); AOMP test/smoke/flang-313307-simple-spmd hits the
!   same ICE.
! - legality: offload.engine.prerun.check accepts it (the rules with the race
!   rule, and the AFAR flang front end); only thread 0 writes x.
! CCE:  ftn -fopenmp -O2 (module load cce/<v> craype-accel-amd-gfx942 rocm/<r>;
!       module unload cray-mpich)
! Run:  OMP_TARGET_OFFLOAD=mandatory ./a.out
program tp_guarded
   use omp_lib
   implicit none
   integer :: x, on_host
   x = -1
   on_host = 1
   !$omp target map(from: on_host)
   if (omp_is_initial_device()) then
     on_host = 1
   else
     on_host = 0
   end if
   !$omp end target
   !$omp target parallel map(from: x)
   if (omp_get_thread_num() == 0) x = omp_get_num_threads()
   !$omp end target parallel
   print '(a,i0)', 'x= ', x
   if (x >= 1) then
     print '(a,i0,a)', 'RESULT ran_on_host=', on_host, ' check=pass'
   else
     print '(a,i0,a)', 'RESULT ran_on_host=', on_host, ' check=fail'
   end if
end program tp_guarded

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

x= 

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..
   Error message      ::  Could not find call
   Error detected     ::  File '/workspace/crayftn/pdgcs/v_acc_dataplacement.c', line 4289
   Initiated from     ::  Line 1849 (v_main.c)
   Optimizer built    ::  2025-02-07 (production)
   File               ::  site-harvest--cce-ftn-target-parallel-thread-query-ice.f90
   Function           ::  tp_guarded

What the specification requires

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

OpenMP 5.2 §10.1

OpenMP 5.2 §18.2.2

OpenMP 5.2 §18.2.4

Evidence

Other compilers run it correctly

AFAR 24.3.0, NVHPC 25.11, NVHPC 26.9, GCC 16.2.0