From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5164ccc41905b2d0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.92.202 with SMTP id co10mr1183992wib.1.1362785780063; Fri, 08 Mar 2013 15:36:20 -0800 (PST) MIME-Version: 1.0 Path: g1ni54490wig.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!eu.feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada and OpenMP Date: Fri, 8 Mar 2013 17:36:17 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <87k3pjht79.fsf@ludovic-brenta.org> <3e01ac49-4427-4f50-8577-8edab7e539a6@googlegroups.com> <9e0bbbdf-ccfa-4d4c-90af-2d56d46242b3@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1362785779 11017 69.95.181.76 (8 Mar 2013 23:36:19 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 8 Mar 2013 23:36:19 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-03-08T17:36:17-06:00 List-Id: "Shark8" 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.