OffTarget

Observed issues › catalog/nvhpc-acc-associate-illegal-address

Appears to behave incorrectlyRun-time error · Fortran · OpenACC · Open

nvfortran -acc: ASSOCIATE construct in a parallel loop ends in CUDA_ERROR_ILLEGAL_ADDRESS

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.0n/an/an/an/an/an/an/a
CCE 19.0.0correctcorrectunknown
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/abehaves incorrectlybehaves incorrectly
NVHPC 26.9n/an/an/an/an/abehaves incorrectlybehaves incorrectly
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 incorrectlyNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
Failing in Thread:1
Accelerator Fatal Error: call to cuStreamSynchronize returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
 File: <dir>/nvhpc-acc-associate-illegal-address.f90
 Function: wide_prog:1
 Line: 14

Reproduce

NVHPC 25.11, A100 separate

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
./repro

NVHPC 26.9, A100 separate

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:separate -O2 repro.f90 -o repro
./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 -h acc -O2 repro.f90 -o repro
HSA_XNACK=1 ./repro
Program (60 lines)
! # Draft finding: acc34-w-associate on nvhpc
!
! - compiler: nvhpc
! - toolchain: nvhpc; arch: sm_80; machine: wingtip; memory mode: copy; opt: -O2
! - program: catalog acc34-w-associate (f90, version 34, sha256 68f44e65e61fcf01)
! - expected: check=pass (trusted; elision + model)
! - actual: run_error  (exit_status: 1) [the confirmer's class run_error; the matrix's class of the same run is wrong_answer: a run
!   that fails]
! - observed: the run ends with "call to cuStreamSynchronize returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS)" (NVHPC 25.11
!   and 26.9): an ASSOCIATE construct in a parallel loop; the OpenMP form (omp52-w-associate) is correct
! - verdict: compiler_bug by rule R20-runtime-bug: a legal program fails at run time, deterministically, against an expected value
!   from two or more independent sources with an executed witness, and another toolchain, mode, arch or the elision gives the
!   expected value
! - reason: expected trusted check=pass (elision + model): stored main verdict: elision + model agree; witnesses: cce19/gfx942/copy,
!   cce20/gfx942/copy, cce21/gfx942/copy, elision
! - citations: RUL-DERIVED-NEEDS-EXECUTION (rulings.md); RUL-WITNESS-PER-MODE (rulings.md);
!   RUL-SAME-COMPILER-RUNS (rulings.md); RUL-PRESENCE-WITNESS (rulings.md); RUL-METAMORPHIC-OTHER-FAMILY
!   (rulings.md)
! - legality: legal: 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
! - witnesses: cce19/gfx942/copy, cce20/gfx942/copy, cce21/gfx942/copy, elision
! - withdrawn: none
!
! Generated by compliance.widen (OpenACC 3.4, free-form Fortran; catalog widening). Do not edit.
! id: acc34-w-associate
! primary atom: base.device.associate
! atoms: base.device.associate
! legal: yes
! observable: yes
! ran_on_host: inside the compute region of interest (acc_on_device)
! evidence: construct
! needs: none
! std: f2008
! feature: an ASSOCIATE construct in device code
! spec: OpenACC 3.4 §1.8, p.16: Fortran 2008 is a normative base language (the features whose use is unspecified are listed there;
! this is not one of them)
program wide_prog
  use openacc, only: acc_device_host, acc_on_device
  implicit none
  integer, parameter :: n = 64
  integer :: a(n), b(n), ref(n)
  integer :: i, host_flag
  logical :: ok
  do i = 1, n
    a(i) = i
    b(i) = 0
    ref(i) = 2*i + 1
  end do
  host_flag = 1
  !$acc parallel loop copyin(a) copyout(b) copy(host_flag)
  do i = 1, n
    associate (x => a(i), y => b(i))
      y = 2*x + 1
    end associate
    if (i == 1) host_flag = merge(1, 0, acc_on_device(acc_device_host))
  end do
  ok = all(b == ref)
  print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
end program wide_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

Expected

check=pass

Observed where it behaves incorrectly

Failing in Thread:1
Accelerator Fatal Error: call to cuStreamSynchronize returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
 File: <dir>/nvhpc-acc-associate-illegal-address.f90
 Function: wide_prog:1
 Line: 14

What the specification requires

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

OpenACC 3.4 §1.8 p.16

Evidence

Same compiler, one change

  • the assignment written without the ASSOCIATE construct: CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct; NVHPC 25.11: correct; NVHPC 26.9: correct
    Control program
    program wide_prog
      use openacc, only: acc_device_host, acc_on_device
      implicit none
      integer, parameter :: n = 64
      integer :: a(n), b(n), ref(n)
      integer :: i, host_flag
      logical :: ok
      do i = 1, n
        a(i) = i
        b(i) = 0
        ref(i) = 2*i + 1
      end do
      host_flag = 1
      !$acc parallel loop copyin(a) copyout(b) copy(host_flag)
      do i = 1, n
        b(i) = 2*a(i) + 1
        if (i == 1) host_flag = merge(1, 0, acc_on_device(acc_device_host))
      end do
      ok = all(b == ref)
      print '(a,i0,a,a)', 'RESULT ran_on_host=', host_flag, ' check=', merge('pass', 'fail', ok)
    end program wide_prog
    

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