[llvm-bugs] [Bug 51647] New: [OpenMPOpt] produces: error: Invalid record (Producer: 'LLVM14.0.0git' Reader: 'LLVM 14.0.0git')

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 27 05:08:19 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51647

            Bug ID: 51647
           Summary: [OpenMPOpt] produces: error: Invalid record (Producer:
                    'LLVM14.0.0git' Reader: 'LLVM 14.0.0git')
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rlieberm at amd.com
                CC: llvm-bugs at lists.llvm.org

i see this compilation issue with AMDGPU target on trunk, but not NVPTX.
we dug into this some locally, with debug build, to see what the bitcode reader
is unhappy about.  While trying to read the record for kmpc_kernel_parallel,
the single argument is not found.  

error: Invalid record (Producer: 'LLVM14.0.0git' Reader: 'LLVM 14.0.0git')

using trunk build this morning ... Aug 27

build compiler to enable amdgpu target

command line:
clang  -O2 -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa
-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx900 teams_nest.c -o teams_nest



test case:

#include <stdio.h>
#include <omp.h>
extern void foobar(int);
int main(void) {

  int fail = 0;
  #pragma omp target map(tofrom: fail)
 {
    #pragma omp teams
    {
      if (omp_get_team_num() == 0)
        foobar(fail);
    }
  }

  return fail;
}


CMake variables i used: 

      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_ENABLE_PROJECTS="clang;lld;llvm" \
      -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" \
      -DLLVM_ENABLE_ASSERTIONS=ON                        \
      -DLLVM_ENABLE_RUNTIMES="openmp" \
      -DCLANG_DEFAULT_LINKER=lld                         \


some debugging output:

location in bitcodeReader where it aborts
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:5306

295          SmallVector<Value*, 16> Args;
5296          SmallVector<Type *, 16> ArgsTys;
5297          // Read the fixed params.
5298          for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i,
++OpNum) {
5299            if (FTy->getParamType(i)->isLabelTy())
5300              Args.push_back(getBasicBlock(Record[OpNum]));
5301            else
5302              Args.push_back(getValue(Record, OpNum, NextValueNo,
5303                                      FTy->getParamType(i)));
5304            ArgsTys.push_back(FTy->getParamType(i));
(gdb)
5305            if (!Args.back())
5306              return error("Invalid record");
5307          }
5308

(gdb) p getValue(Record, OpNum, NextValueNo,FTy->getParamType(i))
$1 = (llvm::Value *) 0x0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210827/fa1a8891/attachment-0001.html>


More information about the llvm-bugs mailing list