[llvm-bugs] [Bug 46146] New: Offload reduction of std::complex gives wrong result when user defined reduction is missing

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 31 11:32:57 PDT 2020


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

            Bug ID: 46146
           Summary: Offload reduction of std::complex gives wrong result
                    when user defined reduction is missing
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xw111luoye at gmail.com
                CC: llvm-bugs at lists.llvm.org

https://github.com/ye-luo/openmp-target/blob/master/hands-on/tests/complex/complex_reduction.cpp

On CPU with and without user defined reduction (UDR) always work.
$ clang++ -fopenmp ./complex_reduction.cpp
$ clang++ -fopenmp -D__NO_UDR ./complex_reduction.cpp

On GPU, the code works with UDR.
$ clang++ -fopenmp -fopenmp-targets=nvptx64 ./complex_reduction.cpp
with outUDR, it gives wrong result.
$ clang++ -fopenmp -fopenmp-targets=nvptx64 -D__NO_UDR ./complex_reduction.cpp
$ ./a.out
wrong reduction value check(0,0) correct value (4950,-4950)
wrong reduction value check(-3.42281e-49,7.67314e-308) correct value
(4950,-4950)

This is not expected. The code should either not compile and ask UDR or works
with correct numbers without UDR just like the CPU case.

-- 
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/20200531/c14bc0c7/attachment.html>


More information about the llvm-bugs mailing list