public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: sgk@troutmask.apl.washington.edu,
	"Thompson," Matt "(GSFC-610.1)[SCIENCE" SYSTEMS AND APPLICATIONS
	"INC]" via Fortran <fortran@gcc.gnu.org>
Cc: Thomas Koenig <tkoenig@netcologne.de>
Subject: Re: [EXTERNAL] Re: Advice with finding speed between O2 and O3
Date: Thu, 25 May 2023 20:51:02 +0200	[thread overview]
Message-ID: <ae39a9bd-6eee-beea-8dbf-5663affe3732@gmx.de> (raw)
In-Reply-To: <ZG+UUqGfELQfcqGk@troutmask.apl.washington.edu>

Am 25.05.23 um 19:01 schrieb Steve Kargl:
> On Thu, May 25, 2023 at 04:05:11PM +0000, Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] via Fortran wrote:
>> Thomas,
>>
>> Well, the code did not change. Period. Neither did the compiler. It was 12.3. (We can't use GCC 13 because it seems not to like something in our advanced Fortran code (lots of OO, submodules, string fun...)).
>>
>> And I did a run with essentially all the GNU checks on (our Debug build mode) and it happily runs!
>>
>> That said, I did some further tests and I am *really* confused. This fails:
>>
>> -O3 -march=haswell -mtune=generic -funroll-loops -g
>>
>> And this works:
>>
>> -O2 -march=haswell -mtune=generic -funroll-loops -g
>>
>> Now I just tried:
>>
>> -O2     -fgcse-after-reload    -fipa-cp-clone    -floop-interchange    -floop-unroll-and-jam    -fpeel-loops    -fpredictive-commoning    -fsplit-loops    -fsplit-paths    -ftree-loop-distribution    -ftree-partial-pre    -funroll-completely-grow-size    -funswitch-loops    -fversion-loops-for-strides  -march=haswell -mtune=generic -funroll-loops -g
>>
>> which as far as I can see from the gcc man page:
>>
>>         -O3 Optimize yet more.  -O3 turns on all optimizations specified by -O2 and also turns on the following optimization flags:
>>
>>             -fgcse-after-reload -fipa-cp-clone -floop-interchange -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops -fsplit-paths -ftree-loop-distribution -ftree-partial-pre -funswitch-loops
>>             -fvect-cost-model=dynamic -fversion-loops-for-strides
>>
>> means I am running essentially -O3.
>>
>> But it works.
>>
>> I'm...baffled. Is there something that *gfortran* enables with -O3 that isn't visible from the *gcc* man page?
>>

When I look at the complete *difference* of
   gfortran-12 -c -Q --help=optimizers
between -O2 and -O3, I see other differing parameters:

-  -fvect-cost-model=[unlimited|dynamic|cheap|very-cheap]       very-cheap

+  -fvect-cost-model=[unlimited|dynamic|cheap|very-cheap]       dynamic

Could these be relevant?

Harald


      reply	other threads:[~2023-05-25 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 15:31 Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]
2023-05-22 21:36 ` Thomas Koenig
2023-05-25 16:05   ` [EXTERNAL] " Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC]
2023-05-25 17:01     ` Steve Kargl
2023-05-25 18:51       ` Harald Anlauf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae39a9bd-6eee-beea-8dbf-5663affe3732@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).