Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

SIMD for calculating checksum

zoolii
Beginner
1,923 Views
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 Replies
SergeyKostrov
Valued Contributor II
1,923 Views
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

0 Kudos
zoolii
Beginner
1,923 Views
Hi Sergy,
Thanks for the reply. hashVal can be an unsigned int or long . pBuffer_ is an unsigned char array.
Regards
Zooli
0 Kudos
SergeyKostrov
Valued Contributor II
1,923 Views
You need to consider a set of SSE3 instructions for a horizontal addition.

Best regards,
Sergey
0 Kudos
SergeyKostrov
Valued Contributor II
1,923 Views
0 Kudos
TimP
Honored Contributor III
1,923 Views
If the array is at all large, the vector sum reductions implemented by the compilers (nearly any compiler other than MSVC) may be superior.
0 Kudos
Reply