[LAD] Floating point Denormals: C++ and Waf

David Robillard d at drobilla.net
Thu Aug 2 14:46:00 UTC 2012


On Thu, 2012-08-02 at 13:06 +0100, Harry van Haaren wrote:
> Hi all,
> 
> 
> I've working on a LV2 instrument plugin, and it consumes about 1-2%
> CPU on idle. When I leave it for about 20 seconds, the CPU usage jumps
> to 38 / 40 % of a core, and JACK xruns. The code contains IIR's for a
> reverb effect, so I'm going to blame this CPU burning on denormal
> values.
> 
> 
> I'm using waf as the build system, and appending "-O3" and
> "-ffast-math" to the CFLAGS and CXXFLAGS. Building with ./waf -v shows
> the runner thread to have the "-O3" and "-ffast-math" in the command.
> Yet when I run it it still hogs CPU after about 10-20 seconds.
> 
> 
> Reading on gcc's pages
> (http://www.acsu.buffalo.edu/~charngda/cc.html) tells me that if
> DenomalsAreZero and FlushToZero are set, it should be linked with
> crtfastmath.o. I don't know how to check if this is happening?
> 
> 
> I'm not sure where to look next to fix the problem. Help appreciated!

Have you tried in Ardour, or another host with denormal protection?  I
know you were using Jalv recently, which does not.

On that note, a couple of denormal questions:

Is there a reason Jack can't do this for everything?  I am not really
keen on putting a bunch of mysterious assembler crap in a host meant to
be a relatively clean example, and it's even worse to make plugins have
to do this...

What is the scope of the state of the flush-to-zero flag?  Process?
Thread?

Thanks,

-dr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20120802/066d1ebe/attachment.pgp>


More information about the Linux-audio-dev mailing list