Why is this SIMD multiplication not faster than non-SIMD multiplication?

前端 未结 3 650
轻奢々
轻奢々 2020-12-03 21:22

Let\'s assume that we have a function that multiplies two arrays of 1000000 doubles each. In C/C++ the function looks like this:

void mul_c(double* a, double         


        
3条回答
  •  一整个雨季
    2020-12-03 22:18

    I want to add another point of view to the problem. SIMD instructions give big performance boost if there is no memory bound restrictions. But there are too much memory loading and storing operations and too few CPU calculations in current example. So CPU is in time to process incoming data without using SIMD. If you use data of another type (32-bit float for example) or more complex algorithm, memory throughput won't restrict CPU performance and using of SIMD will give more advantages.

提交回复
热议问题