OffTarget

Observed issues › catalog/cce-c-single-masked-task-link

Appears not to supportRefused at link time · C · OpenMP · Open

ftn/craycc: constructs documented as unsupported in offload regions (single, masked, task, ordered, scan) give internal compiler errors or device link failures instead of a diagnostic

Legality: not independently confirmed. no independent review yet How this is checked

Same issue as cce19-target-parallel-single-ice; this program is another reproducer of it.

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.0not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 20.0.2not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.3not supportednot supportednot supportedunknown
not run
unknown
not run
n/an/a
CCE 21.0.4not supportednot supportednot supportedunknown
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
not supportedCCE 19.0.0, MI300A unified
CCE 19.0.0, MI300A copy
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-rxzmDL/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_1c79a43b_main_l16)
>>> referenced by <dir>/cooltmpdir-rxzmDL/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_1c79a43b_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 19.0.0, MI250X
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-hUstDx/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_378f5261_main_l16)
>>> referenced by <dir>/cooltmpdir-hUstDx/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_378f5261_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 20.0.2, MI300A unified
CCE 20.0.2, MI300A copy
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-Ld92fN/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c714f01_main_l16)
>>> referenced by <dir>/cooltmpdir-Ld92fN/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c714f01_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 20.0.2, MI250X
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-nMk5R3/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_378d1aa2_main_l16)
>>> referenced by <dir>/cooltmpdir-nMk5R3/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_378d1aa2_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 21.0.3, MI300A unified
CCE 21.0.3, MI300A copy
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-J9ZNbZ/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c72e655_main_l16)
>>> referenced by <dir>/cooltmpdir-J9ZNbZ/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c72e655_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 21.0.3, MI250X
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-zjdoW6/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_3791b822_main_l16)
>>> referenced by <dir>/cooltmpdir-zjdoW6/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_3791b822_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 21.0.4, MI300A unified
CCE 21.0.4, MI300A copy
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-A2GFWJ/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c6eb0b4_main_l16)
>>> referenced by <dir>/cooltmpdir-A2GFWJ/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_1c6eb0b4_main_l16)
lld: error: undefined symbol: __kmpc_end_single
not supportedCCE 21.0.4, MI250X
show
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-jjCsUr/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_37938a37_main_l16)
>>> referenced by <dir>/cooltmpdir-jjCsUr/repro-cce-openmppost_lld.amdgpu.lto.o:(__omp_offloading_14_37938a37_main_l16)
lld: error: undefined symbol: __kmpc_end_single
fails another wayNVHPC 25.11, A100 separate
NVHPC 25.11, A100 managed
NVHPC 26.9, A100 separate
NVHPC 26.9, A100 managed
show
RUN_TIMEOUT

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
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -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
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -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
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -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
craycc -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx942 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro

AFAR 24.3.0, MI300A unified (runs correctly)

$AFAR/bin/amdclang -fopenmp --offload-arch=gfx942 -fopenmp-version=52 -fopenmp-version=52 -O2 repro.c -o repro
HSA_XNACK=1 OMP_TARGET_OFFLOAD=mandatory ./repro
Program (58 lines)
// # Draft finding: omp52-c-w-single on cce19
//
// - compiler: cce19
// - toolchain: cce19; arch: gfx942; machine: tuolumne; memory mode: unified; opt: -O2
// - program: catalog omp52-c-w-single (c, version 52, sha256 bce7f8273ffc4497)
// - expected: None (None; )
// - actual: rejected  (link_undefined_symbol: lld: error: undefined symbol: __kmpc_single)
// - verdict: compiler_bug by rule R10b-own-link-or-hang: a link failure on symbols the compiler's own generated code needs, or a compile that does not finish, on a legal program: the compiler's defect (never a rejection)
// - reason: 
// - citations: RUL-COMPILE-TIME (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 clang front end, not under test here); no
//   compiler under test, gfortran or gcc is a legality witness
// - witnesses: none
// - withdrawn: none
//
// Generated by compliance.widen (OpenMP 5.2, C11; catalog widening). Do not edit.
// id: omp52-c-w-single
// primary atom: omp.directive.single
// atoms: omp.directive.single
// legal: yes
// observable: yes
// ran_on_host: inside the target region of interest
// evidence: construct
// needs: none
// std: c11
// feature: a single construct in a target parallel region
// spec: OpenMP 5.2 §11.1, p.240 (single construct)
#include <stdio.h>
#include <stdbool.h>
#include <omp.h>

enum { n = 64 };

int main(void) {
  int a[n], b[n], ref[n];
  int host_flag = 1;
  int s = 0;
  for (int i = 0; i < n; i++) {
    a[i] = i + 1;
    b[i] = 0;
    ref[i] = 0;
  }
  #pragma omp target parallel map(tofrom: s, host_flag)
  {
    #pragma omp single
    {
      s = s + 1;
      host_flag = omp_is_initial_device();
    }
  }
  bool ok = true;
  for (int i = 0; i < n; i++)
    ok = ok && (b[i] == ref[i]);
  ok = ok && (s == 1);
  printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
  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

Expected and observed

Observed where it behaves incorrectly

Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
Unknown KMPC: __kmpc_single
Unknown KMPC: __kmpc_end_single
lld: error: undefined symbol: __kmpc_single
>>> referenced by <dir>/cooltmpdir-rxzmDL/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_1c79a43b_main_l16)
>>> referenced by <dir>/cooltmpdir-rxzmDL/repro-cce-openmp__llc.amdgpu:(__omp_offloading_14_1c79a43b_main_l16)
lld: error: undefined symbol: __kmpc_end_single

What the specification requires

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

OpenMP 5.2 §11.1 p.240

Evidence

Same compiler, one change

  • the same single on the host (parallel instead of target parallel): 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
    #include <stdio.h>
    #include <stdbool.h>
    #include <omp.h>
    
    enum { n = 64 };
    
    int main(void) {
      int a[n], b[n], ref[n];
      int host_flag = 1;
      int s = 0;
      for (int i = 0; i < n; i++) {
        a[i] = i + 1;
        b[i] = 0;
        ref[i] = 0;
      }
      #pragma omp parallel
      {
        #pragma omp single
        {
          s = s + 1;
          host_flag = omp_is_initial_device();
        }
      }
      bool ok = true;
      for (int i = 0; i < n; i++)
        ok = ok && (b[i] == ref[i]);
      ok = ok && (s == 1);
      printf("RESULT ran_on_host=%d check=%s\n", host_flag, ok ? "pass" : "fail");
      return 0;
    }
    

Other compilers run it correctly

AFAR 24.3.0, GCC 16.2.0