OffTarget

Observed issues › afar-clang-requires-device-safesync-hang

Appears to behave incorrectlyCompiler hangs · C · OpenMP · Open

amdclang -fopenmp-version=60: compile does not finish on #pragma omp requires device_safesync

Legality: contested. An independent adjudicating reading finds the result not required: The directive is conforming, but support for a given requirement clause is implementation defined, and an implementation that does not support it must perform compile-time error termination. A compiler may thus refuse the program, so acceptance is not 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 incorrectlyunknown
not run
behaves incorrectlybehaves incorrectlyn/an/a
CCE 19.0.0fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3fails another wayfails another wayunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4fails another wayfails another wayunknown
not run
unknown
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.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/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, MI300X
AFAR 24.3.0, MI350X
show
COMPILE_TIMEOUT
fails another wayCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
CCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
CCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
CCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
afar-clang-requires-device-safesync-hang.c:1:22: warning: extra tokens at the end of '#pragma omp requires' are ignored [-Wextra-tokens]
    1 | #pragma omp requires device_safesync
      |                      ^
afar-clang-requires-device-safesync-hang.c:1:37: error: expected at least one clause on '#pragma omp requires' directive
    1 | #pragma omp requires device_safesync
      |                                     ^
1 warning and 1 error generated.
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
"afar-clang-requires-device-safesync-hang.c", line 1: error: invalid text in pragma
  #pragma omp requires device_safesync
                       ^
"afar-clang-requires-device-safesync-hang.c", line 1: error: extra text after expected end of preprocessing directive
  #pragma omp requires device_safesync
                       ^
2 errors detected in the compilation of "afar-clang-requires-device-safesync-hang.c".
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
afar-clang-requires-device-safesync-hang.c:1:22: error: expected ‘unified_address’, ‘unified_shared_memory’, ‘self_maps’, ‘dynamic_allocators’, ‘reverse_offload’ or ‘atomic_default_mem_order’ clause
    1 | #pragma omp requires device_safesync
      |                      ^~~~~~~~~~~~~~~

Reproduce

AFAR 24.3.0, MI300A unified

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -fopenmp-version=60 -fopenmp-version=60 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (19 lines)
/* Finding (C): AFAR amdclang hangs on requires device_safesync.

   Legal OpenMP 6.0 C (6.0 §10.5.1.7: device_safesync is a requires
   clause; without an argument it means device_safesync(true)).

   Observed (2026-10-19): amdclang (AFAR 24.0.0git, drop 24.3.0) does not
   finish on this file: killed after 90 s with
   `-fopenmp -fopenmp-version=60 --offload-arch=gfx942 -c`, after 300 s
   with `-fopenmp -fopenmp-version=60 -fsyntax-only`, and after 30 s with
   `-fopenmp-version=52 -fsyntax-only` (where the clause is unknown and
   should be diagnosed). The omp60-c-clause-device_safesync programs time
   out in compilation. CCE craycc 19.0.0, 20.0.2 and 21.0.3 stop at once:
   "warning: extra tokens at the end of '#pragma omp requires' are
   ignored" and "error: expected at least one clause on '#pragma omp
   requires' directive" (the clause is unknown to them). AFAR amdflang
   compiles and runs the Fortran form (`!$omp requires device_safesync`;
   omp60-clause-device_safesync: unobservable). */
#pragma omp requires device_safesync
int main(void) { return 0; }

Source in the repository

Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page

What the specification requires

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

OpenMP 6.0 §10.5.1.7

Evidence

Same compiler, one change

  • another requires clause, atomic_default_mem_order(seq_cst): 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
    #pragma omp requires atomic_default_mem_order(seq_cst)
    int main(void) { return 0; }