From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada and OpenMP
Date: Fri, 8 Mar 2013 17:36:17 -0600
Date: 2013-03-08T17:36:17-06:00 [thread overview]
Message-ID: <khdslj$ao9$1@munin.nbi.dk> (raw)
In-Reply-To: 9e0bbbdf-ccfa-4d4c-90af-2d56d46242b3@googlegroups.com
"Shark8" <onewingedshark@gmail.com> wrote in message
news:9e0bbbdf-ccfa-4d4c-90af-2d56d46242b3@googlegroups.com...
>On Thursday, March 7, 2013 8:42:15 PM UTC-7, Randy Brukardt wrote:
>>
>> In order for that to be the case, the pragma would have to make various
>> constructs illegal in the loop and in the surrounding code (exception
>> handlers, any code where one iteration of the loop depends on the next,
>> erroneous use of shared variables). But a pragma shouldn't be changing
>> the
>> legality rules of the language. (And it's not clear this would really fix
>> the problem.)
>
>Why would that have to change the semantics of the program: since there
>would have
>to be a non-implementation-defined code-generation method (for when the
>pragma
>was off) the compiler should just use that if those constructs are used.
Mainly because 95% of Ada code is going to fail such tests; it would
virtually never be able to use the fancy code.
Take the OP's example, for example:
for I in 1 .. MAX loop
A(I) := A(I) + 1; -- Can raise Constraint_Error because of overflow or
range checks.
end loop;
This can be done in parallel only if (A) there is no exception handler for
Constraint_Error or others anywhere in the program; or (B) pragma Suppress
applies to the loop (nasty, we never, ever want an incentive to use
Suppress); or (C) no exception handler or code following the handler can
ever access A (generally only possible if A is a local variable, not a
parameter or global). For some loops there would be a (D) be able to prove
from subtypes and constraints that no exception can happen -- but that is
never possible for increment or decrement operations like the above. These
conditions aren't going to happen that often, and unless a compiler has
access to the source code for the entire program, (A) isn't possible to
determine anyway.
And if the compiler is going to go through all of that anyway, it might as
well just do it whenever it can, no pragma is necessary or useful.
The whole advantage of having a "marker" here is to allow a change in the
semantics in the error case. If you're not going to do that, you're hardly
ever going to be able to parallelize, so what's the point of a pragma?
Randy.
next prev parent reply other threads:[~2013-03-08 23:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-07 18:04 Ada and OpenMP Rego, P.
2013-03-07 20:04 ` Ludovic Brenta
2013-03-07 22:22 ` Peter C. Chapin
2013-03-07 23:42 ` Randy Brukardt
2013-03-08 0:39 ` Peter C. Chapin
2013-03-08 3:31 ` Randy Brukardt
2013-03-08 7:17 ` Simon Wright
2013-03-08 23:40 ` Randy Brukardt
2013-03-08 12:07 ` Peter C. Chapin
2013-03-08 14:40 ` Rego, P.
2013-03-08 1:15 ` Shark8
2013-03-08 3:42 ` Randy Brukardt
2013-03-08 14:53 ` Rego, P.
2013-03-08 15:47 ` Georg Bauhaus
2013-03-08 23:40 ` Randy Brukardt
2013-03-08 16:52 ` Shark8
2013-03-08 23:36 ` Randy Brukardt [this message]
2013-03-09 4:13 ` Brad Moore
2013-03-10 4:24 ` Randy Brukardt
2013-03-08 7:37 ` Simon Wright
2013-03-10 18:00 ` Waldek Hebisch
2013-03-07 23:43 ` Georg Bauhaus
2013-03-08 10:18 ` Georg Bauhaus
2013-03-08 14:24 ` Rego, P.
2013-03-07 22:52 ` Simon Wright
2013-03-08 21:37 ` Brad Moore
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox