Csound Csound-dev Csound-tekno Search About

Re: csound processor optimizations?

Date1999-05-06 04:39
FromPaul Barton-Davis
SubjectRe: csound processor optimizations?
In message <000d01bf0120$e105d3e0$e36014ac@jsw98.hampshire.edu>you write:
>I am wondering if any versions of csound are available that are optimized
>for certain processors, i.e. P2 or P3, or other processors.  I am not really
>technically knowledgeable enough to know what optimizations that might
>include or how to implement them by modifying the source code, but i am at
>least aware that the P3 has a new instruction set that provides a
>significant increase in FPU operations per cycle, and software such as Seer
>System's Reality is optimized to take advantage of it.

Unless you code in assembler, you are unlikely to find any compilers
for C or C++ out there just yet which do justice to the new FPU SIMD
features on the P3 (Xeon).

However, if you run on a Unix platform (and perhaps Windows, I don't
know), then using pgcc to compile Csound will give you a substantial
performance benefit. You can also (as mentioned on the Csound
FrontPage's documentation on benchmarks) replace the regular math
library with a much faster one (freely available).

Date1999-05-06 06:26
FromEd Hall
SubjectRe: csound processor optimizations?
I once spent an afternoon using various hand optimizations in an
attempt to speed up Csound's inner loop and a few of its opcodes
for Linux on Alpha.  The techniques included pre-fetching (loading
a value into a variable significantly before use) and loop unrolling,
usually in combination.  I was able to improve the performance on the
Csound "Xanadu" benchmark by over 12% on Alpha; the same code yielded
only a few percent improvement for a Pentium II.  Profiling showed that
one of the opcodes (oscili, IIRC) was sped up over 35% on Alpha, and
negligibly on P-II; the change to the inner opcode-call loop alone
was worth almost 5% of the Alpha improvement, but less than half that
on a P-II.

My experiences on other programs have shown that such optimizations
can yield improvements on Alpha and yet slow down code on Pentia.
The reason: Alphas have more than four times the general-purpose
registers as do chips based on the x86; the imbalance for floating-point
is even greater.  So adding temporary variables for pre-fetching is
likely to only slow a Pentium down with register spills and reloads.
And recent P-II systems have better main memory performance than
the 2-1/2 year-old design used for my Alpha's 164LX motherboard,
such that pre-fetching is less of a win even in those cases where
it is possible.

Other RISC's might show similar levels of improvement as Alpha.

I'm afraid this isn't likely to be helpful to the original requester,
but I did want to let the list know that, if performance is the
absolute priority, there are gains to be made--at the price of making
the C code almost entirely unreadable, and more compiler-specific.  The
tiny gains on the more common systems out there just don't make it
worthwhile.  If someone is really, really interested, I could send
them some patches, but they aren't in distributable form at the moment,
and are for an old (3.485) version.

(BTW, the Xanadu benchmark is linked from the Csound page.  The Alpha
numbers I supplied did *not* use my optimizations--I used the publically
available source code.   With the mods, I can actually run the longer
benchmark in less than a minute.)

		-Ed



Date1999-09-17 16:25
FromJosh Whiting
Subjectcsound processor optimizations?
I am wondering if any versions of csound are available that are optimized
for certain processors, i.e. P2 or P3, or other processors.  I am not really
technically knowledgeable enough to know what optimizations that might
include or how to implement them by modifying the source code, but i am at
least aware that the P3 has a new instruction set that provides a
significant increase in FPU operations per cycle, and software such as Seer
System's Reality is optimized to take advantage of it.

The reason I ask is because I need to use csound in real time.  I don't
really need any of the advanced synthesis opcodes, just basics and the midi
features.  I have been using a digital synthesizer (the roland jx-305, which
is sample-based) and a software sequencer to make my music but I am
frustrated by the synthesizer's limitations (especially because it isn't
expandable - i cannot use my own samples).  I see csound as having strong
potential as a substitute (and its free!).

so, any help in finding an optimized csound or anything else that would help
me get it going in real time would be greatly appreciated.

thanks
josh whiting
jwhiting@hampshire.edu