public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Details on -fprofile-use and associated optimization flags
@ 2011-06-03 18:04 Paul Dovydaitis
  2011-06-03 20:13 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Dovydaitis @ 2011-06-03 18:04 UTC (permalink / raw)
  To: gcc-help

Hello,

I have been playing around with the profile guided optimization flags
in GCC and had a few questions.  I actually noticed that with the
particular application I was profiling, I in some cases got worse
results after recompiling with -fprofile-use and re-running the same
test I used to generate the profile.

I could not find any detailed documentation about how the profile is
applied during the optimization steps, but my working hypothesis is as
follows.  The application in question is very latency sensitive, so it
spins in a tight loop while polling for data from various sources.
When data is received, it then processes it – and this processing is
the portion in which speed is most important and which I am timing.
If one were to look at hit counts for individual functions or source
lines, though, it would appear that the polling loop was “hot” while
everything else by comparison was extremely “cold”.  Global
optimizations that use this sort of data would then likely hurt,
rather than help those processing times.

What optimizations does -fprofile-use turn on that would be sensitive
to this sort of behavior?  Does this seem like a reasonable
explanation, and if so is there anything I can tweak to help?  The
specific flags that -fprofile-use turns on (-fbranch-probabilities,
-fvpt, -funroll-loops, -fpeel-loops and –ftracer) don’t seem like they
would be affected since these optimizations appear local in scope, but
I assume there are other things happening under the hood.

Regards,
Paul

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

* Re: Details on -fprofile-use and associated optimization flags
  2011-06-03 18:04 Details on -fprofile-use and associated optimization flags Paul Dovydaitis
@ 2011-06-03 20:13 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-06-03 20:13 UTC (permalink / raw)
  To: Paul Dovydaitis; +Cc: gcc-help

Paul Dovydaitis <paul.dovy@gmail.com> writes:

> I have been playing around with the profile guided optimization flags
> in GCC and had a few questions.  I actually noticed that with the
> particular application I was profiling, I in some cases got worse
> results after recompiling with -fprofile-use and re-running the same
> test I used to generate the profile.
>
> I could not find any detailed documentation about how the profile is
> applied during the optimization steps, but my working hypothesis is as
> follows.  The application in question is very latency sensitive, so it
> spins in a tight loop while polling for data from various sources.
> When data is received, it then processes it – and this processing is
> the portion in which speed is most important and which I am timing.
> If one were to look at hit counts for individual functions or source
> lines, though, it would appear that the polling loop was “hot” while
> everything else by comparison was extremely “cold”.  Global
> optimizations that use this sort of data would then likely hurt,
> rather than help those processing times.

While it's hard to know for sure, your explanation is plausible.

> What optimizations does -fprofile-use turn on that would be sensitive
> to this sort of behavior?  Does this seem like a reasonable
> explanation, and if so is there anything I can tweak to help?  The
> specific flags that -fprofile-use turns on (-fbranch-probabilities,
> -fvpt, -funroll-loops, -fpeel-loops and –ftracer) don’t seem like they
> would be affected since these optimizations appear local in scope, but
> I assume there are other things happening under the hood.

Profiling affects inlining decisions.

Ian

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

end of thread, other threads:[~2011-06-03 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 18:04 Details on -fprofile-use and associated optimization flags Paul Dovydaitis
2011-06-03 20:13 ` Ian Lance Taylor

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).