[llvm-bugs] [Bug 48423] New: Runtime fails with declare mapper due clang generate extra mapper component for non-array map variable.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 6 20:33:48 PST 2020


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

            Bug ID: 48423
           Summary: Runtime fails with declare mapper due clang generate
                    extra mapper component for non-array map variable.
           Product: clang
           Version: trunk
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: OpenMP
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jennifer.yu at intel.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24242
  --> https://bugs.llvm.org/attachment.cgi?id=24242&action=edit
Test to reproduce the problem.

Test failed at runtime:
command line to reproduce:

>clang++ -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu -g -O0 j.cpp
bash-4.4$ ./a.out
Sizeof C = 16 8
Sizeof C.s = 1cf8f808 1cf8f810
Libomptarget message: explicit extension not allowed: host address specified is
0x00007ffe1cf8f808 (16 bytes), but device allocation maps to host at
0x00007ffe1cf8f808 (4 bytes)
Libomptarget error: Call to getOrAllocTgtPtr returned null pointer (device
failure or illegal mapping).
Libomptarget error: Call to targetDataBegin via targetDataMapper for custom
mapper failed.
Libomptarget error: Call to targetDataBegin failed, abort target.
Libomptarget error: Failed to process data before launching the kernel.
Libomptarget error: run with env LIBOMPTARGET_INFO>1 to dump host-target
pointer maps
j.cpp:17:3: Libomptarget fatal error 1: failure of target construct while
offloading is mandatory
Aborted (core dumped)

The problem clang generate 4 Mapper components should be 3:

$11 = std::vector of length 4, capacity 4 = {{Base = 0x7fffffff9f28,
    Begin = 0x7fffffff9f28, Size = 16, Type = 32}, {Base = 0x7fffffff9f28,
    Begin = 0x7fffffff9f28, Size = 16, Type = 32}, {Base = 0x7fffffff9f28,
    Begin = 0x7fffffff9f28, Size = 4, Type = 562949953421315}, {
    Base = 0x7fffffff9f30, Begin = 0x7fffffff9f10, Size = 16,
    Type = 562949953421331}}

During run mapper_id(clang generated), isarray gets set true cause extra
MapperComponent is generated.   

 %omp.arrayinit.isarray = icmp sge i64 %6, 1

In emitUDMapperArrayInitOrDel: following code seems not right.
      llvm::Value *IsArray = MapperCGF.Builder.CreateICmpSGE(
      Size, MapperCGF.Builder.getInt64(1), "omp.arrayinit.isarray");

ā€œC cā€ is not same with ā€œC c[1]ā€;  but both Size are 1;

Compiler knows map variable type, should not necessary to generate runtime code
for isarray.

-- 
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/20201207/e0ef3ab2/attachment.html>


More information about the llvm-bugs mailing list