public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast
@ 2022-01-19 23:58 meissner at gcc dot gnu.org
  2022-01-20  0:00 ` [Bug target/104136] " meissner at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-19 23:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104136
           Summary: Gcc cannot compile wrf_r for power10 using -Ofast
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meissner at gcc dot gnu.org
  Target Milestone: ---

Using the current trunk compiler (from January 18th, 2022), I cannot compile
the module_advect_em fortran module with either -Ofast or -O3 using my normal
spec build options.  The reason is GCC generates a conditional jump
instruction, and the label is too far away.  This means the length insn
attribute is incorrect for one or more instructions, and GCC believes it does
not have to reverse the conditional jump. 

If I disable the generation of vector constants using the XXSPLTIW instruction
via -mno-splat-word-constant option, the module compiles fine.  Enabling or
disabling the XXSPLTIDP instruction with -mno-splat-float-constant does not
affect whether the file can be compiled, only disabling XXSPLTIW.

I used the following options build the module:
-g -Ofast -mcpu=power10 -finline-arg-packing \
-static-libgfortran -fstack-arrays -std=legacy \
-frandom-seed=spec2017 -fconvert=big-endian \
-fno-range-check -fcray-pointer

With those options, there are 646 XXSPLTIW instructions generated and 558
XXSPLTIDP instructions generated.  The size of the
__module_advect_em_MOD_advect_scalar function is 335,440 bytes.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
@ 2022-01-20  0:00 ` meissner at gcc dot gnu.org
  2022-01-20 18:27 ` meissner at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-20  0:00 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
           Severity|normal                      |critical
               Host|                            |powerpc64le-unknown-linux-g
                   |                            |nu
           Assignee|unassigned at gcc dot gnu.org      |meissner at gcc dot gnu.org
             Target|                            |powerpc64le-unknown-linux-g
                   |                            |nu
   Last reconfirmed|                            |2022-01-20
              Build|                            |powerpc64le-unknown-linux-g
                   |                            |nu
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
                 CC|                            |bergner at gcc dot gnu.org,
                   |                            |meissner at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org,
                   |                            |wschmidt at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
  2022-01-20  0:00 ` [Bug target/104136] " meissner at gcc dot gnu.org
@ 2022-01-20 18:27 ` meissner at gcc dot gnu.org
  2022-01-20 19:48 ` meissner at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-20 18:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Michael Meissner <meissner at gcc dot gnu.org> ---
Created attachment 52244
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52244&action=edit
Patch to mark XXSPLTIW and XXSPLTIDP as possibly being prefixed

If you compile module_advect_em.F90 with -Ofast -mcpu=power10, one module
is large enough that we can't use a single conditional jump to span the
function.  Instead, we have to reverse the condition, and do a conditional
jump around an unconditional branch.  It turns out when xxspltiw and
xxspltdp instructions were generated, they were not marked as being
prefixed (i.e. length of 12 bytes instead of 4 bytes).  This meant the
calculations for the branch length were off, which in turn meant the
assembler raised an error because it couldn't do the conditional jump.

The fix is to set the maybe_prefixed attribute so that insns with the type
'vecperm' might be prefixed.  Then in the code that optionally puts a 'p'
in front of the insn skip doing so for the permutes (i.e. load constant
with splat instruction).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
  2022-01-20  0:00 ` [Bug target/104136] " meissner at gcc dot gnu.org
  2022-01-20 18:27 ` meissner at gcc dot gnu.org
@ 2022-01-20 19:48 ` meissner at gcc dot gnu.org
  2022-01-21 19:51 ` meissner at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-20 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #52244|0                           |1
        is obsolete|                            |

--- Comment #2 from Michael Meissner <meissner at gcc dot gnu.org> ---
Created attachment 52246
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52246&action=edit
Replacement patch to set prefixed attribute.

This patch explicitly sets the prefixed attribute for the xxspltiw and
xxspltidp instructions instead of modifying maybe_prefixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-20 19:48 ` meissner at gcc dot gnu.org
@ 2022-01-21 19:51 ` meissner at gcc dot gnu.org
  2022-01-21 23:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-21 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #52246|0                           |1
        is obsolete|                            |

