sfizz icon indicating copy to clipboard operation
sfizz copied to clipboard

Some speedup with SSE 4.1

Open jpcima opened this issue 5 years ago • 5 comments

This speeds up sample_quality=2 by 15 to 20%, using SSE4.1 dot-product primitive, and avoiding a bit of instruction latency. Just for illustrating, this optimization should be made CPU-dispatched. Possibly strings can benefit from a similar optimization.

jpcima avatar Aug 01 '20 10:08 jpcima

Nice one! With the runtime dispatch I think we can target interesting optimization like this. Do you want that I benchmark it on Intel/AMD? I was thinking on working on ARM in the holidays, if I have some time :slightly_smiling_face:

paulfd avatar Aug 02 '20 21:08 paulfd

btw the meanSquared SIMD helper is also a dot product.

paulfd avatar Aug 02 '20 21:08 paulfd

Considering the simde version you proposed, is this speedup obsolete? We could maybe have a runtime dispatcher.

paulfd avatar Dec 26 '20 13:12 paulfd

Considering the simde version you proposed, is this speedup obsolete? We could maybe have a runtime dispatcher.

It's by no means obsolete but it would be desirable to have the cpu dispatcher.

From experimenting with the strings effect, I discovered that one can extract great speed benefits from loop unrolling, and more so when coupled with some inlining. (some greater than 4x on SSE, which might be explained by latency effects of memory or individual instructions) I'd like the same to be experimented with the resampler; but the simde PR should be dealt with first.

jpcima avatar Dec 26 '20 14:12 jpcima

Sure, I think the simde PR is fine now.

Dec 26, 2020 15:25:18 JP Cimalando [email protected]:

Considering the simde version you proposed, is this speedup obsolete? We could maybe have a runtime dispatcher.

It's by no means obsolete but it would be desirable to have the cpu dispatcher.

From experimenting with the strings effect, I discovered that one can extract great speed benefits from loop unrolling, and more so when coupled with some inlining. (some greater than 4x on SSE, which might be explained by latency effects of memory or individual instructions) I'd like the same to be experimented with the resampler; but the simde PR should be dealt with first.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/sfztools/sfizz/pull/340#issuecomment-751361186], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADUFWQMKMWKBL4X47EF4XWDSWXW3NANCNFSM4PRTWWQQ]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAB9JREFUaIHtwQEBAAAAgiD/r25IQAEAAAAAAAAAAC8GJDAAAY7rwGcAAAAASUVORK5CYII=###24x24:true###][Tracking image][https://github.com/notifications/beacon/ADUFWQOQSJHTJIJDULYG4KLSWXW3NA5CNFSM4PRTWWQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFTENZIQ.gif]

paulfd avatar Dec 26 '20 17:12 paulfd