ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.06k stars 413 forks source link

Avx perfomance degradation compared to SSE #49

Closed teor292 closed 3 years ago

teor292 commented 6 years ago

Hi. I test some neural network with AVX2, AVX and SSE instructions and found that AVX is less perfomance than even SSE. I think this is a problem or maybe AVX is meaningless for neural network (or my type of neural network).

ermig1979 commented 6 years ago

Hi. Could you to let know your info about your CPU ?

teor292 commented 6 years ago

I test it on two cpu: Intel Core I5-2500k and Intel Xeon CPU E3-1225 V3

ermig1979 commented 6 years ago

Is the performance decreasing strong? If it is about 98-102% - then it is a measure error. Some of neural functions are limited by bandwidth of memory. So performance boosting is achieved when you use small image size which can be placed in CPU cache. In test framework try to use parameters -w=640 -h =480 instead of default values -w=1920 -h=1080.

teor292 commented 6 years ago

It is not strong, but AVX has 256 bit and SSE 128 bit, so I think it must be faster, not slower in any case. I test it not on test framework, but with my test program. For first image SSE give me 0.45 ms time and AVX 0.55 ms (on I5), for the second image (neural was the same, but with different input size of image) AVX 1.43 ms and SSE 1.38 ms (on Xeon). Of cource I can disable AVX, but I think that such results are strange.

ermig1979 commented 6 years ago

What is the function?

teor292 commented 6 years ago

NeuralSimple.txt Here is simplify test function and neural architecture. It get 0.278 ms for AVX and 0.266 for SSE (and AVX2 get the same result as SSE).

ermig1979 commented 3 years ago

Neural is depricated now. Use Synet.