OffTarget

Observed issues › catalog/cce-flang-allocate-in-target-crash

Appears to behave incorrectlyCrashes or aborts at run time · Fortran · OpenMP · Open

ftn: ALLOCATE/DEALLOCATE of a local allocatable in device code aborts (SIGABRT), OpenMP and OpenACC

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.0correctcorrectcorrectcorrectcorrectn/an/a
CCE 19.0.0behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 20.0.2behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.3behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
not run
unknown
not run
n/an/a
CCE 21.0.4behaves incorrectlybehaves incorrectlybehaves incorrectlyunknown
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
show
:0:rocdevice.cpp            :2994: 1715060569123 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 19.0.0, MI300A copy
show
:0:rocdevice.cpp            :2994: 1715065003499 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 19.0.0, MI250X
show
:0:rocdevice.cpp            :2994: 1570931077363 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 20.0.2, MI300A unified
show
:0:rocdevice.cpp            :2994: 1714652825997 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 20.0.2, MI300A copy
show
:0:rocdevice.cpp            :2994: 1714661657989 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 20.0.2, MI250X
show
:0:rocdevice.cpp            :2994: 1570922129197 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
behaves incorrectlyCCE 21.0.3, MI300A unified
show
:0:rocdevice.cpp            :3586: 1715079002360 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1927 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:14
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x940fe0 SWq=0x155555526000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
behaves incorrectlyCCE 21.0.3, MI300A copy
show
:0:rocdevice.cpp            :3586: 1715082388716 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1496 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:23
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x940fe0 SWq=0x155555526000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
behaves incorrectlyCCE 21.0.3, MI250X
show
:0:rocdevice.cpp            :3586: 1570982350718 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1496 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:23
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x8f19f0 SWq=0x15555537e000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
behaves incorrectlyCCE 21.0.4, MI300A unified
show
:0:rocdevice.cpp            :3586: 1714916835795 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1927 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:14
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x940ff0 SWq=0x155555526000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
behaves incorrectlyCCE 21.0.4, MI300A copy
show
:0:rocdevice.cpp            :3586: 1714920390156 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1496 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:23
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x940ff0 SWq=0x155555526000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
behaves incorrectlyCCE 21.0.4, MI250X
show
:0:rocdevice.cpp            :3586: 1570938182350 us:  Callback: Queue 0x155545200000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016
ACC: libcrayacc/acc_hw_amd.c:1496 CRAY_ACC_ERROR -  hipStreamSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure' from cce-flang-allocate-in-target-crash.f90:23
ACC: libcrayacc/acc_hw_amd.c:1476 CRAY_ACC_ERROR -  hipDeviceSynchronize returned hipErrorLaunchFailure: 'unspecified launch failure'
Thread execution stopped at FILE cce-flang-allocate-in-target-crash.f90 LINE 18 due to a Fortran allocate/deallocate statement.
Kernel Name: wide_prog_$ck_L14_1
VGPU=0x8f19c0 SWq=0x15555537e000, HWq=0x155545200000, id=1
	Dispatch Header =0xb02 (type=2, barrier=1, acquire=1, release=1), setup=0
	grid=[256, 1, 1], workgroup=[256, 1, 1]
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-1219-Unimplemented feature: BLOCK construct in the scope of a parallel directive. (cce-flang-allocate-in-target-crash.f90: 16)
  0 inform,   0 warnings,   1 severes, 0 fatal for wide_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

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)
! # Draft finding: omp52-w-allocate-in-device on cce19
!
! - compiler: cce19
! - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
! - program: catalog omp52-w-allocate-in-device (f90, version 52, sha256 eb06c2541aa05fb4)
! - expected: check=pass (trusted; elision + model)
! - actual: crash  (crash: SIGABRT; without mandatory: crash: SIGABRT)
! - 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:
!   afar/gfx942/unified, afar/gfx942/unified (port:omp52-c-w-allocate-in-device), cce19/gfx942/unified
!   (port:omp52-c-w-allocate-in-device), cc ...
! - 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: afar/gfx942/unified, afar/gfx942/unified (port:omp52-c-w-allocate-in-device), cce19/gfx942/unified
!   (port:omp52-c-w-allocate-in-device), cce20/gfx942/unified (port:omp52-c-w-allocate-in-device), cce21/gfx942/unified
!   (port:omp52-c-w-allocate-in-device), elision
! - withdrawn: none
!
! Generated by compliance.widen (OpenMP 5.2, free-form Fortran; catalog widening). Do not edit.
! id: omp52-w-allocate-in-device
! primary atom: base.device.allocate
! atoms: base.device.allocate
! legal: yes
! observable: yes
! ran_on_host: inside the target region of interest
! evidence: construct
! needs: none
! std: f2008
! feature: ALLOCATE and DEALLOCATE of a local allocatable array in a target region
! spec: OpenMP 5.2 §1.7, pp.34-35: Fortran 2008 is a normative base language (the Fortran 2018 features whose use is unspecified are
! listed there; this is not one of them)
program wide_prog
  use omp_lib, only: omp_is_initial_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
  !$omp target map(to: a) map(from: b) map(tofrom: host_flag)
    host_flag = merge(1, 0, omp_is_initial_device())
    block
      integer, allocatable :: w(:)
      allocate(w(n))
      w = 2*a + 1
      b = w
      deallocate(w)
    end block
  !$omp end target
  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

:0:rocdevice.cpp            :2994: 1715060569123 us:  Callback: Queue 0x155545600000 aborting with error : HSA_STATUS_ERROR_EXCEPTION: An HSAIL operation resulted in a hardware exception. code: 0x1016

What the specification requires

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

OpenMP 5.2 §1.7 p.34-35

Evidence

Same compiler, one change

  • w a fixed-size local array (no ALLOCATE/DEALLOCATE): 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 wide_prog
      use omp_lib, only: omp_is_initial_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
      !$omp target map(to: a) map(from: b) map(tofrom: host_flag)
        host_flag = merge(1, 0, omp_is_initial_device())
        block
          integer :: w(n)
          w = 2*a + 1
          b = w
        end block
      !$omp end target
      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

AFAR 24.3.0, GCC 16.2.0

Reproducers of this issue