public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Albert Cohen <Albert.Cohen@inria.fr>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: Interest in integer auto-upcasting pass for normalization and  	optimization?
Date: Mon, 11 May 2009 09:21:00 -0000	[thread overview]
Message-ID: <4A075A87.3000908@inria.fr> (raw)
In-Reply-To: <84fc9c000905091343i3514a6edj23cb6f88218a185@mail.gmail.com>

Richard Guenther wrote:
> On Sat, May 9, 2009 at 10:42 PM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Sat, May 9, 2009 at 10:07 PM, Albert Cohen <Albert.Cohen@inria.fr> wrote:
>>> Sebastian Pop and I have been discussing the option of designing a new pass,
>>> based on vrp, to normalize integer types towards a canonical supertype
>>> typically a machine word, equivalent to signed long, or to truncate to a
>>> smaller-size word when it makes sense. This would be a very simple pass (on
>>> top of not-so-simple vrp), but arguably a quite regression-prone one as well
>>> (due to aliases/escape and common C standard violations).
>>>
>>> The pass could be parameterized with three different objectives, depending
>>> on where it is scheduled in the pass manager.
>>>
>>> (1) canonicalize to the supertype aggressively, to facilitate the
>>> application of further passes like autovect which require very precise
>>> understanding of the type conversions;
>>> (2) compress the types to increase vectorization factor and reduce register
>>> pressure (assuming the target supports sub-word register allocation with
>>> register aliases);
>>> (3) optimize the types to minimize the dynamic number of casts that result
>>> in actual ASM instructions.
>>>
>>> Graphite and the vectorizer would clearly benefit from such a pass, at least
>>> if it implemented objective (1).
>>>
>>> I wonder if some of this is already implemented somewhere, or if someone
>>> played with it in the past, or is interesting in contributing.
>>>
>>> Nothing is planned yet on our side, and temporary fixes exist in the short
>>> term (as far as Graphite and the vectorizer are concerned), but it would
>>> potentially be of great help.
>> This is certainly one useful transformation based on value-range information.
>> The choice of a canonical type is of course at least target dependent.
> 
> This btw. can at least partly replace the SEE (or the missed ZEE) pass.

We'll start by looking at what is done there, thanks. Not sure when we 
will start, though...

>> I suppose you want to do this on register variables only?  Did you think about
>> promoting function arguments and returns as well as part of an IPA pass?
>>
>> I don't understand how register variable promotion/demotion will help graphite
>> though - I had the impression graphite can only work on memory.  No?

It will work at a higher level: graphite generates new loops with brand 
new induction variables, whose types are canonical (cf. your earlier 
canonical type suggestion). No way those canonical types can match 
preexisting induction variables in general. This causes a lot of casts 
in some cases, and confuses the vectorizer, and may even generate nasy 
SE/ZE instructions eventually.

Thank you,
Albert

  reply	other threads:[~2009-05-10 22:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 20:20 Albert Cohen
2009-05-09 22:28 ` Richard Guenther
2009-05-10  1:39   ` Richard Guenther
2009-05-11  9:21     ` Albert Cohen [this message]
2009-05-11 10:18 ` Daniel Jacobowitz
2009-05-11 12:05 Joern Rennecke
2009-05-15 16:55 ` Bernd Schmidt
2009-05-15 18:05   ` Joern Rennecke

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=4A075A87.3000908@inria.fr \
    --to=albert.cohen@inria.fr \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@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).