[llvm-bugs] [Bug 41074] New: Cannot use two reductions with different numbers of parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 14 13:13:40 PDT 2019


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

            Bug ID: 41074
           Summary: Cannot use two reductions with different numbers of
                    parameters
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Justin.lewis.salmon at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hi, 

I'm not able to use two reductions in two different files which have different
numbers of arguments, otherwise nvlink fails with an error related to the size
of the global reduction buffer (see below console output). I'm using llvm
trunk, CUDA 9 targeting a K20 GPU.

If I add a dummy second parameter to the first reduction, nvlink is happy.

I think this is a bug in libomptarget, but I apologise in advance if I'm in
completely the wrong place!

Best regards,
Justin


$ cat test.c
#include <stdio.h>
#include "test2.h"

int main(void)
{
  double a;

#pragma omp target teams distribute reduction(min: a)
  for (int k = 0; k <= 1000; k++)
  {
    a = 0;
  }
  printf("a = %f\n", a);

  test2();
  return 0;
}
$ cat test2.c
#include <stdio.h>
#include "test2.h"

void test2() {
  double a = 0, b = 0;

#pragma omp target teams distribute reduction(min: a, b)
  for (int k = 0; k <= 1000; k++)
  {
    a = 0;
    b = 0;
  }

  printf("a = %f, b = %f\n", a, b);
}
$ clang -O3 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target
-march=sm_35 test.c test2.c -c
$ clang -O3 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target
-march=sm_35 test.o test2.o -o test -v
clang version 9.0.0 (https://github.com/llvm-mirror/clang
c34654039c07d6911567100739fcb60f6c750401) (https://github.com/llvm-mirror/llvm
0d5bf69c9c2ad14ede31b91a30d3bd0dc47003d0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /newhome/pa13269/modules/install/llvm/bin
Found candidate GCC installation:
/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4
Selected GCC installation:
/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation:
/newhome/wr18313/flang/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/cuda-8.0.61-va3aogqzgjbxdcdzsa4uwys7qv776abn,
version 8.0
 "/newhome/pa13269/modules/install/llvm/bin/clang-offload-bundler" -type=o
-targets=host-x86_64-unknown-linux-gnu,openmp-nvptx64-nvidia-cuda
-inputs=test.o -outputs=/tmp/test-d8e54d.o,/tmp/test-75ece0.cubin -unbundle
 "/newhome/pa13269/modules/install/llvm/bin/clang-offload-bundler" -type=o
-targets=host-x86_64-unknown-linux-gnu,openmp-nvptx64-nvidia-cuda
-inputs=test2.o -outputs=/tmp/test2-e80c54.o,/tmp/test2-3be590.cubin -unbundle

"/newhome/wr18313/flang/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/cuda-8.0.61-va3aogqzgjbxdcdzsa4uwys7qv776abn/bin/nvlink"
-o /tmp/test-135ff9.out -v -arch sm_35
-L/newhome/wr18313/flang/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/cuda-8.0.61-va3aogqzgjbxdcdzsa4uwys7qv776abn/lib64
-L/newhome/pa13269/modules/openmpi3-gcc4.8//lib
-L/newhome/wr18313/flang/spack/opt/spack/linux-scientific6-x86_64/gcc-8.3.0/cuda-10.0.130-efajfgq3xq6gmbf6xt3jqqrmedl2bhxt/lib64
-L/newhome/pa13269/modules/install/llvm/lib
-L/newhome/pa13269/modules/install/llvm/lib -lomptarget-nvptx
/tmp/test-75ece0.cubin /tmp/test2-3be590.cubin
nvlink error   : Size doesn't match for '_openmp_teams_reductions_buffer_$_' in
'/tmp/test2-3be590.cubin', first specified in '/tmp/test-75ece0.cubin'
nvlink info    : 98452244 bytes gmem
nvlink info    : Function properties for
'__omp_offloading_23_492c9a5_test2_l7':
nvlink info    : used 40 registers, 0 stack, 1236 bytes smem, 336 bytes
cmem[0], 8 bytes cmem[2], 0 bytes lmem
nvlink info    : Function properties for '__omp_offloading_23_492c873_main_l8':
nvlink info    : used 38 registers, 0 stack, 1236 bytes smem, 328 bytes
cmem[0], 12 bytes cmem[2], 0 bytes lmem
 "/usr/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -o test /usr/lib/../lib64/crt1.o
/usr/lib/../lib64/crti.o
/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/crtbegin.o
-L/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4
-L/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/../../..
-L/newhome/pa13269/modules/install/llvm/bin/../lib -L/lib -L/usr/lib
/tmp/test-d8e54d.o /tmp/test2-e80c54.o
-L/newhome/wr18313/flang/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/cuda-8.0.61-va3aogqzgjbxdcdzsa4uwys7qv776abn/lib64
-L/newhome/pa13269/modules/openmpi3-gcc4.8//lib
-L/newhome/wr18313/flang/spack/opt/spack/linux-scientific6-x86_64/gcc-8.3.0/cuda-10.0.130-efajfgq3xq6gmbf6xt3jqqrmedl2bhxt/lib64
-L/newhome/pa13269/modules/install/llvm/lib -lomp -lomptarget -lgcc --as-needed
-lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed
/cm/shared/languages/GCC-4.8.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/crtend.o
/usr/lib/../lib64/crtn.o -T /tmp/test-cc1b16.lk
clang-9: error: nvlink command failed with exit code 255 (use -v to see
invocation)

-- 
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/20190314/0b678686/attachment.html>


More information about the llvm-bugs mailing list