--- Comment #3 from Michael Meissner <meissner at gcc dot gnu.org> ---
Created attachment 52262
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52262&action=edit
Updated patch to make xxspltiw/xxspltidp set the prefixed attribute

Replacement patch.  Submitted to gcc-patches:
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589052.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-21 19:51 ` meissner at gcc dot gnu.org
@ 2022-01-21 23:09 ` cvs-commit at gcc dot gnu.org
  2022-01-22  2:34 ` meissner at gcc dot gnu.org
  2022-01-22  2:35 ` meissner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-21 23:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Michael Meissner <meissner@gcc.gnu.org>:

https://gcc.gnu.org/g:f9063d12633c62a089115df032a19295854d8b06

commit r12-6812-gf9063d12633c62a089115df032a19295854d8b06
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Fri Jan 21 18:08:50 2022 -0500

    Mark XXSPLTIW/XXSPLTIDP as prefixed -- PR 104136

    If you compile module_advect_em.F90 with -Ofast -mcpu=power10, one module
    is large enough that we can't use a single conditional jump to span the
    function.  Instead, GCC has to reverse the condition, and do a conditional
    jump around an unconditional branch.  It turns out when xxspltiw and
    xxspltdp instructions were generated, they were not marked as being
    prefixed (i.e. length of 12 bytes instead of 4 bytes).  This meant the
    calculations for the branch length were off, which in turn meant the
    assembler raised an error because it couldn't do the conditional jump.

    The fix is to explicitly set the prefixed attribute when we are loading up
    vector constants with the xxspltiw or xxspltidp instructions.

    I have removed the code that sets the prefixed attribute for xxspltiw,
    xxspltidp, and xxsplti32dx instructions, since it no longer will be
invoked.

    I have also explicitly set the prefixed attribute for load SF and DF mode
    constants with xxsplitw and xxspltidp.  Previously, it was not set on these
    insns, but when the insn was split to get the XXSPLTIW/XXSPLTIDP forms,
those
    forms already had the prefixed attribute set.

    2022-01-21  Michael Meissner  <meissner@the-meissners.org>

    gcc/
            PR target/104136
            * config/rs6000/rs6000-protos.h (prefixed_xxsplti_p): Delete.
            * config/rs6000/rs6000.cc (prefixed_xxsplti_p): Delete.
            * config/rs6000/rs6000.md (prefixed attribute): Delete section
            that sets the prefixed attribute for xxspltiw, xxspltidp, and
            xxsplti32dx instructions.
            (movsf_hardfloat): Explicitly set the prefixed attribute
            when xxspltiw and xxspltidp instructions are generated.
            (mov<mode>_hardfloat32): Likewise.
            (mov<mode>_hardfloat64): Likewise.
            * config/rs6000/vsx.md (vsx_mov<mode>_64bit): Explicitly set the
            prefixed attribute for xxspltiw and xxspltidp instructions.
            (vsx_mov<mode>_32bit): Likewise.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-21 23:09 ` cvs-commit at gcc dot gnu.org
@ 2022-01-22  2:34 ` meissner at gcc dot gnu.org
  2022-01-22  2:35 ` meissner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-22  2:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Michael Meissner <meissner at gcc dot gnu.org> ---
Fixed in commit f9063d12633c62a089115df032a19295854d8b06 on January 21, 2022.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/104136] Gcc cannot compile wrf_r for power10 using -Ofast
  2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-22  2:34 ` meissner at gcc dot gnu.org
@ 2022-01-22  2:35 ` meissner at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: meissner at gcc dot gnu.org @ 2022-01-22  2:35 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Michael Meissner <meissner at gcc dot gnu.org> ---
Fixed as per previous message.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-22  2:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 23:58 [Bug target/104136] New: Gcc cannot compile wrf_r for power10 using -Ofast meissner at gcc dot gnu.org
2022-01-20  0:00 ` [Bug target/104136] " meissner at gcc dot gnu.org
2022-01-20 18:27 ` meissner at gcc dot gnu.org
2022-01-20 19:48 ` meissner at gcc dot gnu.org
2022-01-21 19:51 ` meissner at gcc dot gnu.org
2022-01-21 23:09 ` cvs-commit at gcc dot gnu.org
2022-01-22  2:34 ` meissner at gcc dot gnu.org
2022-01-22  2:35 ` meissner at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).