GSoC: Draft application for -ftime-trace

2023-03-17 Thread Kristiyan Stoimenov via Gcc
Hello,

I have written a draft for an application about the -ftime-trace GSoC
project and I would like to share it with you in order to get any
ideas for improving it.

Link to the draft: here

.

Thanks in advance for your feedback.

Best regards,
Kristiyan


Re: [Tree-SSA] Question from observation, bogus SSA form?

2023-03-17 Thread Pierrick Philippe

On 16/03/2023 17:30, Martin Jambor wrote:

Hello Pierrick,

On Thu, Mar 16 2023, Pierrick Philippe wrote:

Hi everyone,

I was working around with the analyzer, but I usually dump the SSA-tree
to get a view of the analyzed code.
This is how I noticed something wrong, at least in the sense of the
definition of SSA form.

please note that only some DECLs are put into a SSA form in GCC, these
are sometimes referred to as "gimple registers" and you can query the
predicate is_gimple_reg to figure out whether a DECL is one (putting
aside "virtual operands" which are a special construct of alias
analysis, are in an SSA form but the predicate returns false for them
for some reason).

This means that global variables, volatile variables, aggregates,
variables which are not considered aggregates but are nevertheless
partially modified (think insertion into a vector) or variables which
need to live in memory (most probably because their address was taken)
are not put into an SSA form.  It may not be easily possible.


Alright, I understand, but I honestly find it confusing.

I mean, aren't they any passes relying on the pure SSA form properties 
to analyze code?

For example to DSE or DCE.

[stripping]

The thing is, there is two distinct assignment to the same LHS tree at
two different gimple statement, which is by definition not supposed to
happened in SSA form.

I think it is now clear that x is not in SSA form because (at this stage
of the compilation) it is still considered to need to live in memory.

I think that I get your point.
It would be a heavy design change to be able to write it in pure SSA form.

Is there any particular reason this happen? Is that because the address
of x is taken and stored?

I have to precise, I did not dig into the SSA form transformation and am
a newbie to gcc source code.
So maybe my question is a bit naive or a known issue.

No worries, we know these important details are not straightforward when
you see them for the first time.

Good luck with your gcc hacking!


Thanks! :)

Pierrick




Re: GSoC: Interest in taking the `-ftime-trace` project

2023-03-17 Thread Martin Jambor
Hello Kristiyan,

sorry for a late reply, I'm struggling with email recently.

On Sun, Mar 12 2023, Kristiyan Stoimenov wrote:
> Hello,
>
> Thanks very much for your advice. They were very helpful to me.
>
> I have written a draft about the application and I would like to share it
> with you in order to get any ideas for improving it.

I assume the proposal is for a 175 hour (medium-sized) project?

I would really like to see an expected time-line of the project.  It is
expected that it will change substantially, but I want to know that
applicants understand what mile-stones there are in their project and
that they have a rough idea what the first steps are going to be.

Applicants which cannot plan much more for their first week beyond
"familiarizing with the project" often turn up not to have the technical
skills to make much progress, let alone successfully complete a project.

I understand that means that I am asking you to do a chunk of what you
expect to be the most difficult bit of work - figuring GCC out - now,
but unfortunately there is no way around it.  I hope the existing
plug-in would help you and definitely feel free to keep asking any
questions you may have about GCC.

Sorry if the above sounds harsh, I definitely do not want to put you
off, but it is important.  GSoC application selection can be competitive
and for many reasons we want to be 100% sure that we task our mentors
only with guiding capable students.

Good luck!

Martin


>
> Thanks in advance for your feedback.
>
> Best regards,
> Kristiyan
>
> On Wed, 1 Mar 2023 at 20:57, Martin Jambor  wrote:
>
>> Hello Kristiyan,
>>
>> On Wed, Feb 08 2023, Kristiyan Stoimenov via Gcc wrote:
>> > Hello,
>> >
>> > I would like to ask whether I could be part of the upcoming GSoC. I have
>> > been wanting to contribute to the project for some time now and I think
>> > that this would be a nice opportunity for that.
>> >
>> > I have looked into the different starter projects that are offered in the
>> > [Wiki GSoC page](https://gcc.gnu.org/wiki/SummerOfCode) and I was
>> > particularly interested in the `-ftime-trace` project.
>>
>> In case you have not noticed, there was a message to this mailing list a
>> week ago ( https://gcc.gnu.org/pipermail/gcc/2023-February/240756.html )
>> about a basic implementation of this in a plug-in located at
>>
>>   https://github.com/royjacobson/externis
>>
>> This may help you with thinking about the task and writing your
>> proposal.  Of course, the resulting project would have to be not a
>> plugin and aim to give users more insight into the compilation process
>> to be successful.  But it may be a useful starting point.
>>
>> Apart from that, all David's advice was of course very good (but
>> meanwhile we got accepted as a mentoring Org).
>>
>> Good luck!
>>
>> Martin
>>
>>


Re: [Tree-SSA] Question from observation, bogus SSA form?

2023-03-17 Thread Michael Matz via Gcc
Hello,

On Fri, 17 Mar 2023, Pierrick Philippe wrote:

> > This means that global variables, volatile variables, aggregates,
> > variables which are not considered aggregates but are nevertheless
> > partially modified (think insertion into a vector) or variables which
> > need to live in memory (most probably because their address was taken)
> > are not put into an SSA form.  It may not be easily possible.
> 
> Alright, I understand, but I honestly find it confusing.

You can write something only into SSA form if you see _all_ assignments to 
the entity in question.  That's not necessarily the case for stuff sitting 
in memory.  Code you may not readily see (or might not be able to 
statically know the behaviour of) might be able to get ahold of it and 
hence change it behind your back or in unknown ways.  Not in your simple 
example (and if you look at it during some later passes in the compiler 
you will see that 'x' will indeed be written into SSA form), but in some 
that are only a little more complex:

int foo (int i) {
  int x, *y=&x;
  x = i;  // #1
  bar(y); // #2
  return x;
}

or

int foo (int i) {
  int x, z, *y = i ? &x : &z;
  x = z = 1;  // #1
  *y = 42;// #2
  return x;
}

here point #1 is very obviously a definition of x (and z) in both 
examples.  And point #2?  Is it a definition or not?  And if it is, then 
what entity is assigned to?  Think about that for a while and what that 
means for SSA form.

> I mean, aren't they any passes relying on the pure SSA form properties 
> to analyze code? For example to DSE or DCE.

Of course.  They all have to deal with memory in a special way (many by 
not doing things on memory).  Because of the above problems they would 
need to special-case memory no matter what.  (E.g. in GCC memory is dealt 
with via the virtual operands, the '.MEM_x = VDEF<.MEM_y>' and VUSE 
constructs you saw in the dumps, to make dealing with memory in an 
SSA-based compiler at least somewhat natural).


Ciao,
Michael.


gcc-11-20230317 is now available

2023-03-17 Thread GCC Administrator via Gcc
Snapshot gcc-11-20230317 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/11-20230317/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 11 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-11 revision f68f0e69d988ca999c09953811f3cc722f114677

You'll find:

 gcc-11-20230317.tar.xz   Complete GCC

  SHA256=c9c390302eb3acc0a36860a6f0f6298a8ec57bc4819b07109150780e2cec5c87
  SHA1=4224b940baef71690d3ee0c12884ab96f8cf0717

Diffs from 11-20230310 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-11
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.