<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 - Incorrect PPC64LE VSX code generated for Mesa 17.1.2 vertex shader program"
   href="https://bugs.llvm.org/show_bug.cgi?id=33531">33531</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect PPC64LE VSX code generated for Mesa 17.1.2 vertex shader program
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bcrocker@redhat.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com, ulrich.weigand@de.ibm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Overview:

On PPC64LE, some of the Piglit tests fail because erroneous VSX code is
generated for the vertex shader programs; the same tests pass again if
VSX code generation is disabled (i.e. if just Altivec is used).

Steps to reproduce:

ON YOUR PPC64LE TEST SYSTEM:
0) dnf install mesa-dri-drivers glx-utils redhat-rpm-config
1) Download Mesa 17.1.2 (recent release): git clone -b mesa-17.1.2
git://anongit.freedesktop.org/mesa/mesa
2) dnf builddep mesa
3) Build Mesa: in Mesa directory:
   a) RECOMMEND export CFLAGS="-g -O0" ; eqxport CXXFLAGS="-g -O0"
   b) prefix=<where you want to install Mesa, e.g. $HOME/local/lib>
   c) ./autogen.sh --prefix=$prefix \
             --with-dri-drivers=  \
             --with-gallium-drivers=swrast \
             --enable-gallium-llvm \
             --enable-glx-tls \
             --enable-debug
   d) apply the patch to lp_bld_misc.cpp described below
   e) make
   f) make install
   g) make sure your LD_LIBRARY_PATH points to where 'make install' installed,
i.e. to $prefix
4) Back in home directory, download Piglit: git clone
git://anongit.freedesktop.org/piglit
5) Install Piglit build dependencies: dnf builddep piglit; IF problems here,
manually install
- cmake
- python-nose
- chrpath
- libtiff-devel
- python2-numpy
- python3-numpy
- libXrender-devel
- python-lxml
- python3-mako
- libpng-devel
- libpng-tools
- opencl-headers
- ocl-icd-devel
- mesa-libGL-devel
- mesa-libGLU-devel
- mesa-libEGL-devel
- mesa-demos glew glew-devel libGLEW
- waffle-devel
- redhat-rpm-config-40-2.fc24.noarch (may not need this after redhat-rpm-config
above)
6) In Piglit directory: cmake . ; make
7) Create Piglit results directory (NOT in Piglit directory): mkdir
$HOME/piglit-results
8) Run Piglit 'quick' test: in Piglit dir: ./piglit-run.py tests/quick.py
   a) export RESULTDIR=$HOME/piglit-results
   b) export RESULTNAME=q.ppc64le.mesa-17.1.2
   c) ./piglit-run.py tests/quick.py $RESULTDIR/$RESULTNAME

ON YOUR PC running your browser, where you should also have Piglit installed:
9) Create Piglit result directory; recommend $HOME/piglit-results
10) Copy the q.ppc64le.mesa-17.1.2 directory over via SCP or other means
11) Create browser-viewable summary:
   a) in Piglit directory...
   b) export RESULTDIR=$HOME/piglit-results
   c) export RESULTNAME=q.ppc64le.mesa-17.1.2
   d) export SUMMARYNAME=sq.ppc64le.mesa-17.1.2
   e) ./piglit summary html $RESULTDIR/$SUMMARYNAME $RESULTDIR/$RESULTNAME

12) Open the summary in a browser tab:
   a) ^O to open a file;
   b) select .../piglit-results/sq.ppc64le.mesa-17.1.2/index.html
   c) narrow the view by selecting "problems"
   d) find the two tests under arb_vertex_attrib_64bit; click on "fail" in the
rightmost column
   e) Note multiple color discrepancies: Expected 0 255 0 255, Observed 0 0 255
0


Results: See 12(e) immediately above

Expected Results: No color discrepancy messages; "pass"

Additional info:

Installed on my PPC64LE system:
llvm.ppc64le                    3.9.1-2.fc25           @updates                 
llvm-devel.ppc64le              3.9.1-2.fc25           @updates                 
llvm-libs.ppc64le               3.9.1-2.fc25           @updates

Commands to run the failing tests (in Piglit dir):

bin/shader_runner \
   
$HOME/piglit/generated_tests/spec/arb_vertex_attrib_64bit/execution/vs_in/vs-input-float_mat3x4-position-double_dmat4x3.shader_test
-auto -fbo 

bin/shader_runner \
   
$HOME/piglit/generated_tests/spec/arb_vertex_attrib_64bit/execution/vs_in/vs-input-position-double_dmat3-float_mat2_array3.shader_test
-auto -fbo

Enabling/disabling Mesa debug output:

export LIBGL_DEBUG=verbose
export MESA_DEBUG=verbose
export MESA_GLSL=""
export MESA_GLSL="dump log uniform useprog errors"
export GALLIVM_DEBUG="tgsi ir asm dumpbc"
export ST_DEBUG=tgsi

These are very useful when you're debugging Mesa; you will see the
shader program source at several levels, including LLVM IR.
BUT they must all be blank when you're running Piglit, otherwise
the Piglit run will take a VERY long time and the 'summary' step
will not work.

THE TESTS CAN BE MADE TO PASS BY DISABLING VSX code generation; I added
the following patch to lp_bld_misc.cpp to gain finer control over +VSX/-VSX
code generation:

--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -624,7 +624,10 @@
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
     * See LLVM bug <a href="https://llvm.org/bugs/show_bug.cgi?id=26775">https://llvm.org/bugs/show_bug.cgi?id=26775</a>
     */
    if (util_cpu_caps.has_altivec) {
-      MAttrs.push_back("+vsx");
+      if (getenv("GALLIVM_PPC_NO_VSX"))
+         MAttrs.push_back("-vsx");
+      else
+         MAttrs.push_back("+vsx");
    }
 #endif
 #endif</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>