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)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: karlt, Assigned: karlt)
References
Details
(Keywords: perf)
Attachments
(2 files, 1 obsolete file)
4.20 KB,
patch
|
Details | Diff | Splinter Review | |
3.90 KB,
patch
|
padenot
:
review+
|
Details | Diff | Splinter Review |
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.
Comment 1•11 years ago
|
||
Aha, that answers my question in bug 939491 :-)
Comment 2•11 years ago
|
||
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)
Assignee | ||
Comment 3•11 years ago
|
||
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 | ||
Comment 4•11 years ago
|
||
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
Assignee | ||
Comment 5•11 years ago
|
||
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)
Assignee | ||
Comment 6•11 years ago
|
||
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)
Updated•11 years ago
|
Attachment #8355909 -
Flags: review?(paul) → review+
Assignee | ||
Comment 7•11 years ago
|
||
Flags: in-testsuite-
Comment 8•11 years ago
|
||
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.
Description
•