OffTarget

Observed issues › afar-nontemporal-assumed-shape-ice

Appears to behave incorrectlyCompiler crash · Fortran · OpenMP · Open

amdflang: "verification of lowering to FIR failed" for nontemporal on an assumed-shape dummy

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.0behaves incorrectlybehaves incorrectlybehaves incorrectlybehaves incorrectlybehaves incorrectlyn/an/a
CCE 19.0.0correctcorrectcorrectunknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectcorrectunknown
not run
unknown
not run
n/an/a
CCE 21.0.3correctcorrectcorrectunknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectcorrectunknown
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 incorrectlyAFAR 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
show
error: loc("afar-nontemporal-assumed-shape-ice.f90":16:13): 'omp.simd' op operand #0 must be variadic of OpenMP-compatible variable type, but got '!fir.box<!fir.array<?x?xi32>>'
error: verification of lowering to FIR failed
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier nontemporal (afar-nontemporal-assumed-shape-ice.f90: 16)
NVFORTRAN/x86-64 Linux 25.11-0: compilation completed with severe errors
fails another wayNVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
NVFORTRAN-S-0034-Syntax error at or near identifier nontemporal (afar-nontemporal-assumed-shape-ice.f90: 16)
NVFORTRAN/x86-64 Linux 26.9-0: compilation completed with severe errors

Reproduce

AFAR 24.3.0, MI300A unified

$AFAR/bin/amdflang -fopenmp --offload-arch=gfx942 -O2 repro.f90 -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

CCE 19.0.0, MI300A unified (runs correctly)

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
Program (33 lines)
program p
  implicit none
  integer, parameter :: n = 16, m = 4
  integer :: o1(n, m), i, j
  integer(8) :: cs
  o1 = 0
  call kp(o1)
  cs = sum(int(o1, 8))
  print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', 0
contains
  subroutine kp(o1)
    integer, intent(inout) :: o1(:, :)
    integer :: i, j
    !$omp target teams distribute parallel do map(tofrom: o1)
    do i = 1, n
      !$omp simd nontemporal(o1)
      do j = 1, m
        o1(i, j) = i + j
      end do
    end do
  end subroutine kp
end program p
! spec (requirement): The nontemporal clause on a simd construct takes a list of variables, and its text states no
!   restriction on their form, so an assumed-shape dummy array is a valid list item.
! "The nontemporal clause specifies that accesses to the storage locations to which the list items refer have low
!   temporal locality across the iterations in which those storage locations are accessed." (5.2 §10.4.1 p.236
!   l.21-22)
! spec (requirement): The list items of nontemporal may also appear in data-environment attribute clauses.
! "The list items of the nontemporal clause may also appear as list items of data-environment attribute clauses." (5.2
!   §10.4.1 p.236 l.23-24)
! spec (this program): nontemporal(o1) names an assumed-shape dummy that is also mapped by the enclosing target
!   construct; the spec text has no restriction against assumed-shape list items (it does not mention them), and
!   amdflang stops with a failed lowering to FIR.

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

error: loc("afar-nontemporal-assumed-shape-ice.f90":16:13): 'omp.simd' op operand #0 must be variadic of OpenMP-compatible variable type, but got '!fir.box<!fir.array<?x?xi32>>'
error: verification of lowering to FIR failed

What the specification requires

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

OpenMP 5.2 §10.4.1 p.236 l.21-22

The nontemporal clause specifies that accesses to the storage locations to which the list items refer have low temporal locality across the iterations in which those storage locations are accessed.

OpenMP 5.2 §10.4.1 p.236 l.23-24

The list items of the nontemporal clause may also appear as list items of data-environment attribute clauses.

Evidence

Same compiler, one change

  • nontemporal(o1) removed from the simd directive: 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 p
      implicit none
      integer, parameter :: n = 16, m = 4
      integer :: o1(n, m), i, j
      integer(8) :: cs
      o1 = 0
      call kp(o1)
      cs = sum(int(o1, 8))
      print '(a,i0)', 'RESULT checksum=', cs
    contains
      subroutine kp(o1)
        integer, intent(inout) :: o1(:, :)
        integer :: i, j
        !$omp target teams distribute parallel do map(tofrom: o1)
        do i = 1, n
          !$omp simd
          do j = 1, m
            o1(i, j) = i + j
          end do
        end do
      end subroutine kp
    end program p
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, GCC 16.2.0

Reproducers of this issue