It's 1997. Do you know where your scheduler is?

"D. J. Bernstein" <djb@cr.yp.to>
19 Dec 1997 00:19:02 -0500

          From comp.compilers

Related articles
It's 1997. Do you know where your scheduler is? djb@cr.yp.to (D. J. Bernstein) (1997-12-19)
Re: It's 1997. Do you know where your scheduler is? chase@world.std.com (David Chase) (1997-12-23)
Re: It's 1997. Do you know where your scheduler is? djb@cr.yp.to (D. J. Bernstein) (1997-12-29)
Re: It's 1997. Do you know where your scheduler is? greened@eecs.umich.edu (David Greene) (1998-01-04)
| List of all articles for this month |
From: "D. J. Bernstein" <djb@cr.yp.to>
Newsgroups: comp.compilers
Date: 19 Dec 1997 00:19:02 -0500
Organization: Compilers Central
Keywords: optimize

Surfing the web one day. See ``Fastest Fourier Transform in the
West,'' benchmarked as being faster than all other publicly available
FFT code.


Sit down and toss together a new FFT library. 39900 Pentium cycles for
a problem where FFTW takes 60000. Not bad, but not optimal.


Glance at the asm output produced by gcc -O1. It's horrendous. The gcc
scheduler obviously doesn't know diddly about the Pentium.


Try gcc -O3. The code slows down to 40400 Pentium cycles. Wonderful.


Back to gcc -O1. Shuffle instructions by hand, pipelining
appropriately. 25000 cycles. Not bad, but still not optimal.


Inspect asm output again. gcc mostly obeys the manual scheduling but
insists on loading some values at exactly the wrong times. Wonderful.


Pause to contemplate the market for assemblers. Would casm be a good
name for an assembler with C-like syntax? Bouncing between UNIX x86
syntax and Intel x86 syntax is a pain.


Try gcc -O3 again. The code slows down again. Wonderful.


Try gcc -O0, many combinations of options, other compilers. No luck.
Tweak the code, find some unnecessary loads that confuse the optimizer
enough to make it accidentally speed the code up a bit. Heh, heh, heh.


Make code available: http://pobox.com/~djb/djbfft.html.


Pause to wonder whether compiler writers will care about a 1.6x
speedup in one of the world's most important computational problems.


``These days, scheduling is realistically best left to the compiler.''


Sigh.


---Dan


P.S. FFTW is at http://theory.lcs.mit.edu/~fftw.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.