Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenMP][AA] Previous commit introduces compilation failure #64959

Closed
doru1004 opened this issue Aug 24, 2023 · 1 comment
Closed

[OpenMP][AA] Previous commit introduces compilation failure #64959

doru1004 opened this issue Aug 24, 2023 · 1 comment

Comments

@doru1004
Copy link
Contributor

This commit:

https://reviews.llvm.org/rG80906ce48d5bb28e06d0a113e7d62eb1358c8ecc

Makes the following fail with an assertion error during compilation:

#include <stdio.h>
#define N   10

int main (void)
{
  long int aa=0;
  int res = 0;

  int ng =12;
  int cmom = 14;
  int nxyz = 5000;

  #pragma omp target teams distribute num_teams(nxyz) thread_limit(ng*(cmom-1)) map(tofrom:aa)
  for (int gid = 0; gid < nxyz; gid++) {
    #pragma omp parallel for  collapse(2)
    for (unsigned int g = 0; g < ng; g++) {
      for (unsigned int l = 0; l < cmom-1; l++) {
        int a = 0;
        #pragma omp parallel for reduction(+:a)
        for (int i = 0; i < N; i++) {
          a += i;
        }
        #pragma omp atomic
        aa += a;
      }
    }
  }
  long exp = (long)ng*(cmom-1)*nxyz*(N*(N-1)/2);
  printf ("The result is = %ld exp:%ld!\n", aa,exp);
  if (aa != exp) {
    printf("Failed %ld\n",aa);
    return 1;
  }
  return 0;
}

Assertion error:

clang-linker-wrapper: /home/dobercea/upstream/llvm-project/llvm/include/llvm/ADT/DenseMap.h:435: void llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::moveFromOldBuckets(BucketT*, BucketT*) [with DerivedT = llvm::DenseMap<ReachabilityQueryInfo<llvm::Function>*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<ReachabilityQueryInfo<llvm::Function>*>, llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*> >; KeyT = ReachabilityQueryInfo<llvm::Function>*; ValueT = llvm::detail::DenseSetEmpty; KeyInfoT = llvm::DenseMapInfo<ReachabilityQueryInfo<llvm::Function>*>; BucketT = llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>]: Assertion `!FoundVal && "Key already in new map?"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/dobercea/rocm/trunk_1.0//bin/clang-linker-wrapper --opt-level=O2 --host-triple=x86_64-unknown-linux-gnu --linker-path=/home/dobercea/rocm/trunk_1.0//bin/ld.lld -- -pie -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o snap_red /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib /tmp/snap_red-3ec23b.o -lomp -lomptarget -lomptarget.devicertl -L/home/dobercea/rocm/trunk_1.0/lib -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /lib/x86_64-linux-gnu/crtn.o
 #0 0x0000555e04c44304 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000555e04c41b34 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f4f1b3e8420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f4f1ae8500b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007f4f1ae64859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007f4f1ae64729 get_sysdep_segment_value /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007f4f1ae64729 _nl_load_domain /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007f4f1ae75fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x0000555e058dacb7 llvm::DenseMap<ReachabilityQueryInfo<llvm::Function>*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<ReachabilityQueryInfo<llvm::Function>*, void>, llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>>::grow(unsigned int) (/home/dobercea/rocm/trunk_1.0//bin/clang-linker-wrapper+0x20bfcb7)
 #9 0x0000555e058dadab llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>* llvm::DenseMapBase<llvm::DenseMap<ReachabilityQueryInfo<llvm::Function>*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<ReachabilityQueryInfo<llvm::Function>*, void>, llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>>, ReachabilityQueryInfo<llvm::Function>*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<ReachabilityQueryInfo<llvm::Function>*, void>, llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>>::InsertIntoBucketImpl<ReachabilityQueryInfo<llvm::Function>*>(ReachabilityQueryInfo<llvm::Function>* const&, ReachabilityQueryInfo<llvm::Function>* const&, llvm::detail::DenseSetPair<ReachabilityQueryInfo<llvm::Function>*>*) (/home/dobercea/rocm/trunk_1.0//bin/clang-linker-wrapper+0x20bfdab)
#10 0x0000555e0590fe21 (anonymous namespace)::AAInterFnReachabilityFunction::instructionCanReach(llvm::Attributor&, llvm::Instruction const&, llvm::Function const&, llvm::SmallPtrSet<llvm::Instruction*, 4u> const*) const AttributorAttributes.cpp:0:0
#11 0x0000555e058e7a79 bool llvm::function_ref<bool (llvm::Instruction&)>::callback_fn<(anonymous namespace)::AAInterFnReachabilityFunction::isReachableImpl(llvm::Attributor&, ReachabilityQueryInfo<llvm::Function>&, llvm::SmallPtrSet<llvm::Function const*, 16u>*)::'lambda0'(llvm::Instruction&)>(long, llvm::Instruction&) AttributorAttributes.cpp:0:0
#12 0x0000555e0587c0e9 checkForAllInstructionsImpl(llvm::Attributor*, llvm::DenseMap<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*>>&, llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const*, llvm::AAIsDead const*, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) Attributor.cpp:0:0
#13 0x0000555e0588f507 llvm::Attributor::checkForAllInstructions(llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const&, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) (/home/dobercea/rocm/trunk_1.0//bin/clang-linker-wrapper+0x2074507)
#14 0x0000555e0590fb99 (anonymous namespace)::AAInterFnReachabilityFunction::isReachableImpl(llvm::Attributor&, ReachabilityQueryInfo<llvm::Function>&, llvm::SmallPtrSet<llvm::Function const*, 16u>*) (.isra.0) AttributorAttributes.cpp:0:0
#15 0x0000555e0590fe06 (anonymous namespace)::AAInterFnReachabilityFunction::instructionCanReach(llvm::Attributor&, llvm::Instruction const&, llvm::Function const&, llvm::SmallPtrSet<llvm::Instruction*, 4u> const*) const AttributorAttributes.cpp:0:0
#16 0x0000555e058e7a79 bool llvm::function_ref<bool (llvm::Instruction&)>::callback_fn<(anonymous namespace)::AAInterFnReachabilityFunction::isReachableImpl(llvm::Attributor&, ReachabilityQueryInfo<llvm::Function>&, llvm::SmallPtrSet<llvm::Function const*, 16u>*)::'lambda0'(llvm::Instruction&)>(long, llvm::Instruction&) AttributorAttributes.cpp:0:0
#17 0x0000555e0587c0e9 checkForAllInstructionsImpl(llvm::Attributor*, llvm::DenseMap<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, llvm::SmallVector<llvm::Instruction*, 8u>*>>&, llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const*, llvm::AAIsDead const*, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) Attributor.cpp:0:0
#18 0x0000555e0588f507 llvm::Attributor::checkForAllInstructions(llvm::function_ref<bool (llvm::Instruction&)>, llvm::AbstractAttribute const&, llvm::ArrayRef<unsigned int> const&, bool&, bool, bool) (/home/dobercea/rocm/trunk_1.0//bin/clang-linker-wrapper+0x2074507)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants