[comp.lang.fortran] Branch frequencies

sommar@enea.se (Erland Sommarskog) (11/28/88)

Herman Rubin (cik@l.cc.purdue.edu) writes:
>There is no provision for input
>as to frequency of branches.  Should the common condition be the branch
>or the rare condition?  ...
>I think the compilers should be interactive, and
>discuss the various possibilities with the programmer.  

If memory serves right the compiler Rubin wants exists, or
at least it has existed. I recall a friend of mine told me
that the very first Fortran compiler allowed you to give
probabilities of on the IF statements. The compiler then used
one of its passes to do a Monte Carlo simulation on the
program for optimal optimising.

I'm probably wrong on everything, but I'm sure that friendly
people will correct me.
-- 
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.se
"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment

bernhold@qtp.ufl.edu (David E. Bernholdt) (11/28/88)

In article <4113@enea.se> sommar@enea.se (Erland Sommarskog) writes:
>If memory serves right the compiler Rubin wants exists, or
>at least it has existed. I recall a friend of mine told me
>that the very first Fortran compiler allowed you to give
>probabilities of on the IF statements. The compiler then used
>one of its passes to do a Monte Carlo simulation on the
>program for optimal optimising.
>
>"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment


I too may be mistaken, but I believe that the compiler for the
Multiflow does things like this too: in order to schedule the "traces"
most efficiently, it will analyze the branch condition and try to
determine probabilities.  Furthermore, I believe you can automatically
instrument the executable during compilation and run a few jobs with
it - then feed the collected data back to the compiler to help it
optimize more efficiently.

Warning: I don't really know much about the machine, I just listened
to a Multiflow rep making his pitch to a large group of computation
chemists who ask good questions.  Sounds interesting nevertheless!

Dave
-- 
David Bernholdt			bernhold@qtp.ufl.edu
Quantum Theory Project		bernhold@ufpine.bitnet
University of Florida
Gainesville, FL  32611		904/392 9306

PLS@cup.portal.com (Paul L Schauble) (11/29/88)

> Specifying branch frequencies

That's true. The very first Fortran compiler, done, I believe for the IBM
709, had a FREQUENCY statement that allowed specifying the probability of
each branch for IF and computed GOTO. This was standardized into Fortran II,
then later dropped in Fortran IV.

The reason for this is that the designers of the compiler knew that they
would be fighting an uphill battle against entrenched assembly coders, and
that the language and compiler would only be accepted if it could generate
better code than the average hand coder. Remember that this was back in the
days when people were cheap and hardware was expensive.

They suceeded.

This compiler was built back in the early '60s. To this day there have been
very very few compilers that match this one in optimizations.

  ++PLS

neitzel@infbs.uucp (Martin Neitzel) (12/02/88)

In article <11889@cup.portal.com> Paul L Schauble writes:
PLS>
PLS> The reason for this is that the designers of the compiler knew that they
PLS> would be fighting an uphill battle against entrenched assembly coders, and
PLS> that the language and compiler would only be accepted if it could generate
PLS> better code than the average hand coder.

Yes.  And a good occasion to point everbody to the ACM SIGHOPL
conference proceedings (History Of Programming Languages).  If
my memory serves me right, it was edited by Mr. Wexelblat and
published in 82 or 84 or around that time.

It's one of the finest books you can get.  The designers of many major
and `minor' languages report stories about the development of "their"
programming languages.  Read what J. Backus himself has to tell about
FORTRAN, Iverson about APL, Griswold about SNOBOL, P. Naur (or was
it L. v.d.Meulen?) about ALGOL68,...  Lots of fun reading!

							Martin
--
Martin Neitzel,  Techn. Univ. Braunschweig, W.Germany
BITNET/EARN:	neitzel@dbsinf6.bitnet	  (mail via bitnet preferred)
UUCP:		neitzel@infbs.uucp  (unido!infbs!neitzel)