Observed issues › afar-flang-thread-limit-target-parallel-do
Appears not to supportRefused at compile time · Fortran · OpenMP · Open
amdflang: thread_limit on target parallel do rejected
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 | not supported | not supported | not supported | not supported | not supported | n/a | n/a |
| CCE 19.0.0 | fails another way | fails another way | fails another way | unknown not run | unknown not run | n/a | n/a |
| CCE 20.0.2 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.3 | correct | correct | correct | unknown not run | unknown not run | n/a | n/a |
| CCE 21.0.4 | correct | correct | correct | 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 |
|---|---|---|
| not supported | 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: Semantic errors in afar-flang-thread-limit-target-parallel-do.f90
afar-flang-thread-limit-target-parallel-do.f90:5:28: error: THREAD_LIMIT clause is not allowed on TARGET PARALLEL DO directive
!$omp target parallel do thread_limit(8) map(from: a)
^^^^^^^^^^^^^^^ |
| fails another way | 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..
!$omp target parallel do thread_limit(8) map(from: a)
^
ftn-1370 ftn: ERROR P, File = afar-flang-thread-limit-target-parallel-do.f90, Line = 5, Column = 28
The THREAD_LIMIT clause is not allowed with directive !$OMP TARGET PARALLEL DO.
Cray Fortran : 10 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi |
| 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-0533-Clause 'THREAD_LIMIT' not allowed in OMP TARGET PARALLEL DO (afar-flang-thread-limit-target-parallel-do.f90: 5) 0 inform, 0 warnings, 1 severes, 0 fatal for p |
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 20.0.2, MI300A unified (runs correctly)
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
Program (18 lines)
program p
implicit none
integer :: a(10), i
a = 0
!$omp target parallel do thread_limit(8) map(from: a)
do i = 1, 10
a(i) = i
end do
print *, 'a(3) =', a(3)
end program p
! spec (requirement): The thread_limit clause is permitted on the target construct.
! "in_reduction, is_device_ptr, map, nowait, private, thread_limit," (5.2 §13.8 p.284 l.5)
! spec (requirement): On a combined construct the thread_limit clause applies to every leaf construct that permits it,
! so it is accepted on target parallel do and takes effect on the target leaf.
! "The effect of the shared, default, thread_limit, or order clause is as if it is applied to all leaf constructs that
! permit the clause." (5.2 §17.2 p.340 l.31-32)
! spec (this program): thread_limit(8) on target parallel do is applied to the target leaf construct, which permits
! the clause; amdflang rejects the clause on the combined construct.
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: Semantic errors in afar-flang-thread-limit-target-parallel-do.f90
afar-flang-thread-limit-target-parallel-do.f90:5:28: error: THREAD_LIMIT clause is not allowed on TARGET PARALLEL DO directive
!$omp target parallel do thread_limit(8) map(from: a)
^^^^^^^^^^^^^^^What the specification requires
The specification text this program relies on and the compiler is expected to support.
OpenMP 5.2 §13.8 p.284 l.5
in_reduction, is_device_ptr, map, nowait, private, thread_limit,
OpenMP 5.2 §17.2 p.340 l.31-32
The effect of the shared, default, thread_limit, or order clause is as if it is applied to all leaf constructs that permit the clause.
Evidence
Same compiler, one change
- thread_limit(8) removed: 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 :: a(10), i a = 0 !$omp target parallel do map(from: a) do i = 1, 10 a(i) = i end do print *, 'a(3) =', a(3) end program p
Other compilers run it correctly
CCE 20.0.2, CCE 21.0.3, CCE 21.0.4, GCC 16.2.0