comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@mitre-bedford.arpa  (Robert I. Eachus)
Subject: Re: Vectorization (was Re: Ada in a C++ Interview)
Date: 10 Aug 91 05:40:28 GMT	[thread overview]
Message-ID: <EACHUS.91Aug9224028@Dr_No.mitre.org> (raw)

     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...

             reply	other threads:[~1991-08-10  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-08-10  5:40 Robert I. Eachus [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-08-09 21:49 Vectorization (was Re: Ada in a C++ Interview) Douglas S. Gray
replies disabled

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