WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
75334
Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
https://bugs.webkit.org/show_bug.cgi?id=75334
Summary
Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
Wei James (wistoch)
Reported
2011-12-28 20:34:11 PST
Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus
Attachments
Patch
(5.50 KB, patch)
2011-12-28 20:36 PST
,
Wei James (wistoch)
no flags
Details
Formatted Diff
Diff
Patch
(4.43 KB, patch)
2012-01-04 22:53 PST
,
Wei James (wistoch)
no flags
Details
Formatted Diff
Diff
Patch
(4.47 KB, patch)
2012-01-05 15:35 PST
,
Wei James (wistoch)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Wei James (wistoch)
Comment 1
2011-12-28 20:36:59 PST
Created
attachment 120717
[details]
Patch
Chris Rogers
Comment 2
2012-01-03 15:58:52 PST
Comment on
attachment 120717
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120717&action=review
> Source/WebCore/platform/audio/AudioBus.cpp:241 > +#if (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) || (OS(WINDOWS) && COMPILER(MSVC) && (_M_IX86_FP))
I think we should have this conditional somewhere in DenormalDisabler.h, since that's where the rest of those low-level details are dealt with Also, the macro name shouldn't be called USE_VECTOR_MATH_LIB, but instead should be more general -- something like HAS_HARDWARE_DENORMAL_FLUSHING (or maybe you can think of a better and more accurate name)
> Source/WebCore/platform/audio/AudioBus.cpp:301 > +#define STEREO_NO_SUM_V \
I'd love to see if we could just stop worrying about denormals in the case when the gain has already converged to the target and avoid the #if #else here and in the other two places below (in other words just always go with the vsmul case). That might also simplify some of the other macros you've defined. We can clamp (to zero) the "targetGain" when it's less than a certain lower value (like -100dB or maybe lower?) It's true that there could be cases where targetGain is say -80dB and the values of the vector being scaled are already quite small, pushing them into denormal range, but I think this case will not be common (and we can work more to avoid generating them in the first place). I'm worried about the extra code complexity of having to deal with denormals in this case, especially when we add in the other up and down-mixing cases.
Raymond Toy
Comment 3
2012-01-04 10:28:52 PST
Comment on
attachment 120717
[details]
Patch Should be fine, once Chris's comments are fixed.
Wei James (wistoch)
Comment 4
2012-01-04 22:53:06 PST
Created
attachment 121220
[details]
Patch
Wei James (wistoch)
Comment 5
2012-01-04 22:55:35 PST
Comment on
attachment 120717
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120717&action=review
>> Source/WebCore/platform/audio/AudioBus.cpp:241 >> +#if (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) || (OS(WINDOWS) && COMPILER(MSVC) && (_M_IX86_FP)) > > I think we should have this conditional somewhere in DenormalDisabler.h, since that's where the rest of those low-level details are dealt with > > Also, the macro name shouldn't be called USE_VECTOR_MATH_LIB, but instead should be more general -- something like HAS_HARDWARE_DENORMAL_FLUSHING > (or maybe you can think of a better and more accurate name)
as said in the following comment, this part will be removed. thanks
>> Source/WebCore/platform/audio/AudioBus.cpp:301 >> +#define STEREO_NO_SUM_V \ > > I'd love to see if we could just stop worrying about denormals in the case when the gain has already converged to the target and avoid > the #if #else here and in the other two places below (in other words just always go with the vsmul case). That might also simplify some of the other macros you've defined. > > We can clamp (to zero) the "targetGain" when it's less than a certain lower value (like -100dB or maybe lower?) > > It's true that there could be cases where targetGain is say -80dB and the values of the vector being scaled are already > quite small, pushing them into denormal range, but I think this case will not be common (and we can work more to avoid generating > them in the first place). I'm worried about the extra code complexity of having to deal with denormals in this case, especially when we add in the other up and down-mixing cases.
modified the code according to your comments. thanks
Chris Rogers
Comment 6
2012-01-05 11:16:22 PST
Comment on
attachment 121220
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=121220&action=review
> Source/WebCore/platform/audio/AudioBus.cpp:257 > +#define STEREO_SUM_V \
We could potentially also optimize the "SUM_V" cases. We can't use vsmul() directly, but if we had something like vsmul_add() then we could! Maybe add a FIXME here about this?
Chris Rogers
Comment 7
2012-01-05 11:19:18 PST
Comment on
attachment 121220
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=121220&action=review
Looks good to me with comments addressed.
> Source/WebCore/ChangeLog:8 > + No new tests. (OOPS!)
Please remove this line.
Kenneth Russell
Comment 8
2012-01-05 14:05:31 PST
Comment on
attachment 121220
[details]
Patch Since James isn't a committer a new patch is needed.
Wei James (wistoch)
Comment 9
2012-01-05 15:34:20 PST
(In reply to
comment #6
)
> (From update of
attachment 121220
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=121220&action=review
> > Source/WebCore/platform/audio/AudioBus.cpp:257 > > +#define STEREO_SUM_V \ > We could potentially also optimize the "SUM_V" cases. We can't use vsmul() directly, but if we had something like vsmul_add() then we could! > Maybe add a FIXME here about this?
yes, I am working on it now. will add a new funciton on VectorMath and then use it here. thanks
Wei James (wistoch)
Comment 10
2012-01-05 15:35:38 PST
Created
attachment 121350
[details]
Patch
Chris Rogers
Comment 11
2012-01-05 15:42:02 PST
(In reply to
comment #9
)
> > We could potentially also optimize the "SUM_V" cases. We can't use vsmul() directly, but if we had something like vsmul_add() then we could! > > Maybe add a FIXME here about this? > > yes, I am working on it now. will add a new funciton on VectorMath and then use it here. thanks
Thanks James - looks good to me.
Wei James (wistoch)
Comment 12
2012-01-05 15:46:43 PST
(In reply to
comment #11
)
> (In reply to
comment #9
) > > > We could potentially also optimize the "SUM_V" cases. We can't use vsmul() directly, but if we had something like vsmul_add() then we could! > > > Maybe add a FIXME here about this? > > > > yes, I am working on it now. will add a new funciton on VectorMath and then use it here. thanks > > Thanks James - looks good to me.
hi, roger, as we will use IPP to do FFT in web audio. In IPP, there are many highly optimized functions for vector operations. Can we also use them in VectorMath.cpp when we enabled IPP?
Chris Rogers
Comment 13
2012-01-05 16:00:07 PST
(In reply to
comment #12
)
> hi, roger, as we will use IPP to do FFT in web audio. In IPP, there are many highly optimized functions for vector operations. Can we also use them in VectorMath.cpp when we enabled IPP?
Sure, I don't see why you couldn't call into the IPP versions similar to what we already do today for OS(DARWIN) with its <Accelerate.framework> functions. Partly, this depends on your judgement of whether you believe there would be an advantage compared with the SSE optimizations you've already made. By the way, no worries, but my name is actually "Chris" :)
Wei James (wistoch)
Comment 14
2012-01-05 16:06:57 PST
(In reply to
comment #13
)
> (In reply to
comment #12
) > > hi, roger, as we will use IPP to do FFT in web audio. In IPP, there are many highly optimized functions for vector operations. Can we also use them in VectorMath.cpp when we enabled IPP? > > Sure, I don't see why you couldn't call into the IPP versions similar to what we already do today for OS(DARWIN) with its <Accelerate.framework> functions. Partly, this depends on your judgement of whether you believe there would be an advantage compared with the SSE optimizations you've already made. > > By the way, no worries, but my name is actually "Chris" :)
:) Chris, sorry for the misunderstanding. :) we will evaluate it and enable it if its performance is better(I believe so. :)) btw, could you have a look at this simple patch when you are free? Ken needs your confirmation to r+ it.
https://bugs.webkit.org/show_bug.cgi?id=74693
Wei James (wistoch)
Comment 15
2012-01-05 18:47:23 PST
(In reply to
comment #11
)
> (In reply to
comment #9
) > > > We could potentially also optimize the "SUM_V" cases. We can't use vsmul() directly, but if we had something like vsmul_add() then we could! > > > Maybe add a FIXME here about this? > > > > yes, I am working on it now. will add a new funciton on VectorMath and then use it here. thanks > > Thanks James - looks good to me.
Ken, could you help to land this patch firstly? we will do further optimize including adding new VectorMath function etc in another patch. thanks
Kenneth Russell
Comment 16
2012-01-06 10:31:51 PST
Comment on
attachment 121350
[details]
Patch If it looks good to Chris it's fine with me. rs=me
WebKit Review Bot
Comment 17
2012-01-06 11:51:34 PST
Comment on
attachment 121350
[details]
Patch Clearing flags on attachment: 121350 Committed
r104308
: <
http://trac.webkit.org/changeset/104308
>
WebKit Review Bot
Comment 18
2012-01-06 11:51:39 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug