Observed issues › catalog/cce-allocators-stack-ice
Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open
ftn: internal compiler error "Too few arguments on the stack" for uses_allocators with an allocate clause in a target region
Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked
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 | fails another way | fails another way | fails another way | fails another way | fails another way | n/a | n/a |
| CCE 19.0.0 | behaves incorrectly | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | behaves incorrectly | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | behaves incorrectly | behaves incorrectly | behaves incorrectly | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | behaves incorrectly | behaves incorrectly | behaves incorrectly | 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 | correct | correct | correct | correct | correct | correct | 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 |
|---|---|---|
| behaves incorrectly | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy CCE 19.0.0, MI250X | showWarning:
Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable..
*** Expected 2 arguments but only 1 on stack
Contents of the expression stack:
---TOP---
omp_is_initial_device_()
---BOT---
*** error *** |
| behaves incorrectly | CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy CCE 20.0.2, MI250X | showWarning:
Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable..
*** Expected 2 arguments but only 1 on stack
Contents of the expression stack:
---TOP---
omp_is_initial_device_()
---BOT---
*** error *** |
| behaves incorrectly | 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 | showWarning:
Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable..
*** Expected 2 arguments but only 1 on stack
Contents of the expression stack:
---TOP---
omp_is_initial_device_()
---BOT---
*** error *** |
| fails another way | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI250X AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showerror: loc("cce-allocators-stack-ice.f90":18:10): /__w/TheRock/TheRock/compiler/amd-llvm/flang/lib/Lower/OpenMP/OpenMP.cpp:8211: not yet implemented: USES_ALLOCATORS clause is not implemented yet
LLVM ERROR: aborting |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showNVFORTRAN-S-0034-Syntax error at or near identifier uses_allocators (cce-allocators-stack-ice.f90: 17) NVFORTRAN-S-0034-Syntax error at or near identifier allocate (cce-allocators-stack-ice.f90: 20) 0 inform, 0 warnings, 2 severes, 0 fatal for gen_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
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
GCC 16.2.0, MI300A unified (runs correctly)
export LD_LIBRARY_PATH=$GCC_16_2/lib64:/opt/rocm-7.2.1/lib $GCC_16_2/bin/gfortran -fopenmp -foffload=amdgcn-amdhsa -foffload-options=amdgcn-amdhsa=-march=gfx942 -O2 repro.f90 -o repro HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (74 lines)
! # Draft finding: omp52-clause-uses_allocators on cce19
!
! - compiler: cce19
! - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-clause-uses_allocators (f90, version 52, sha256 52f8be7d9bfe1f86)
! - expected: None (None; )
! - actual: ice (ice: INTERNAL COMPILER ERROR: "Too few arguments on the stack" (/workspace/crayftn/pdgcs/v_fei.c, line 11730,
! version cc4d36e4ff3377d45f0e6e892b5dacd82009a0ca))
! - verdict: compiler_bug by rule R10-compile-ice: an internal compiler error (or the compiler rejecting code it generated) on a
! legal program: always the compiler's defect
! - 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.gen (OpenMP 5.2, free-form Fortran). Do not edit.
! id: omp52-clause-uses_allocators
! primary atom: omp.clause.uses_allocators
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
program gen_prog
use omp_lib, only: omp_default_mem_alloc, omp_is_initial_device
implicit none
integer, parameter :: n = 64
integer, allocatable, target :: a(:), b(:)
integer :: ref(n)
integer :: i, host_flag
logical :: ok
integer :: t
allocate(a(n), b(n))
do i = 1, n
a(i) = i
b(i) = 0
ref(i) = 2*i + 1
end do
host_flag = 1
!$omp target map(to: a) map(from: b) map(tofrom: host_flag) &
!$omp& uses_allocators(omp_default_mem_alloc)
host_flag = merge(1, 0, omp_is_initial_device())
!$omp parallel do default(none) shared(a, b) private(t) allocate(omp_default_mem_alloc: t)
do i = 1, n
t = 2*a(i)
b(i) = t + 1
end do
!$omp end parallel do
!$omp end target
ok = all(b == ref)
print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
deallocate(a, b)
end program gen_prog
! spec (requirement): uses_allocators makes a predefined allocator available for use in the region of the target
! construct.
! "The uses_allocators clause enables the use of the specified allocator in the region associated with the directive
! on which the clause appears. If allocator refers to a predefined allocator, that predefined allocator will be
! available for use in the region." (5.2 §6.8 p.182 l.2-4)
! spec (requirement): An allocate clause naming that allocator provides the storage for a list item that a
! data-sharing clause privatizes on the same directive.
! "If a list item in the clause also appears in a data-sharing attribute clause on the same directive that privatizes
! the list item, allocations that arise from that list item in the clause will be provided by the memory allocator."
! (5.2 §6.6 p.178 l.12-14)
! spec (requirement): An allocator used in a target region by an allocate clause must appear in uses_allocators, as it
! does here.
! "Memory allocators that do not appear in a uses_allocators clause cannot appear as an allocator in an allocate
! clause or be used in the target region" (5.2 §13.8 p.286 l.38-39)
! spec (this program): uses_allocators(omp_default_mem_alloc) on target and allocate(omp_default_mem_alloc: t) with
! private(t) on the enclosed parallel do satisfy those rules; ftn stops with an internal error (Too few arguments on
! the stack).
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..
*** Expected 2 arguments but only 1 on stack
Contents of the expression stack:
---TOP---
omp_is_initial_device_()
---BOT---
*** error ***What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §6.8 p.182 l.2-4
The uses_allocators clause enables the use of the specified allocator in the region associated with the directive on which the clause appears. If allocator refers to a predefined allocator, that predefined allocator will be available for use in the region.
OpenMP 5.2 §6.6 p.178 l.12-14
If a list item in the clause also appears in a data-sharing attribute clause on the same directive that privatizes the list item, allocations that arise from that list item in the clause will be provided by the memory allocator.
OpenMP 5.2 §13.8 p.286 l.38-39
Memory allocators that do not appear in a uses_allocators clause cannot appear as an allocator in an allocate clause or be used in the target region
Evidence
Same compiler, one change
- the allocate and uses_allocators clauses removed (t private only): 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
program gen_prog use omp_lib, only: omp_default_mem_alloc, omp_is_initial_device implicit none integer, parameter :: n = 64 integer, allocatable, target :: a(:), b(:) integer :: ref(n) integer :: i, host_flag logical :: ok integer :: t allocate(a(n), b(n)) do i = 1, n a(i) = i b(i) = 0 ref(i) = 2*i + 1 end do host_flag = 1 !$omp target map(to: a) map(from: b) map(tofrom: host_flag) host_flag = merge(1, 0, omp_is_initial_device()) !$omp parallel do default(none) shared(a, b) private(t) do i = 1, n t = 2*a(i) b(i) = t + 1 end do !$omp end parallel do !$omp end target ok = all(b == ref) print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok) deallocate(a, b) end program gen_prog
Other compilers run it correctly
GCC 16.2.0