[llvm-bugs] [Bug 49217] New: [SVE] incorrect code is generated from -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 17 00:32:13 PST 2021


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

            Bug ID: 49217
           Summary: [SVE] incorrect code is generated from -O2
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gilles at rist.or.jp
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

GROMACS 2021 is not working any more with the latest main branch on SVE
architectures.

git bisect pointed to commit 42635856ed3c9a05957640f9deb50cf865c03825
https://reviews.llvm.org/rG42635856ed3c9a05957640f9deb50cf865c03825
and reverting this commit (with de3a485d9c391c44e2c90f79bbf8ac13d49d9fb6 for an
unrelated reason) fixed the issue.

I build LLVM with

cmake -DLLVM_ENABLE_PROJECTS='clang;libcxx;libcxxabi;libunwind;ldd;openmp'
-DCMAKE_BUILD_TYPE=Release ...

and then downloaded GROMACS from
https://ftp.gromacs.org/gromacs/gromacs-2021.tar.gz
and ran on A64fx


cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ 
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DGMX_OPENMP=off -DGMX_MPI=off
-DGMX_DOUBLE=$double -DGMX_FFT_LIBRARY=fftpack ...
make
./bin/gmx nonbonded-benchmark -nt 1 -iter 1 -warmup 1 -time -all 


The issue occurs with 128, 256 and 512bits SVE vector length.
The issue does not occur if configured with -DCMAKE_BUILD_TYPE=Debug

If GROMACS is built on a non SVE system, the extra parameters must be passed to
cmake
-DGMX_SIMD=ARM_SVE -DGMX_SIMD_ARM_SVE_LENGTH=512

(feel free to replace 512 with 128 or 256, and run with the same vector length,
since GROMACS is not VLA)


Here is the stack trace


$ gdb bin/gmx
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-6.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bin/gmx...done.
(gdb) r nonbonded-benchmark -nt 1 -iter 1 -warmup 1 -time -all
Starting program:
/home/users/u0001043/build/gromacs-2021/llvm-main/RelWithDebInfo/512-single/bin/gmx
nonbonded-benchmark -nt 1 -iter 1 -warmup 1 -time -all
Missing separate debuginfos, use: yum debuginfo-install
glibc-2.28-72.el8_1.1.aarch64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
                :-) GROMACS - gmx nonbonded-benchmark, 2021 (-:

                            GROMACS is written by:
     Andrey Alekseenko              Emile Apol              Rossen Apostolov    
         Paul Bauer           Herman J.C. Berendsen           Par Bjelkmar      
       Christian Blau           Viacheslav Bolnykh             Kevin Boyd       
     Aldert van Buuren           Rudi van Drunen             Anton Feenstra     
    Gilles Gouaillardet             Alan Gray               Gerrit Groenhof     
       Anca Hamuraru            Vincent Hindriksen          M. Eric Irrgang     
      Aleksei Iupinov           Christoph Junghans             Joe Jordan       
    Dimitrios Karkoulis            Peter Kasson                Jiri Kraus       
      Carsten Kutzner              Per Larsson              Justin A. Lemkul    
       Viveca Lindahl            Magnus Lundborg             Erik Marklund      
        Pascal Merz             Pieter Meulenhoff            Teemu Murtola      
        Szilard Pall               Sander Pronk              Roland Schulz      
       Michael Shirts            Alexey Shvetsov             Alfons Sijbers     
       Peter Tieleman              Jon Vincent              Teemu Virolainen    
     Christian Wennberg            Maarten Wolf              Artem Zhmurov      
                           and the project leaders:
        Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2019, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out http://www.gromacs.org for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS:      gmx nonbonded-benchmark, version 2021
Executable:  
/home/users/u0001043/build/gromacs-2021/llvm-main/RelWithDebInfo/512-single/bin/gmx
Data prefix:  /home/users/u0001043/src/gromacs-2021 (source tree)
Working dir: 
/home/users/u0001043/build/gromacs-2021/llvm-main/RelWithDebInfo/512-single
Command line:
  gmx nonbonded-benchmark -nt 1 -iter 1 -warmup 1 -time -all

SIMD width:           16
System size:          3000 atoms
Cut-off radius:       1 nm
Number of threads:    1
Number of iterations: 1
Compute energies:     no
Ewald excl. corr.:    analytical

Coulomb LJ   comb. SIMD       usec         usec/it.        pairs/usec
                                                        total      useful
Ewald   all  geom. 2xMM      31013.13     31013.130     44.162     20.306
Ewald   all  LB    2xMM      31077.04     31077.040     44.071     20.264

Program received signal SIGSEGV, Segmentation fault.
0x0000ffffbd81d7c4 in gmx::SimdFIBool::SimdFIBool (this=<optimized out>,
simd=...) at
/home/users/u0001043/src/gromacs-2021/src/gromacs/simd/impl_arm_sve/impl_arm_sve_simd_float.h:109
109         SimdFIBool(svbool_t simd) { this->simdInternal_ =
svdup_n_u32_z(simd, 0xFFFFFFFF); }
Missing separate debuginfos, use: yum debuginfo-install
libgcc-8.3.1-4.5.el8.aarch64 libstdc++-8.3.1-4.5.el8.aarch64
(gdb) bt
#0  0x0000ffffbd81d7c4 in gmx::SimdFIBool::SimdFIBool (this=<optimized out>,
simd=...) at
/home/users/u0001043/src/gromacs-2021/src/gromacs/simd/impl_arm_sve/impl_arm_sve_simd_float.h:109
#1  gmx::testBits (a=...) at
/home/users/u0001043/src/gromacs-2021/src/gromacs/simd/impl_arm_sve/impl_arm_sve_simd_float.h:559
#2  gmx_load_simd_2xnn_interactions (excl=<optimized out>, filter_S0=<error
reading variable: Cannot access memory at address 0xffffffffffff7b08>, 
    filter_S2=<error reading variable: Cannot access memory at address
0xffffffffffff7ac8>, interact_S0=<optimized out>, interact_S2=<optimized out>)
    at
/home/users/u0001043/src/gromacs-2021/src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h:104
#3  nbnxm_kernel_ElecEw_VdwLJCombLB_F_2xmm (nbl=0x44ef40, nbat=<optimized out>,
ic=<optimized out>, shift_vec=0x45f3b0, out=<optimized out>)
    at
/home/users/u0001043/src/gromacs-2021/src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h:222

-- 
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/20210217/47603f35/attachment-0001.html>


More information about the llvm-bugs mailing list