TSXor icon indicating copy to clipboard operation
TSXor copied to clipboard

first attempt at vectorizing window.cpp

Open slice4e opened this issue 2 years ago • 2 comments

(IN PROGRESS)

(TODO - will test it out) Finding the distance at the bottom of the function should also be vectorizable.

The right way to do this, is to first test for AVX512, AVX2, etc. and use the vector width that is available on the machine. Not sure the right flags to use for gcc, but it should be able to auto-vectorize this loop.

I had the idea about vectorizing this code after reading the paper. I thought that comparing the last value with a window of previous values is the main reason for slowing down the performance of the encryption - but it is also an operation that can be parallelized.

However, after studying the code, I am not too sure that we will able to improve the performance through vectorization. The reason is that I thnk most of the time should be spent in the memory loads and not the simple math in between (XOR) . In addition, using the vector instructions will result in lowering the CPU frequency, which may impact the parts of the code which are not vectorized. Anyway ... it is worth a try to see what happens.

slice4e avatar Jul 09 '22 08:07 slice4e