[llvm-bugs] [Bug 44390] New: Incorrect OpenMP target offload code at > -O0 optimization

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 27 13:01:44 PST 2019


            Bug ID: 44390
           Summary: Incorrect OpenMP target offload code at > -O0
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: csdaley at lbl.gov
                CC: llvm-bugs at lists.llvm.org

Created attachment 22968
  --> https://bugs.llvm.org/attachment.cgi?id=22968&action=edit
Source file, bitcode files and PTX files.

I have ported an application named HPGMG from CUDA to OpenMP target offload. I
have found that there are 4 functions containing OpenMP target offload which
give incorrect floating point results (outside of expected floating point
discrepancies) when using LLVM/Clang. The floating point results are only
expected when compiling with -O0 optimization. The host versions of the
functions are correct at -O1, -O2 and -O3 optimization levels (tested by
setting OMP_TARGET_OFFLOAD=disabled).

I have managed to isolate 1 expression in 1 of the 4 functions which produces
incorrect floating point results when using LLVM/Clang. I have placed this
expression in a function named apply_op_fn() in a separate file named
smooth-debug-apply-op-ijk.c. I only need to compile this one file at -O0
optimization to give the correct results for this function. It seems that
LLVM/Clang is generating incorrect PTX for the function apply_op_fn(). I
believe it is this step because I only need to use -O0 optimization for the
LLVM bitcode to PTX compilation step to get the correct results.

I have attached a tarball containing the source file and the LLVM bitcode files
and PTX files at -O0 and -O1 optimization levels. Results are correct when
using -O0 and incorrect when using -O1. My test platform consists of Intel
Skylake CPUs and NVIDIA V100 GPUs. I have tested two versions of LLVM/Clang:
master branch from 23 December 2019 and 28 August 2019. Both have the same
issue. I have also tested the IBM XLC compiler. The IBM XLC compiler gives
expected results when compiling with either -O0 or -Ofast optimization levels.

I appreciate any help here. My expectation is that all 4 functions are affected
by the same compiler issue.

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/20191227/e39cb9c5/attachment.html>

More information about the llvm-bugs mailing list