linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dibyendu Majumdar <mobile@majumdar.org.uk>,
	Christopher Li <sparse@chrisli.org>,
	Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: [RFC] sparse SSA construction
Date: Tue, 15 Aug 2017 22:14:00 +0200	[thread overview]
Message-ID: <CAMHZB6GZCcOfAD3qkFs39hVQ1om5TdCM5CTTwAb2aqLH1Hbriw@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFwXc6QDgZSv++ZUUTHEixsMoKUq6Wc-6sQ4g5po5ZmA5g@mail.gmail.com>

On Tue, Aug 15, 2017 at 8:36 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>> https://github.com/lucvoo/sparse/tree/sssa-mini-clean
>
> I like it. But the commit messages are sorely lacking. And I'm not
> talking just about the lack of sign-off's, I'm talking about the
> messages just not explaining what is going on AT ALL.

I know, sorry for that, I don't like it myself (often I've the
impression to spend more time to wrote a decent commit
message than to write the corresponding code).
I'll work on that tomorrow (Europe here, already evening, sorry).

One of the thing I'm afraid won't be able to do (without a quite
a bit more work) is to do some nice small step-by-step commits.
It's completely changing the method, a step-by-step will be very
artificial and quite useless, I think.

> But with that fixed, I heartily recommend merging the new ssa
> construction code. It's based on a real paper, rather than being
> ad-hoc.

It's just too bad that the paper simply ignores gotos. The method
is really cool, fast, simple and clean, I love it. But I had to add
a few things, more akin to kludges than hacks IMO, to make it
work with gotos. But as is, it works pretty well, is fast and produce
correct SSA (also avoid few quadratic behaviours the current
simplify_one_symbol() has).

Improvement areas are:
- I feel we can do better with gotos and computed gotos
  it needs investigation
- the ptrmap thing need an hash based implementation
  but this is only needed for extreme cases. The trick will
  be to do something with dynamic size and which will not
  waste (too much)  memory. Nothing hard, but it will need
  some experiment  and I want first to collect some statistics
- there is an optimization that can be added for (what I call)
  'complex trivial phi-nodes' (it's clear in the paper, I think)

But none of this is blocking, just something that can easily
be added later.

The current situation is:
- As far as I saw the generated IR is correct (from a phi-node
  point of view).
- The performance is pretty nice (faster than the current method)
- There are some optimizations for free because the method
  do a kind of global-numbering.
- It does very well on a kernel allyesconfig. It just creates
  something like 8 or 12 more context/locking warnings I
  would like to understand (OTOH, knowing how broken
  the current SSA is, I'm surprised there isn't more differences).

For information, the current SSA construction is very broken,
both in simplify_one_symbol() (the main SSA construction)
and simplify_loads() (which also creates phi-nodes). They both
are 'load-driven' which is OK but they both put the phi-nodes
where the load is while phi-nodes need to placed where branches
meet. The loads are often placed in a BB following where the
join-point. Often this *seems* to be OK but in fact is very wrong
and create all sort of problems a bit everywhere

Best regards,
-- Luc Van Oostenryck

  reply	other threads:[~2017-08-15 20:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-06 20:26 [RFC] sparse SSA construction Luc Van Oostenryck
2017-08-06 23:01 ` Christopher Li
2017-08-06 23:44   ` Luc Van Oostenryck
2017-08-07  0:33     ` Christopher Li
2017-08-07  1:21       ` Luc Van Oostenryck
2017-08-07  1:44         ` Christopher Li
2017-08-15 13:41 ` Dibyendu Majumdar
2017-08-15 13:59   ` Christopher Li
2017-08-15 14:06     ` Dibyendu Majumdar
2017-08-15 14:07       ` Christopher Li
2017-08-15 14:09         ` Dibyendu Majumdar
2017-08-15 14:18           ` Christopher Li
2017-08-15 18:36           ` Linus Torvalds
2017-08-15 20:14             ` Luc Van Oostenryck [this message]
2017-08-15 20:43               ` Linus Torvalds
2017-08-15 21:43                 ` Luc Van Oostenryck
2017-08-15 22:44                   ` Dibyendu Majumdar
2017-08-16  5:36                     ` Christopher Li
2017-08-16  5:15                   ` Christopher Li
2017-08-16  4:23                 ` Christopher Li
2017-08-16  4:58                   ` Christopher Li
2017-08-16 10:40                     ` Dibyendu Majumdar
2017-08-16 13:17                       ` Christopher Li
2017-08-16  6:41                 ` Luc Van Oostenryck
2017-08-16 11:02               ` Dibyendu Majumdar
2017-08-16 12:00                 ` Luc Van Oostenryck
2017-08-16 12:16                   ` Dibyendu Majumdar
2017-08-16 12:23                     ` Christopher Li
2017-08-16 12:28                     ` Luc Van Oostenryck
2017-08-16 12:39                       ` Dibyendu Majumdar
2017-08-16 12:50                         ` Christopher Li
2017-08-16 12:57                           ` Dibyendu Majumdar
2017-08-16 13:11                             ` Christopher Li
2017-08-16 13:22                               ` Christopher Li
2017-08-16 12:17                   ` Christopher Li
2017-08-15 20:37             ` Luc Van Oostenryck

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=CAMHZB6GZCcOfAD3qkFs39hVQ1om5TdCM5CTTwAb2aqLH1Hbriw@mail.gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /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 NNTP newsgroup(s).