Regression crash with nvc++ 22.7 (not with 22.1)

Hello,

Got an internal error:
“/ccc/scratch/cont002/den/ledacp/trust/amgx/src/VEF/Champs/Champ_P1NC.cpp”, line 383: internal error #2657: assertion failed at: “statements.cpp”, line 1665 in fixup_curr_block_labels_and_gotos

  for (int elem=0; elem<nb_elem; elem++)
  ^

1 catastrophic error detected in the compilation of “/ccc/scratch/cont002/den/ledacp/trust/amgx/src/VEF/Champs/Champ_P1NC.cpp”.
Compilation aborted.
nvc+±Fatal-/ccc/products2/nvhpc-22.7/Rhel_8__x86_64/system/default/Linux_x86_64/22.7/compilers/bin/tools/cpp1 TERMINATED by signal 6
Arguments to /ccc/products2/nvhpc-22.7/Rhel_8__x86_64/system/default/Linux_x86_64/22.7/compilers/bin/tools/cpp1
/ccc/products2/nvhpc-22.7/Rhel_8__x86_64/system/default/Linux_x86_64/22.7/compilers/bin/tools/cpp1 --llalign -Dunix -D__unix -D__unix__ -Dlinux -D__linux -D__linux__ -D__NO_MATH_INLINES -D__LP64__ -D__x86_64 -D__x86_64__ -D__LONG_MAX__=9223372036854775807L ‘-D__SIZE_TYPE__=unsigned long int’ ‘-D__PTRDIFF_TYPE__=long int’ -D__amd64 -D__amd64__ -D__k8 -D__k8__ -D__MMX__ -D__SSE__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4A__ -D__ABM__ -D__SSE4_1__ -D__SSE4_2__ -D__AVX__ -D__AVX2__ -D__F16C__ -D__FMA__ -D__XSAVE__ -D__XSAVEOPT__ -D__XSAVEC__ -D__XSAVES__ -D__POPCNT__ -D__SHA__ -D__AES__ -D__PCLMUL__ -D__CLFLUSHOPT__ -D__FSGSBASE__ -D__RDRND__ -D__BMI__ -D__BMI2__ -D__LZCNT__ -D__FXSR__ -D__MWAITX__ -D__CLZERO__ -D__PKU__ -D__VAES__ -D__VPCLMULQDQ__ -D__PGI

When compiling this kernel :

#pragma omp target teams distribute parallel for if (Objet_U::computeOnDevice)
for (int elem=0; elem<nb_elem; elem++)
  for (int icomp=0; icomp<nb_comp; icomp++)
    for (int i=0; i<dimension; i++)
      gradient_elem_addr[(elem*nb_comp+icomp)*dimension+i] *= inverse_volumes_addr[elem];

If I use nvc++ 22.1, it works.
If I suppress conditional “if (Objet_U::computeOnDevice)” it works also with 22.7.

Thanks,

Pierre

Hi Pierre,

Do you have minimal reproducing example you can provide?

This seems similar, albeit not exactly the same, as an issue reported here: Issue with locally defined classes in OpenMP offload region (since NVHPC 22.5)

Though I can’t be sure without a way to reproduce the error.

Thanks,
Mat

Thanks Mat for your quick answer. Probably the same issue. Not se easy to reproduce cause we use such a conditional in other parts of the code and it works fine. I think I would use the OMP_TARGET_OFFLOAD=DISABLED && OMP_NUM_THREADS=1 to disable OpenMP offload, the time this bug is fixed in nvc++.

Ok, let’s hope it’s the same and that when we fix this, it will fix your issue as well.

Now in the other post, the problem has to do with how the functor is getting parsed in combination with the use of the “if” clause. So I’m wondering if your issue is with the parsing of “Objet_U::computeOnDevice”.

Can you try assigning this to a local variable and then use this variable in the “if” clause?

Also, does it work around the issue if you remove the “if”?

Hello Mat,

This works with 22.7, so I will take it:
Thanks !

    int gpu = Objet_U::computeOnDevice;
    #pragma omp target teams distribute parallel for if (gpu)
    for (int elem=0; elem<nb_elem; elem++)
      for (int icomp=0; icomp<nb_comp; icomp++)
        for (int i=0; i<dimension; i++)
          gradient_elem_addr[(elem*nb_comp+icomp)*dimension+i] *= inverse_volumes_addr[elem];