public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <sebpop@gmail.com>
To: Tobias Grosser <tobias@grosser.es>
Cc: gcc-patches@gcc.gnu.org, rguenther@suse.de
Subject: Re: [PATCH 0/3] Fix PR47654 and PR49649
Date: Sun, 17 Jul 2011 11:31:00 -0000	[thread overview]
Message-ID: <CAFk3UF8D_TtSDNEecWgSjUtrLJXWpHZdSMtm_vQ3+=482XxE1g@mail.gmail.com> (raw)
In-Reply-To: <4E22348F.1060305@grosser.es>

Hi Tobias,

On Sat, Jul 16, 2011 at 20:02, Tobias Grosser <tobias@grosser.es> wrote:
> Here I am a little lost. You write using the precise method you get an
> interval [0,99] for the example in vect-pr43423.c. This is the example:
>
> int a[100], b[100], c[100];
>
> void foo(int n, int mid)
> {
>  int i;
>  for(i=0; i<n; i++)
>    {
>      if (i < mid)
>        a[i] = a[i] + b[i];
>      else
>        a[i] = a[i] + c[i];
>    }
> }
>
> I do not see, how you would derive this small type, as the parameters of
> function foo() allow a range that is a lot larger.

Accessing a[100] is undefined in C, so i < 100, and so n <= 100.

>> #  Access function 0: (int) {(<unnamed-unsigned:8>) graphite_IV.7_56, +,
>> 1}_3;
>> #)
>> affine dependence test not usable: access function not affine or constant.
>>
>> So we have to keep around the previous code gcc_type_for_clast_* that
>> computes the type of an expression as the max precision of the
>> components of that expression, and use that when computing the types
>> of substitution expressions.
>
> Here I am lost again. I understand that very small types may introduce more
> casts (and casts are always difficult to analyze). However, I do not
> understand your solution.
>
> First of all it seems the gcc_type_for_clast ... functions are always needed
> to calculate the types, as just using polyhedral methods would not get
> larger types, as they may be needed for intermediate results. Which
> functions in your patch (or in the current graphite code), are only needed
> to ensure that no problematic casts are inserted? This would probably help
> me to understand how they ensure no problematic casts are generated.

The current graphite code contains the gcc_type_for_clast functions
that are computing wide enough types for expressions.  The types are
computed based on the types of parameters and based on the types of
the induction variables of the loops surrounding the statement using
that expression.  These functions are not touched by the current patch
set.

The functions lb_ub_for_* added by this patch are the ones that will
be very precise on the lower bound and upper bounds, as they are
computing based on the polyhedral representation, instead of asking
for the type of parameters, or the type of induction variables in an
expression.  The lb_ub_for_* functions are too precise to compute the
type of expressions other than the loop bounds.  This extra precision is
needed to address the problem you exposed of increasingly wider types
for inductions variables.

> P.S.: I would love to see this upper/lower bound calculation being part of
> CLooG.
>

Yes, that would be nice.  Let's convince skimo that we would need types
on CLAST expressions ;-)

Sebastian

  reply	other threads:[~2011-07-17  8:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 18:07 Sebastian Pop
2011-07-07 18:07 ` [PATCH 1/3] Start counting nesting level from 0 and use the standard "Polyhedral SCattering Transformed" psct_* interface Sebastian Pop
2011-07-07 18:08 ` [PATCH 2/3] Do not compute twice type, lb, and ub Sebastian Pop
2011-07-07 18:15 ` [PATCH 3/3] Fix PR47654: Compute LB and UB of a CLAST expression Sebastian Pop
2011-07-08  8:38 ` [PATCH 0/3] Fix PR47654 and PR49649 Richard Guenther
2011-07-15 23:08   ` Sebastian Pop
2011-07-17  7:54 ` Tobias Grosser
2011-07-17 11:31   ` Sebastian Pop [this message]
2011-07-18  7:04     ` Tobias Grosser
2011-07-18 16:12       ` Sebastian Pop
2011-07-18 16:48         ` Tobias Grosser
2011-07-18 17:48           ` Sebastian Pop
2011-07-18 22:43             ` Tobias Grosser
2011-07-18 23:24               ` Sebastian Pop
2011-07-18 23:36                 ` Tobias Grosser

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='CAFk3UF8D_TtSDNEecWgSjUtrLJXWpHZdSMtm_vQ3+=482XxE1g@mail.gmail.com' \
    --to=sebpop@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=tobias@grosser.es \
    /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).