public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joern Rennecke <amylaar@spamcop.net>
To: Grigori Fursin <grigori.fursin@inria.fr>
Cc: ctuning-discussions@googlegroups.com,
	'Zbigniew Chamski' 	<zbigniew.chamski@gmail.com>,
	'Richard Guenther' 	<richard.guenther@gmail.com>,
	'Basile STARYNKEVITCH' 	<basile@starynkevitch.net>,
	'Ian Lance Taylor' <iant@google.com>,
		"'GCC	Mailing List'" <gcc@gcc.gnu.org>,
	'Albert Cohen' 	<Albert.Cohen@inria.fr>,
	'Yuri Kashnikoff' <yuri.kashnikoff@gmail.com>,
		'Yuanjie Huang' <huangyuanjie@ict.ac.cn>,
	'Liang Peng' 	<pengliang@ict.ac.cn>,
	dorit@il.ibm.com, 'Mircea Namolaru' 	<NAMOLARU@il.ibm.com>,
	'Diego Novillo' <dnovillo@google.com>
Subject: RE: [plugins-ici-cloning-instrumentation] new GCC plugin 	developements
Date: Mon, 09 Nov 2009 18:15:00 -0000	[thread overview]
Message-ID: <20091109131505.im6ygit3wgkgcw84-nzlynne@webmail.spamcop.net> (raw)
In-Reply-To: <20091108204326.rmzkdcuj48s0o4cg-nzlynne@webmail.spamcop.net>

Quoting Joern Rennecke <amylaar@spamcop.net>:
> I think we could have the ICI event flexibility/stability with lower
> overhead if the event sender requests an event identifier number (which
> can be allocated after the numbers of the gcc 4.5 static event enum values)
> for an event name at or before the first event with that name, and then
> sends this identifier number with one or more pointers, which might point
> to internal gcc data structures, and a pointer to a function to look up
> the address of a named parameter.  The event sender site source code can
> then provide information to build the lookup functions at build time,
> e.g. using gperf.

I thought a bit more about this, and decided that using gperf-generated hash
tables is probably overkill.

It is useful to have provisions for the event generator and the event
callback being somewhat out of step, but do we really have to cater
for multiple sources of the same event providing their parameters in
a different way?
If there is only one way to find a parameter with a particular name for
a particular event (for a given combination of compiler binary and plugins),
that this can be defined with an accessor function, which would  
generally be defined in the same module which raises the event.
Actually, if we passed around the dso which raises the event, we could
dynamically look up the accessor function to allow co-existence of different
accessor functions for the same event::parameter tuple, but I don't think
there is a need for that.

Here is an example of how I think we can reduce the overhead while keeping
a good amount of flexibility; in loop-unroll.c we currently have:
         /* Code for loop-unrolling ICI decision enabling.  */
         register_event_parameter ("loop->num", &(loop->num));
         register_event_parameter ("loop->ninsns", &(loop->ninsns));
         register_event_parameter ("loop->av_ninsns", &(loop->av_ninsns));

         register_event_parameter ("loop->lpt_decision.times",  
&(loop->lpt_decision.times));
         register_event_parameter ("loop->lpt_decision.decision",  
&(loop->lpt_decision.decision));
         register_event_parameter ("loop->lpt_decision.unroll_runtime",
               loop->lpt_decision.decision == LPT_UNROLL_RUNTIME ?  
(void *) 1 : (void *) 0);
         register_event_parameter ("loop->lpt_decision.unroll_constant",
               loop->lpt_decision.decision == LPT_UNROLL_CONSTANT ?  
(void *) 1 : (void *) 0);

         call_plugin_event("unroll_feature_change");

         unregister_event_parameter ("loop->num");
         unregister_event_parameter ("loop->ninsns");

         unregister_event_parameter ("loop->av_ninsns");
         unregister_event_parameter ("loop->lpt_decision.times");
         unregister_event_parameter ("loop->lpt_decision.decision");

Instead we could have:

         invoke_plugin_va_callbacks (PLUGIN_UNROLL_FEATURE_CHANGE, loop);
and then accessor functions:
int
plugin_unroll_feature_change_param_loop_num (va_list va)
{
   struct loop *loop = va_arg (va, struct loop *);
   return loop->num;
}

unsigned
plugin_unroll_feature_change_param_loop_ninsns (va_list va)
{
   struct loop *loop = va_arg (va, struct loop *);
   return loop->ninsns;
}

unsigned
plugin_unroll_feature_change_param_loop_av_ninsns (va_list va)
{
   struct loop *loop = va_arg (va, struct loop *);
   return loop->av_ninsns;
}
...
bool
plugin_unroll_feature_change_param_loop_lpt_decision_unroll_runtime  
(va_list va)
{
   struct loop *loop = va_arg (va, struct loop *);
   return loop->lpt_decision.decision == LPT_UNROLL_RUNTIME;
}
...


There is still another practical issue: as I change the ICI infrastructure
to fit better with the existing gcc 4.5 plugin infrastructure,
the ICI plugins must be adapted to keep working.
As we are trying to have something working in a short time frame, I think
I should pick one plugin and modify it in lock-step with the infrastructure
to demonstrate how it is supposed to work.

