public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, Jan Hubicka <hubicka@ucw.cz>,
	       Michael Matz <matz@suse.de>
Subject: Re: Speed up genattrtab
Date: Thu, 17 Jun 2010 10:21:00 -0000	[thread overview]
Message-ID: <20100617093816.GU7811@tyan-ft48-01.lab.bos.redhat.com> (raw)
In-Reply-To: <4C1940B2.70206@codesourcery.com>

On Wed, Jun 16, 2010 at 02:22:58PM -0700, Mark Mitchell wrote:
> Jakub Jelinek wrote:
> 
> > 2010-06-16  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	* Makefile.in (cfgexpand.o): Depend on $(INSN_ATTR_H).
> > 	* genattrtab.c (check_tune_attr, find_tune_attr): New functions.
> 
> This should have no impact on compile-time for things compiled with GCC,
> correct?  If so, for avoidance of doubt, while I haven't reviewed the
> patch in detail, I certainly have no objections to it.  Let me know if

It has compile time impact, but a mixed one.  The negative performance
impact is that internal_dfa_insn_code and insn_default_latency calls
are no longer direct function calls (on the targets which have some cpu/tune
attribute tested in all reservations), but are function pointers and thus
indirect calls.  The pointer isn't changing much usually though (unless
optimized/target attribute/pragma is used, it shouldn't change at all).
How much this costs depends on the host CPU (and whether the host CPU
is able to cache target CPU if the fn pointer isn't changing;
currently the init_sched_attrs call which is called once per function
always writes the fn pointers, usually with the same value as it already has
- would it help for some host CPUs if the function instead computed the
fn pointers into temporary variable and wrote the fn pointer var only
if the temporary is different from its current contents?).

The advantage is that the text size of the functions shrinks a lot
(at least on the architectures I've looked at - i?86/x86_64, powerpc{,64}
and s390{,x} the .text size of all the per tuning functions together
is smaller than the .text size of the old monster functions, the sum of
all the per tuning function .rodata sizes (jump tables) usually slightly
grew, but still for each individual function both sizes are much smaller),
which means that unless optimize/target attribute is used heavily and every
function uses different tuning, the new code is much more i-cache and
d-cache friendly.  Plus, many extract_insn_cached or
extract_constrain_insn_cached calls could go away - if say only one tuning
was interested in that additional info and all others don't care for
some particular insn, the new code will call it only in the function
for the tuning that needs it and not in the other tuning functions.

The last arch I've looked at was arm - there the patch doesn't make any
difference (except for #define init_sched_attrs() do { } while (0) in
insn-attr.h) because arm currently doesn't have a single const attribute
that is used in tests for all reservations.  The solution there could be
to create a new const attribute that would combine the attributes currently
used in define_insn_reservation tests (say a bitfield containing the other
attrs), will leave that to arm maintainers if they wish to do that.

	Jakub

  reply	other threads:[~2010-06-17  9:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 16:58 Michael Matz
2010-06-15 17:37 ` Mark Mitchell
2010-06-15 17:37   ` Jan Hubicka
2010-06-15 19:13     ` Mark Mitchell
2010-06-15 19:17       ` Ralf Wildenhues
2010-06-15 19:22       ` Jakub Jelinek
2010-06-16 15:42         ` Jakub Jelinek
2010-06-16 15:59           ` Jan Hubicka
2010-06-16 20:27           ` Jakub Jelinek
2010-06-16 21:50             ` Mark Mitchell
2010-06-17 10:21               ` Jakub Jelinek [this message]
2010-06-17 11:50                 ` Jan Hubicka
2010-06-17 13:39                 ` Michael Matz
2010-06-17 15:24                   ` Mark Mitchell
2010-06-17 18:09                     ` Michael Matz
2010-06-17 18:44                       ` Mark Mitchell
2010-06-17 12:27             ` Jakub Jelinek
2010-06-16  9:32       ` Richard Guenther
2010-06-16 14:30         ` Nathan Froyd
2010-06-16 14:33           ` Michael Matz
2010-06-16 14:43             ` Nathan Froyd
2010-06-16 15:33               ` Mike Stump
2010-06-16 15:48               ` Michael Matz
2010-06-16 15:57                 ` Jan Hubicka
2010-06-16 17:21                   ` Paolo Bonzini
2010-06-17 11:56                     ` Michael Matz
2010-06-17 12:08                       ` Jan Hubicka
2010-06-17 12:20                         ` Michael Matz
2010-06-17 12:26                           ` Jan Hubicka
2010-06-17 12:14                       ` Paolo Bonzini
2010-06-15 17:59   ` Dave Korn
2010-06-15 20:30     ` Paolo Bonzini
2010-06-15 20:34       ` Paolo Bonzini
2010-06-15 22:03     ` David Daney
  -- strict thread matches above, loose matches on Subject: below --
2004-07-13 20:28 Segher Boessenkool
2004-07-13 20:35 ` Segher Boessenkool
2004-07-15  2:26   ` Vladimir Makarov
2004-07-15 18:04     ` Ranjit Mathew
2004-07-16 13:19       ` Zack Weinberg
2004-07-16 14:38     ` Segher Boessenkool

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=20100617093816.GU7811@tyan-ft48-01.lab.bos.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mark@codesourcery.com \
    --cc=matz@suse.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).