<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Cannot use two reductions with different numbers of parameters"
href="https://bugs.llvm.org/show_bug.cgi?id=41074">41074</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cannot use two reductions with different numbers of parameters
</td>
</tr>
<tr>
<th>Product</th>
<td>OpenMP
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Clang Compiler Support
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Justin.lewis.salmon@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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 (<a href="https://github.com/llvm-mirror/clang">https://github.com/llvm-mirror/clang</a>
c34654039c07d6911567100739fcb60f6c750401) (<a href="https://github.com/llvm-mirror/llvm">https://github.com/llvm-mirror/llvm</a>
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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>