Do you think the adapt.c plugin is suitable for that purpose?

  parent reply	other threads:[~2009-11-09 18:15 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 12:22 plugin hooks Basile STARYNKEVITCH
2009-10-27 13:29 ` Richard Guenther
2009-10-27 14:19   ` Basile STARYNKEVITCH
2009-10-27 14:57     ` Ian Lance Taylor
2009-10-27 15:06       ` Basile STARYNKEVITCH
2009-10-27 15:20         ` Ian Lance Taylor
2009-10-27 15:29           ` Basile STARYNKEVITCH
2009-10-27 15:50             ` Richard Guenther
2009-10-27 15:51               ` Basile STARYNKEVITCH
2009-10-27 16:25                 ` Richard Guenther
     [not found]                   ` <2dc303d60910271056h17038110ib63c53cfa374f5c7@mail.gmail.com>
     [not found]                     ` <002c01ca5746$9dd43da0$d97cb8e0$@fursin@inria.fr>
2009-11-02 12:47                       ` Joern Rennecke
2009-11-02 20:20                         ` Grigori Fursin
2009-11-05 11:17                         ` [plugins-ici-cloning-instrumentation] new GCC plugin developements Grigori Fursin
2009-11-05 13:26                           ` Joern Rennecke
2009-11-05 13:54                             ` Grigori Fursin
2009-11-05 23:34                               ` Ian Lance Taylor
2009-11-06 14:09                                 ` Grigori Fursin
2009-11-06 14:54                                   ` Joern Rennecke
2009-11-06 15:09                                     ` Grigori Fursin
2009-11-06 15:28                                       ` Joern Rennecke
2009-11-06 15:46                                         ` Grigori Fursin
2009-11-06 15:54                                     ` Basile STARYNKEVITCH
2009-11-06 16:12                                       ` Grigori Fursin
2009-11-06 16:59                                         ` Basile STARYNKEVITCH
2009-11-06 17:09                                           ` Grigori Fursin
     [not found]                             ` <-2186575642631489790@unknownmsgid>
2009-11-05 14:34                               ` Yuanjie Huang
2009-11-05 16:27                                 ` Grigori Fursin
2009-12-23 15:13                                   ` target hooks / plugins Joern Rennecke
2009-12-24  0:33                                     ` Joern Rennecke
2009-12-24 12:15                                       ` Joseph S. Myers
2010-01-05 17:06                                         ` Joern Rennecke
2010-01-13  8:22                                         ` Joern Rennecke
2010-01-13 13:49                                           ` Joseph S. Myers
2010-01-13 15:48                                             ` Target hook definition licensing problems (GPL vs GFDL) Joern Rennecke
2010-01-13 19:45                                               ` Dave Korn
2010-01-17 23:16                                               ` Gerald Pfeifer
2010-04-15  9:04                                                 ` Joern Rennecke
2010-01-13 16:09                                             ` target hooks / plugins Joern Rennecke
2010-01-13 16:18                                               ` Joseph S. Myers
2009-12-24 12:26                                       ` Joseph S. Myers
2009-12-31  7:15                                         ` Grigori Fursin
2009-12-30 22:12                                       ` Richard Guenther
     [not found]                                 ` <-904648346490528905@unknownmsgid>
2009-11-06  5:18                                   ` [plugins-ici-cloning-instrumentation] new GCC plugin developements Yuanjie HUANG
2009-11-06 17:14                           ` Joern Rennecke
2009-11-06 18:18                             ` Grigori Fursin
2009-11-06 18:30                               ` Joern Rennecke
2009-11-06 18:44                                 ` Grigori Fursin
2009-11-09  1:43                                   ` Joern Rennecke
2009-11-09 14:28                                     ` Grigori Fursin
2009-11-09 14:46                                     ` Grigori Fursin
2009-11-09 18:15                                     ` Joern Rennecke [this message]
2009-11-09 21:19                                       ` Grigori Fursin
2009-11-10  5:16                                         ` Joern Rennecke
2009-11-10 21:17                                           ` Grigori Fursin
2009-11-14 11:50                                           ` Grigori Fursin
2009-11-17 14:43                                             ` Grigori Fursin
2009-11-18 17:06                                             ` [plugins-ici-cloning-instrumentation] install-plugin Makefile target Joern Rennecke
2009-11-18 17:18                                               ` Rafael Espindola
2009-11-18 17:41                                               ` Diego Novillo
2009-11-18 18:27                                                 ` Basile STARYNKEVITCH
2009-11-18 18:47                                                   ` Joern Rennecke
2009-10-28 15:35             ` plugin hooks Basile STARYNKEVITCH
2009-10-28 20:32             ` Rafael Espindola
2009-10-27 15:39           ` Basile STARYNKEVITCH
2009-10-27 16:19             ` Joseph S. Myers
2009-10-28 19:34         ` Rafael Espindola
2009-10-28 20:36           ` Basile STARYNKEVITCH
2009-10-28 21:44             ` Richard Guenther
2009-10-29  5:07               ` Basile STARYNKEVITCH
2009-10-28 19:02       ` Rafael Espindola

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=20091109131505.im6ygit3wgkgcw84-nzlynne@webmail.spamcop.net \
    --to=amylaar@spamcop.net \
    --cc=Albert.Cohen@inria.fr \
    --cc=NAMOLARU@il.ibm.com \
    --cc=basile@starynkevitch.net \
    --cc=ctuning-discussions@googlegroups.com \
    --cc=dnovillo@google.com \
    --cc=dorit@il.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=grigori.fursin@inria.fr \
    --cc=huangyuanjie@ict.ac.cn \
    --cc=iant@google.com \
    --cc=pengliang@ict.ac.cn \
    --cc=richard.guenther@gmail.com \
    --cc=yuri.kashnikoff@gmail.com \
    --cc=zbigniew.chamski@gmail.com \
    /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).