Observed issues › fuzz/1936-afar
amdflang: an unnamed critical in a target parallel do does not exclude other threads (lost updates)
Legality: not independently confirmed. no independent review yet How this is checked
Same issue as catalog/afar-flang-critical-target-parallel-wrong; this program is another reproducer of it.
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 | behaves incorrectly | behaves incorrectly | unknown not run | behaves incorrectly | behaves incorrectly | n/a | n/a |
| CCE 19.0.0 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | fails another way | fails another way | unknown not run | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | fails another way | fails another way | unknown not run | 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 | AFAR 24.3.0, MI300A unified AFAR 24.3.0, MI300A copy AFAR 24.3.0, MI300X AFAR 24.3.0, MI350X | showRESULT checksum=129 |
| fails another way | CCE 19.0.0, MI300A unified CCE 19.0.0, MI300A copy | showWarning: Headers and libraries from cray-libsci/25.03.0 will be ignored because depends on PE_MPICH which is unavailable.. MT_CONTEXT_CRITICAL_SECTION Error message :: unhandled construct type Error detected :: File '/workspace/crayftn/pdgcs/v_openmp.c', line 7617 Initiated from :: Line 660 (v_main.c) Optimizer built :: 2025-02-07 (production) File :: fuzz-1936-afar.f90 |
| fails another way | CCE 20.0.2, MI300A unified CCE 20.0.2, MI300A copy | showWarning: Headers and libraries from cray-libsci/25.09.0 will be ignored because depends on PE_MPICH which is unavailable.. MT_CONTEXT_CRITICAL_SECTION Error message :: unhandled construct type Error detected :: File '/workspace/crayftn/pdgcs/v_openmp.c', line 7814 Initiated from :: Line 660 (v_main.c) Optimizer built :: 2025-11-17 (production) File :: fuzz-1936-afar.f90 |
| fails another way | CCE 21.0.3, MI300A unified CCE 21.0.3, MI300A copy | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. MT_CONTEXT_CRITICAL_SECTION Error message :: unhandled construct type Error detected :: File '/workspace/crayftn/pdgcs/v_openmp.c', line 8197 Initiated from :: Line 732 (v_main.c) Optimizer built :: 2026-07-14 (production) File :: fuzz-1936-afar.f90 |
| fails another way | CCE 21.0.4, MI300A unified CCE 21.0.4, MI300A copy | showWarning: Headers and libraries from cray-libsci/26.03.0 will be ignored because depends on PE_MPICH which is unavailable.. MT_CONTEXT_CRITICAL_SECTION Error message :: unhandled construct type Error detected :: File '/workspace/crayftn/pdgcs/v_openmp.c', line 8197 Initiated from :: Line 732 (v_main.c) Optimizer built :: 2026-09-24 (production) File :: fuzz-1936-afar.f90 |
| fails another way | NVHPC 25.11, A100 separate NVHPC 25.11, A100 managed | showNVFORTRAN-F-1196-OpenMP - omp critical is not supported in GPU region (fuzz-1936-afar.f90: 34) NVFORTRAN/x86-64 Linux 25.11-0: compilation aborted |
| fails another way | NVHPC 26.9, A100 separate NVHPC 26.9, A100 managed | showNVFORTRAN-F-1196-OpenMP - omp critical is not supported in GPU region (fuzz-1936-afar.f90: 34) NVFORTRAN/x86-64 Linux 26.9-0: compilation aborted |
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
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 (57 lines)
! Minimized by compliance.fuzz_min from fuzz seed 1936 (fuzz-1).
! toolchain: afar (-O2, HSA_XNACK=1, OMP_TARGET_OFFLOAD=mandatory)
! failure: wrong_code
! expected: the host reference checksum (host reference (afar) checksum=2147483504)
! observed: device checksum=129 ran_on_host=0
! Legal OpenMP 5.2: offload.engine.rules accepts it (offload.engine.prerun.check, rerun: with the
! race rule and the restriction checks); NVHPC is no witness: it does not implement a feature the
! program uses (NVFORTRAN-F-1196-OpenMP - omp critical is not supported in GPU
! region); the check's other witness, the AFAR flang front end, is the compiler under test and is
! not counted; no gfortran or gcc is a legality witness.
module fuzz_mod
implicit none
contains
integer function g1(x)
!$omp declare target
integer, intent(in) :: x
g1 = mod(ior(merge(4, x, x /= 4), 4), 97)
end function g1
end module fuzz_mod
program fuzz_prog
use omp_lib, only: omp_is_initial_device
use fuzz_mod, only: g1
implicit none
integer, parameter :: n = 100, m = 8
integer, allocatable :: ia(:)
integer :: ib(n)
integer :: i, j, r1a
logical :: lt
integer(8) :: cs
allocate(ia(n))
do i = 1, n
ia(i) = mod(i * 4 + 30, 211) - 80
end do
do i = 1, n
ib(i) = mod(i * 58 + 12, 97) - 31
end do
r1a = 15
lt = .true.
! fuzz: kernels
!$omp target map(tofrom: r1a)
!$omp parallel
!$omp do
do i = 1, n
do j = m, 1, -1
!$omp critical
r1a = ieor(r1a, ((ib((mod(((j * 1) + 2), n) + 1)) + ib(32)) - ia(i)))
!$omp end critical
end do
end do
!$omp end do
!$omp end parallel
!$omp end target
! fuzz: checksum
cs = 0
cs = modulo(cs * 31_8 + int(r1a, 8), 2147483629_8)
print '(a,i0,a,i0)', 'RESULT checksum=', cs, ' ran_on_host=', 0
end program fuzz_prog
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
RESULT checksum=129
What the specification requires
The specification text this program relies on and the compiler is expected to support.
The same requirement as the issue catalog/afar-flang-critical-target-parallel-wrong.
OpenMP 5.2 §15.2 p.299
Evidence
Other compilers run it correctly
GCC 16.2.0