From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 10 Aug 91 05:40:28 GMT From: eachus@mitre-bedford.arpa (Robert I. Eachus) Subject: Re: Vectorization (was Re: Ada in a C++ Interview) Message-ID: List-Id: Douglas Gray did a nice job of describing what vectorizing is all about, although it can--and does--get considerably more complex on the supercomputers. However, I thought that I would say a few words about vectorizing Ada. In general, Ada was intentionally designed so that simple vectorizations can be done efficiently. And since, at the time Ada was developed, there were many machines around with "nice" character string operation accelerators, Ada was also designed to take advantage of these units. (For example, predefined string comparisons.) However, there is a feature of Ada which seems to be a bogeyman for some vectorizing compilers. The language rules require that when evaluating something like: for I in A'RANGE loop A(I) := B(I) + C(I); end loop; either the operation completes without an exception or A retains its previous value. This can be done by the pseudo-code: declare T: A_type(A'RANGE); pragma DELAY_CHECKS(T); begin for I in A'RANGE loop T(I) := B(I) + C(I); end loop; if T'OVERFLOW then raise CONSTRAINT_ERROR; end if; A := T; end; You sometimes can't get away from the "extra" copy (which in those cases is not really extra), but some compilers seem unwilling to generate temporary arrays in the optimizer so many vectorizations you would expect never get done unless you massage the code. In many real applications, however, this turns out to be a non-issue. To get the fastest performance out of a machine you have to understand its memory hierarchy, pipelining strategy, etc. and the right thing to do is often to call an "intrinsic" library/run-time routine. The easiest way to make Ada compilers for vector machines more useful to users is to provide these library packages/interfaces, and users don't have to care if the best way to implement function "*"(L,R: Matrix) return Matrix is the same on a Cray 2 and an IBM RS/6000. But that doesn't win you bragging rights in the benchmarking wars.... -- Robert I. Eachus with STANDARD_DISCLAIMER; use STANDARD_DISCLAIMER; function MESSAGE (TEXT: in CLEVER_IDEAS) return BETTER_IDEAS is...