https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121412

            Bug ID: 121412
           Summary: AArch64 SVE VLS vs VLA ICE building Pytorch with LTO
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: aarch64-sve
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Created attachment 62056
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62056&action=edit
First foo.ii reproducer

Trying to build Pytorch for aarch64 with LTO encounters ICEs. The build process
is complex and has many dependent packages, including the Sleef vector math
library.

I've reduced the ICE to two files that need to be compiled with -flto=auto and
different options and linked together with LTO to trigger it:
foo.ii:45:24: warning: type of ‘Sleef_hypotfx_u05sve’ does not match original
declaration [-Wlto-type-mismatch]
   45 | extern "C" svfloat32_t Sleef_hypotfx_u05sve(int, svfloat32_t);
      |                        ^
sleeffoo.i:10:6: note: return value type mismatch
   10 | void Sleef_hypotfx_u05sve() {
      |      ^
sleeffoo.i:10:6: note: type ‘void’ should match type ‘svfloat32_t’
sleeffoo.i:10:6: note: ‘Sleef_hypotfx_u05sve’ was previously declared here
during RTL pass: expand
sleeffoo.i: In function ‘Sleef_hypotfx_u05sve’:
sleeffoo.i:10:6: internal compiler error: in to_constant, at poly-int.h:592
   10 | void Sleef_hypotfx_u05sve() {
      |      ^
0x216bf1b internal_error(char const*, ...)
        $SRC/gcc/diagnostic-global-context.cc:534
0x880b1f fancy_abort(char const*, int, char const*)
        ../../../local-checkouts/gcc/gcc/diagnostics/context.cc:1640
0x858427 poly_int<2u, unsigned long>::to_constant() const
        ../../../local-checkouts/gcc/gcc/poly-int.h:592
0xa7826f poly_int<2u, unsigned long>::to_constant() const
        ../../../local-checkouts/gcc/gcc/expmed.cc:1069
0xa7826f store_bit_field_1
        ../../../local-checkouts/gcc/gcc/expmed.cc:852
0xa7834b store_bit_field(rtx_def*, poly_int<2u, unsigned long>, poly_int<2u,
unsigned long>, poly_int<2u, unsigned long>, poly_int<2u, unsigned long>,
machine_mode, rtx_def*, bool, bool)
        ../../../local-checkouts/gcc/gcc/expmed.cc:1213
0xaabecb store_field
        ../../../local-checkouts/gcc/gcc/expr.cc:8336
0xaa70af expand_assignment(tree_node*, tree_node*, bool)
        ../../../local-checkouts/gcc/gcc/expr.cc:6334
0xaa70af expand_assignment(tree_node*, tree_node*, bool)
        ../../../local-checkouts/gcc/gcc/expr.cc:5971
0x955f17 expand_gimple_stmt_1
        ../../../local-checkouts/gcc/gcc/cfgexpand.cc:4301
0x955f17 expand_gimple_stmt
        ../../../local-checkouts/gcc/gcc/cfgexpand.cc:4382
0x957bc7 expand_gimple_basic_block
        ../../../local-checkouts/gcc/gcc/cfgexpand.cc:6501
0x959c53 execute
        ../../../local-checkouts/gcc/gcc/cfgexpand.cc:7248
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [/tmp/ccmV8waU.mk:2: /tmp/ccvzJOnl.ltrans0.ltrans.o] Error 1

The compile commands are:
gcc  -O3 -march=armv8-a+sve  -o sleeffoo.o -flto=auto -c sleeffoo.i  -w
g++ -march=armv8-a+sve -msve-vector-bits=256 -flto=auto  -O2 -o foo.o -c foo.ii
-w
g++ -flto=auto    -O2     foo.o  sleeffoo.o

One file is compiled with -msve-vector-bits=256 and the other is without i.e.
for VLA SVE.
I don't know if this kind of -msve-vector-bits calling is supported, but it
doesn't ICE without LTO so if it's not supported we should at least have a way
of gracefully erroring out

Reply via email to