[llvm-bugs] [Bug 43330] New: OpenMP target: Mapping of partial arrays fails

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 16 08:35:35 PDT 2019


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

            Bug ID: 43330
           Summary: OpenMP target: Mapping of partial arrays fails
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: Cramer at itc.rwth-aachen.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 22511
  --> https://bugs.llvm.org/attachment.cgi?id=22511&action=edit
Reproducer of the bug

According to the OMP Specs (Chapter 2.1.5) an array section can have the
following format (beside others):

[ lower-bound : length : stride] or
[ lower-bound : ]

In the latter case the length and the stride are determined as follows (see
specs):

"When the stride is absent it defaults to 1.
When the length is absent it defaults to (size - lower-bound)/stride, where
size is the size of the array dimension."

Given a declaration "int a[N];" the following code should be semantically the
same:

(1) #pragma omp target data map(from: a[1:N-1])
(2) #pragma omp target data map(from: a[1:])

However, if I test this with "-fopenmp-targets=x86_64-unknown-linux-gnu" I get
the following debug output from libomptarget (LIBOMPTARGEG_DEBUG=1) for both
cases (and N=1000):

(1) Libomptarget --> Moving 3996 bytes (tgt:0x0000000000623dc0) ->
(hst:0x00007ffe65c4d474)
(2) Libomptarget --> Moving 4000 bytes (tgt:0x0000000000623dc0) ->
(hst:0x00007fff2d5a45f4)

Thus, in case (2) there are too many bytes transfered. This has bad side
effects, because some stack variables on the host may be overwritten (which
actually happens to me).

I attached a reproducer. Can you confirm this bug (or even better fix it ;-)).
I am not sure if this is an issue of the compiler or the runtime.

-- 
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/20190916/02a145ec/attachment.html>


More information about the llvm-bugs mailing list