From: Craig Burley <burley@gnu.ai.mit.edu>
Subject: Re: join the
Date: Wed, 18 Jun 1997 17:22:36 -0400 (EDT) [thread overview]
Message-ID: <199706182122.RAA29510@churchy.gnu.ai.mit.edu> (raw)
I'd like to address some of the points recently brought up here.
On Wed, 18 Jun 1997, Steve Borho wrote:
>To tell the truth I'd be willing to throw more money at an individual who
>was actively optimizing GCC to run faster on Alpha systems and to produce
>executables at least as fast as the DEC compilers.
Ben Scott <ben.scott@unh.edu> writes:
> I second this opinion. I'm quite willing to put $50 towards a better
>Fortran because it needs to be done, we could use it here where I work, and I
>like the Alpha platform. But we would *really* like a better optimized Alpha
>GCC. If GCC produced really good Alpha code, we'd likely have more Alpha
>Linux boxes (or more Alpha boxes in general, at least). Seeing how the kernel
>and most of the system utils are written in C, I think a better GCC would have
>a bigger influence then g77, too.
I've been under the impression that some people (or person) _are_
doing such work for gcc on Linux/Alpha, but haven't actively
pursued this. But, I agree, improving the code-generating
back end of gcc for Alpha targets is highly important, both to
gcc and g77, and all things compiled by them.
Strictly speaking, the funding being requested here is for a faster
_development platform_ for g77 that will also serve as a good _optimization
target_ for code-generation work.
So, g77 users are interested in g77 generating faster code. Fine, I'm
happy to work on that, as I've been all along. (Though I still spend
almost all my g77 time working on new features, fixing bugs, answering
questions, packaging releases, etc.)
But, to _do_ my g77 work, I need a faster gcc, a faster gld, a working
gdb, a faster Linux, etc., etc.
Since I don't actually _program_ in Fortran, I personally have no need for
a highly optimizing g77. But, I _do_ have a strong desire for ever-faster
software that I do use, and that means a highly optimizing gcc. Any work
I do improving g77 is likely to be strongly influenced by the goal of
improving gcc as well, for my own personal benefit, though that cannot
always be practically accomplished.
Further, gcc is _not_ likely to be highly optimized for the Alpha such
that it approaches the kind of performance achieved via Digital Fortran.
The _only_ way I think that might happen is if the target of such
optimizations is Fortran code, vis, g77. The reasons for this are
fairly technical, involving both the nature of legacy code written in
Fortran vs. C and the differences between the languages (that is,
between what similar-looking code in C vs. Fortran _means_).
I'll illustrate with a quick example:
SUBROUTINE X(A,B,C,N)
REAL A(N),B(N),C(N)
DO I=1,N
C(I) = A(I)*3.14 + B(I)
END DO
END
(I made this up. It proves I'm not a real Fortran programmer, anyway. ;-)
If you give this code to g77 now, even turning all the optimization
options on, such as loop unrolling, you won't get close to the kinds
of performance you could (or I could, I think) trivially achieve using
explicitly pipelined (prefetching) code. Just looking at the output g77
currently (0.5.21-in-development) gives for this, using -O6
-funroll-all-loops, I think I could fairly quickly optimize this to
go much faster. (If you want me to spend some time measuring this
myself, then doing the modifications and measuring the improvements,
I could, but it'd be time I wouldn't spend on g77 itself. I could
view it as "fundraising" time, and it'd be fun to do, so if it'd help
you make a decision about donations, for example, let me know.)
The reason gcc is unlikely, on its own, to perform optimizations like
this is that, generally, with 99.99% of all C code in existance that
even _does_ this sort of computation, gcc can't determine a priori
that there are no recurrence relations in the loop. Specifically, it
cannot assume that it can prefetch A(2), B(2), A(3), B(3), and so on
_before_ it writes C(1), because C(1) might have the same address as,
say, B(2). That kind of aliasing is invalid in Fortran, and supercomputers
(even the minisupercomputer 128-bit VLIW machine I used to do assembly
coding and Fortran compiler optimization development work) _depend_
on there being no such aliasing. So, there's no module in gcc (probably
not even in 2.8.0, still in development) that does the kind of
stuff I'm talking about, though I think there should be.
Even when there are explicit recurrence relations in a loop, I can't
believe (and wouldn't suggest anyone expect) _gcc_ people to care about
optimizing some of them appropriately, e.g.:
FUNCTION SUM(A,B,N)
REAL A(N),B(N)
SUM=0.
DO I=1,N
SUM = SUM + A(I)**2 + 3*B(I)
END DO
END
Here, the generated code can't prefetch in the "usual" way in its
unrolled loop, because the value SUM starts with in iteration I would
not be the same value it'd have written in iteration I-1, which
the code clearly requires.
Fortunately, the compiler (whether gcc or g77) could see this and,
in this case, could reason that, since the recurrence operation (dunno
if that's the right term here) is `+', is commutative and such, it
can safely convert the above to:
FUNCTION SUM(A,B,N)
REAL A(N),B(N)
REAL TSUM(0:3)
TSUM(0)=0.
TSUM(1)=0.
TSUM(2)=0.
TSUM(3)=0.
DO I=1,N
MOD = MOD(I,4)
TSUM(MOD) = TSUM(MOD) + A(I)**2 + 3*B(I)
END DO
SUM = TSUM(0) + TSUM(1) + TSUM(2) + TSUM(3)
END
I'm pretty sure that, once the compiler knew it could perform the
above transformation, the resulting code would exhibit _much_
better performance on a machine like an Alpha (though maybe only
some of the chips, e.g., maybe not a real early one with a limited
memory subsystem).
In summary, I just don't see how people working on optimizing gcc for
the Alpha are going to do this stuff on their own. To almost everyone
working on optimizing other languages, stuff like the above is "exotic".
To the Fortran community, which properly includes anyone doing stuff
like FFTs (acoustical analysis, e.g. being able to sing into a mic and
have your computer dynamically put up musical notes, show whether you're
off pitch, etc.), stuff like the above is bread-and-butter optimization
on most modern machines, which have fillable pipeline latencies between
loads and uses, etc. (Heck, gcc _today_ is not even close to the
having the kinds of sophisticated optimizations that were bread-and-butter
in the 128-bit VLIW Fortran compiler I worked on over 10 years ago.
But today's RISC machines are getting to be more VLIW like, when
you factor in the goal of generating optimal code, even though they're
still comparatively easier to compile and program for.)
A more-general comment on the above, and the subsequent, issue appears
at the bottom of this e-mail.
"D. Steven Daniel" <danields@com230.ee.utk.edu> writes:
>Is there any reason why work is being done on g77 as opposed to creating a
>free FORTRAN 90 compiler?
There are a variety of reasons. Rather than go into a lot of detail, here's
the summary version:
- Fortran 90 is much harder to do than FORTRAN 77.
- Tons more legacy code written in FORTRAN 77. (Basically calculate all the
existing in-production code in all the languages out there, and you've
got two giants: FORTRAN 77 and COBOL. At least, last I remember these
things being measured, all the other languages had small code bases by
comparison.)
- While developing g77, I started doing F90 instead, and when I realized
how much longer it'd take, I asked the comp.lang.fortran community.
The answer was clear: get FORTRAN 77 working well, then move on.
- GNU back end technology is much better suited to FORTRAN 77 than to
Fortran 90. So, Fortran 90 with the kind of performance people would
expect from GNU code-generation technology would require not just
writing the front end and libraries, but I believe it would require
rewriting the back end (and maybe even the linker) as well.
Funding a single g77 development machine is not going to, by itself, make
all this happen. The reason is simply that I can't do it all by myself.
(Well, I do have some strong urges to implement at least a few of the
optimizations that would benefit Fortran plus, say, a C language with
the `restrict' keyword. And, of course, I'd love to get to the point where
I can feel comfortable, priority-wise, improving gcc on the Alpha generally,
since that makes _my_ development environment faster. But Fortran 90 all
by myself is Highly Unlikely.)
But, the funding of a single g77 development machine _will_ get the kind
of attention that, for example, DEC Alphas got when Linus Torvalds ended
up with one. How much of Linux/Alpha porting work was actually done by
Linus himself? I'd guess, not a huge percentage at this point -- but
how much of it would have been done in the same tiemframe without that seed
funding?
In essence, Fortran-friendly optimizations and GNU Fortran 90/95 _might_
happen without any seed funding for "lesser" projects like a better/faster
g77 for Linux/Alpha, but it's hard to see how. Whereas, the experience
we're seeing here would appear to have the potential to serve notice to
the Fortran community, at least, that the Linux/Alpha community cares
enough about Fortran performance on a free-software-based system to have
funded a serious development machine in _very_ short order using
grass-roots fund-raising techniques. I think this will get the attention
of the Fortran community. Once that happens, I think we're well on the
road to funding not only the kinds of optimizations that benefit Fortran
and new compilers like Fortran 90/95, but a much wider breadth of
free-software productds and improvements that benefit all Alpha users
(and, due to expected portability, users of other machines as well,
but we all know how important it is to be Target #1 of product
development, eh?).
Finally, as I think my .plan file explains somewhat, my personal interest
in continuing to work on g77 is strongly influenced by concrete
funding, and the directions I take in improving it are similarly
influenced. (Though, long-suffering g77 alpha-testers, having really
made g77 "happen" more than I could single-handedly, do tend to get
their requests moved to the top of the list -- I consider their
investments of significant personal time testing g77 as substantially
concrete funding.)
Hope this feedback is useful! Even though it looks very likely that
David's funding target will be met, I hope the info above gives people
some ideas about just how valuable their contributions are, however
"small" they consider them at the time.
tq vm, (burley)
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next reply other threads:[~1997-06-18 21:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-06-18 21:22 Craig Burley [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-06-20 19:19 join the Toon Moene
1997-06-20 15:20 David Mosberger-Tang
[not found] <Pine.SGI.3.95.970618111511.19420A-100000@leonardo.sr.unh.edu>
1997-06-18 21:02 ` Sheer Panic
[not found] <199706181424.AA12003@maxwell.meridiantc.com>
1997-06-18 15:27 ` Ben Scott
[not found] <199706171958.MAA10243@panda.mosberger>
1997-06-17 19:27 ` Scott Smyth
1997-06-18 4:22 ` Terry L. Ridder
1997-06-18 13:52 ` Ben Scott
1997-06-18 14:24 ` Steve Borho
1997-06-18 16:52 ` D. Steven Daniel
1997-06-19 0:16 ` Dominique Quatravaux
[not found] <199706171927.PAA02319@apex.eas.gatech.edu>
1997-06-18 6:11 ` Maurice W. Hilarius
1997-06-17 19:58 David Mosberger-Tang
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox