comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Generators/coroutines in future Ada?
Date: Mon, 17 Jul 2017 18:54:53 -0500
Date: 2017-07-17T18:54:53-05:00	[thread overview]
Message-ID: <okjioe$g91$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: b6e36917-63f0-4c13-aeee-1a1a6f44d495@googlegroups.com

"Shark8" <onewingedshark@gmail.com> wrote in message 
news:b6e36917-63f0-4c13-aeee-1a1a6f44d495@googlegroups.com...
On Tuesday, July 11, 2017 at 11:35:19 PM UTC-6, Randy Brukardt wrote:
>
>> The coming problem with "classic" programming languages like Ada is that
>> they don't map well to architectures with a lot of parallelism. The more
>> constructs that require sequential execution, the worse that Ada programs
>> will perform.
...
>Yes, I know that "automatic parallelization" of high-level language is 
>considered
> fairly hard right now, but less than 50 years ago an optimizing compiler 
> was
> considered hard... and we gained a LOT from allowing optimizing compilers
> + bootstrapping.

No, I think there is very little chance of it becoming possible. When I was 
a young buck at the University of Wisconsin, there was a lot of optimism and 
research into automatic parallelization of programs (particularly Fortran 
programs). I recall reading a number of papers in this area for classes.

Fast forward (gulp!) about 38 years, and most of the optimism is gone, and 
there has not been a lot of progress in the area of automatic 
parallelization. Certainly, compilers can recognize certain patterns and 
parallelize them (generally in cases where all of the "tasklets" run the 
same code), but general-purpose parallelization has defied solution (at 
least for conventional languages -- there might be more luck with a 
purpose-built language like Parasail -- but this is an Ada forum and such 
languages are irrelevant for Ada).

It should be clear that fine-grained parallelism (the kind that a compiler 
could conceivably do) is likely to be a failure, as scheduling takes a 
significant amount of overhead, on top of which a lot of conventional 
sequential code doesn't have much parallelism. (Remember that things like 
exceptions, assignment semantics, and the like add sequential requirements 
that probably aren't necessary to solve the actual problem.)

I would never want to say never, but I think it is far more likely that 
programming will cease to be a human activity at all (perhaps because 
everything is replaced by neural nets) than automatic parallelization of 
"classic" languages become possible.

>That's also why I'm also a bit dubious about the proposed PARALLEL / AND / 
>END
> blocks: it seems to me that the mistake here is to delve too far into the 
> minutia (the
> above "parallel assembly" idea) so as to make it difficult or impossible 
> to automatically
> optimize parallel code because of the more low-level view imposed by the 
> language...
> much like C's notion of arrays is fundamentally broken and undermines the 
> benefits
> of C++.

If you believe, like I do, that automatic parallelization is likely to be 
impossible in the reasonable term, the next best thing is to give the 
compiler hints. Moreover, nothing about "parallel" blocks and loops actually 
requires them to be run in parallel; it just suggests the possibility. It 
also includes checking that the "parallel" code is actually possible to 
execute in parallel, so you are actually giving an optimizer more help by 
ensuring that the code can really be run that way.

My goal for these constructs is that they are essentially semantically 
identical to the non-parallel versions, just with checking that parallel 
execution is possible. (I have no idea how close or far from that goal we 
will end up, as these constructs change a lot from meeting to meeting.)

> Now, I admit I could very well be wrong here, but there's a gut-feeling 
> that
> this is not the route we want to go down.

You're wrong here. ;-)

I think it is highly unlikely that the majority of Ada code could ever be 
parallelized automatically. Assignments (needed for results like 
reductions), and the handling of exceptions would prevent that. There is 
also the need (at least in the foreseeable future) to make your "chunks" of 
execution large enough so that scheduling overhead doesn't kill any 
parallelism gains. That's best handled with explicit code of some kind; 
Brad's libraries are a step in the right direction, but one would want 
checking for conflicts (one of the things that is extremely hard to do with 
existing Ada tasks) and more integration with the syntax.

                                           Randy.



  parent reply	other threads:[~2017-07-17 23:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09 20:19 Generators/coroutines in future Ada? Victor Porton
2017-07-09 21:28 ` Dennis Lee Bieber
2017-07-09 23:56   ` Victor Porton
2017-07-10  7:33   ` Dmitry A. Kazakov
2017-07-10 13:38 ` Victor Porton
2017-07-10 17:01   ` Paul Rubin
2017-07-10 21:24     ` Victor Porton
2017-07-12 17:09       ` Paul Rubin
2017-07-12 17:39         ` Victor Porton
2017-07-13  6:35           ` Paul Rubin
2017-07-11  9:42   ` J-P. Rosen
2017-07-11 12:52     ` Victor Porton
2017-07-11 13:01       ` Victor Porton
2017-07-11 13:26         ` J-P. Rosen
2017-07-11 16:04           ` Dennis Lee Bieber
2017-07-11 16:59           ` Dmitry A. Kazakov
2017-07-11 19:52             ` Pascal Obry
2017-07-11 20:18               ` Dmitry A. Kazakov
2017-07-11 18:36           ` Victor Porton
2017-07-11 19:22             ` J-P. Rosen
2017-07-11 20:25               ` Dmitry A. Kazakov
2017-07-11 23:19                 ` Victor Porton
2017-07-12  4:54                   ` J-P. Rosen
2017-07-12 13:07                     ` Victor Porton
2017-07-12 13:38                       ` Dmitry A. Kazakov
2017-07-12  5:35                   ` Randy Brukardt
2017-07-12  7:27                     ` Dmitry A. Kazakov
2017-07-12 22:47                     ` Shark8
2017-07-16 13:11                       ` Robert Eachus
2017-07-17 23:54                       ` Randy Brukardt [this message]
2017-07-18  7:38                         ` Dmitry A. Kazakov
2017-07-12  7:19                   ` Dmitry A. Kazakov
2017-07-12  6:35                 ` G.B.
2017-07-12  7:34                   ` Dmitry A. Kazakov
2017-07-12 20:49                     ` G.B.
2017-07-13  8:18                       ` Dmitry A. Kazakov
2017-07-12 17:34           ` Paul Rubin
2017-07-11 19:27         ` Simon Wright
2017-07-12  5:42     ` darkestkhan
2017-07-12  8:57     ` Maciej Sobczak
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox