Closed Bug 944143 Opened 11 years ago Closed 11 years ago

flushDenormalFloatToZero is a no-op in ZeroPole::process - affects perf with DynamicsCompressorNode

Categories

(Core :: Web Audio, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: karlt, Assigned: karlt)

References

Details

(Keywords: perf)

Attachments

(2 files, 1 obsolete file)

From bug 939491 comment 11: If HAVE_DENORMAL is defined, then flushDenormalFloatToZero() is a no-op on x86(_64) because it is assumed that a DenormalDisabler exists while this code is run. No such object is instantiated in Gecko. Flushing subnormal audio sample values to zero is sensible, but making the hardware flush subnormals to zero for all arithmetic may cause unexpected results, such as divide-by-zero due to permitting a - b = 0 when a != b.
Aha, that answers my question in bug 939491 :-)
Karl -- How much does this bug affect perf? (This bug's priority is currently a P2. I wonder if it should be higher.)
Flags: needinfo?(karlt)
ZeroPole is used in DynamicsCompressorNode. The symptoms would be considerably worse performance when processing silence, but only when the graph doesn't know that it is processing silence. DynamicsCompressorNode skips processing when it knows the input is silence. Subnormals are something we need to watch out for when looking at performance profiles. They can slow arithmetic by a factor of 50 or so. I didn't think this needed to be P1 because we should normally know when we are processing silence. However I see now that a WaveShaperNode upstream would mean that DynamicsCompressorNode doesn't know when it is processing silence. If we fix bug 949680, then this bug shouldn't be a problem, but this bug should be easy to fix, so I'm tentatively changing to P1. See also bug 949683.
Assignee: nobody → karlt
Depends on: 864091
Flags: needinfo?(karlt)
Priority: P2 → P1
This sets up status and control registers to generate SIGFPE on underflow and on subnormal operands on each AudioNodeStream::ProduceOutput call. The SIGFPE handler restarts the instruction with the underflow or denormal operand mask re-enabled, so only the first underflow and first subnormal use per engine/stream/block will trigger a call to the handler. (Disassembly of the instruction would be required to substitute different values and continue with the handler enabled.) Placing a break point in the handler finds such situations. Sometimes these are one-off exceptions, and sometimes, as in ZeroPole, the subnormals lead to more subnormals. http://software.intel.com/en-us/articles/x87-and-sse-floating-point-assists-in-ia-32-flush-to-zero-ftz-and-denormals-are-zero-daz
This reduces MSG CPU usage by almost 2% on Demo 3 of http://webaudiodemos.appspot.com/MIDIDrums/index.html Performance with this patch is not detectably different (on Demo 3) from setting DAZ and FTZ in MXCSR for the MSG thread.
Attachment #8355906 - Flags: review?(paul)
Adjust headers, and use fabsf for float parameters. Note that ZeroPole uses single precision even where Biquad uses double precision. Single precision is enough here because ZeroPole is used only in DynamicsCompressorNode where only high cutoff frequencies are used. (Low cutoff frequencies could cause instabilities.)
Attachment #8355906 - Attachment is obsolete: true
Attachment #8355906 - Flags: review?(paul)
Attachment #8355909 - Flags: review?(paul)
Attachment #8355909 - Flags: review?(paul) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: