Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

SIMD for calculating checksum

zoolii
Einsteiger
2.298Aufrufe
Hi Experts,

Can we optimize following checksum calculation using SIMD somehow ?


for(int i = 0 ; i < buffSize_ ; i++) {
hashVal = (hashVal<<5) + hashVal + pBuffer_;
}




Thank you
Zooli
0 Kudos
5 Antworten
SergeyKostrov
Geschätzter Beitragender II
2.298Aufrufe
Quoting zoolii
Hi Experts,

Can we optimize following checksum calculation using SIMD somehow ?

for(int i = 0 ; i < buffSize_ ; i++) {
hashVal = (hashVal<<5) + hashVal + pBuffer_;
}


Thank you
Zooli


Yes, with and without SSE. Also, you didn't specifytypes of'hashVal' and'pBuffer_'variables.

Best regards,
Sergey

zoolii
Einsteiger
2.298Aufrufe
Hi Sergy,
Thanks for the reply. hashVal can be an unsigned int or long . pBuffer_ is an unsigned char array.
Regards
Zooli
SergeyKostrov
Geschätzter Beitragender II
2.298Aufrufe
You need to consider a set of SSE3 instructions for a horizontal addition.

Best regards,
Sergey
SergeyKostrov
Geschätzter Beitragender II
2.298Aufrufe
TimP
Geehrter Beitragender III
2.298Aufrufe
If the array is at all large, the vector sum reductions implemented by the compilers (nearly any compiler other than MSVC) may be superior.
Antworten