public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Torvald Riegel <triegel@redhat.com>, Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Richard Henderson <rth@redhat.com>
Subject: Re: [gomp4.1] Doacross library implementation
Date: Thu, 08 Oct 2015 14:26:00 -0000	[thread overview]
Message-ID: <56167D1A.2040706@redhat.com> (raw)
In-Reply-To: <1444308526.25110.165.camel@localhost.localdomain>

On 10/08/2015 05:48 AM, Torvald Riegel wrote:
> On Thu, 2015-09-24 at 20:32 +0200, Jakub Jelinek wrote:
>> Torvald, can you please have a look at it, if I got all the atomics / memory
>> models right?
>
> More detailed comments below, but in general, I'd really suggest to add
> more code comments for the synchronization parts.  In the end, the level
> of detail of documentation of libgomp is your decision, but, for
> example, the lack of comments in synchronization code in glibc has made
> maintaining this code and fixing issues in it very costly.  It has also
> been hard to understand for many.
>
> My suggestion would be both to (1) document the high-level, abstract
> synchronization scheme and (2) how that scheme is implemented.  The
> first point is important in my experience because typically, the
> high-level scheme and the actual thinking behind it (or, IOW, the intent
> of the original author) is much harder to reconstruct in case of
> concurrent code than it is for sequential code; you can't just simply
> follow the program along line by line, but have to consider
> interleavings.

I couldn't agree more.  After having spent the last month trying to make 
sense of libgomp/task.c, I can honestly say that we need better internal 
documentation.  I know this isn't Jakub's fault, as Richard started the 
non-documenting party, but clearly defined descriptions, functions, and 
implementation go a long way.  APIs and abstractions also make things a 
_lot_ easier to follow.

It could also be that I'm very new to runtime work, specifically 
parallel runtime work, but it was hard to understand.  I think I finally 
have a firm grasp on it (I hope), but it did take me until early this 
week.  Consequently, I took it upon myself to documenting big pieces of 
task.c this week.  I assume anyone not jakub/rth coming after me will 
benefit from it.  So yeah, my upcoming patch will have some variables 
renamed, many more functions with better descriptions (or descriptions 
at all, etc), and a clearly defined API.

Maybe my brain is small; but this stuff is hard.  Every little bit helps :).

p.s. Ironically, it seems that the longer I spend looking at this code, 
the less I feel I need to comment because things are now "obvious", 
which perhaps is an indication that either putting newbies on the 
projects is a good thing, or documenting things early is good practice.

Aldy

      reply	other threads:[~2015-10-08 14:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 20:04 Jakub Jelinek
2015-09-29 18:33 ` [gomp4.1] Fixup handling of doacross loops with noreturn body Jakub Jelinek
2015-10-01 12:08 ` [gomp4.1] Fixup doacross lastprivate handling Jakub Jelinek
2015-10-08 12:48 ` [gomp4.1] Doacross library implementation Torvald Riegel
2015-10-08 14:26   ` Aldy Hernandez [this message]

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=56167D1A.2040706@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rth@redhat.com \
    --cc=triegel@redhat.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).