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

            Bug ID: 113645
           Summary: [amdgcn][gfx1030][gfx1100] ICE in RTL pass: vregs with
                    -O3: unrecognizable insn (vector reductions)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: ams at gcc dot gnu.org
  Target Milestone: ---
            Target: amdgcn-amdhsa

Created attachment 57247
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57247&action=edit
Testcase, compile with gcc -fopenmp -O3 -foffload-options=-march=gfx1030 or
gfx1100

Found for BabelStream when compiling with AMD GPU offloading for gfx1030 or
gfx1100 and using -O3.

# git clone https://github.com/UoB-HPC/BabelStream
# cd BabelStream; mkdir build; cd build
# cmake .. -DMODEL=omp
-DCMAKE_CXX_COMPILER=$HOME/projects/gcc-trunk-offload/bin/g++ -DOFFLOAD=ON
-DCXX_EXTRA_FLAGS=-foffload=amdgcn-amdhsa=-march=gfx1100 -fopenmp
# make

 * * *

Simplified testcase attached, compile with:

gcc  -fopenmp -foffload=amdgcn-amdhsa \
     -foffload-options=amdgcn-amdhsa=-march=gfx1030 -O3

or, likewise, gfx1100.

 * * *

foo.c:5:9: error: unrecognizable insn:
    5 |   #pragma omp target teams distribute parallel for simd map(tofrom:
sum) reduction(+:sum)
      |         ^
(insn 144 143 145 10 (set (reg:V16SF 926)
        (unspec:V16SF [
                (reg:V16SF 922) repeated x2
                (const_int 1 [0x1])
            ] UNSPEC_PLUS_DPP_SHR)) "foo.c":5:9 -1
     (nil))
during RTL pass: vregs
foo.c:5:9: internal compiler error: in extract_insn, at recog.cc:2812
0x7f6b21 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/tob/repos/gcc/gcc/rtl-error.cc:108
0x7f6b3d _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /home/tob/repos/gcc/gcc/rtl-error.cc:116
0x7f55e4 extract_insn(rtx_insn*)
        /home/tob/repos/gcc/gcc/recog.cc:2812
0xb6b860 instantiate_virtual_regs_in_insn
        /home/tob/repos/gcc/gcc/function.cc:1611
0xb6b860 instantiate_virtual_regs
        /home/tob/repos/gcc/gcc/function.cc:1994
0xb6b860 execute
        /home/tob/repos/gcc/gcc/function.cc:2041

Reply via email to