public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* FDO for optimal linker map
@ 2022-05-26  5:53 Yitschak, Yehuda
  2022-05-26 19:14 ` Alexander Monakov
  0 siblings, 1 reply; 2+ messages in thread
From: Yitschak, Yehuda @ 2022-05-26  5:53 UTC (permalink / raw)
  To: gcc-help

Hello

I am learned about GCC FDO capabilities but AFAICT it doesn't effect the function layout which the linker generates
My intention is to use the feedback data to create an optimal function layout to minimize I-cache misses.
Meaning to group the most frequently accessed functions together and perhaps even order them  to utilize cache prefetch better.

Is there anyway to achieve that in GCC  ?

Thanks a lot

Yehuda

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

* Re: FDO for optimal linker map
  2022-05-26  5:53 FDO for optimal linker map Yitschak, Yehuda
@ 2022-05-26 19:14 ` Alexander Monakov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Monakov @ 2022-05-26 19:14 UTC (permalink / raw)
  To: Yitschak, Yehuda; +Cc: gcc-help

On Thu, 26 May 2022, Yitschak, Yehuda via Gcc-help wrote:

> Hello
> 
> I am learned about GCC FDO capabilities but AFAICT it doesn't effect the
> function layout which the linker generates
> My intention is to use the feedback data to create an optimal function layout
> to minimize I-cache misses.
> Meaning to group the most frequently accessed functions together and perhaps
> even order them  to utilize cache prefetch better.
> 
> Is there anyway to achieve that in GCC  ?

Yes. The compiler can select some order of functions, and place functions in
separate sections named .text.sorted.NNNN, and then the linker can emit the
sections in desired order (new Binutils linker handles .text.sorted.N
automatically, for older linkers you can pass --sort-section=name).

As you probably know, coming up with a good reordering is the hard part. There
is an experimental GCC patch that implements C3 reordering algorithm:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-09/msg01142.html

Alexander

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

end of thread, other threads:[~2022-05-26 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26  5:53 FDO for optimal linker map Yitschak, Yehuda
2022-05-26 19:14 ` Alexander Monakov

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