SSE 程序在 AMD 上比在 Intel 上花费的时间要长得多
我正在使用 SSE2 指令优化算法。但我在测试性能时遇到了这个问题:
I) Intel e6750
- 执行 4 次非 SSE2 算法需要 14.85 秒
- 执行 1 次 SSE2 算法(处理相同的数据)需要 6.89 秒
II) Phenom II x4 2.8 Ghz
- 执行 4 次非 SSE2 算法需要 11.43 秒
- 执行 1 次 SSE2 算法(处理相同data)需要 12.15 秒
任何人都可以帮助我为什么会发生这种情况?我对结果真的很困惑。
在这两种情况下,我都使用 -O3 作为标志使用 g++ 进行编译。
PS:该算法不使用浮点数学,它使用 SSE 的整数指令。
I am working in the optimization of an algorithm using SSE2 instructions. But I have run into this problem when I was testing the performance:
I) Intel e6750
- Doing 4 times the non-SSE2 algorithm takes 14.85 seconds
- Doing 1 time the SSE2 algorithm(processes the same data) takes 6.89 seconds
II) Phenom II x4 2.8Ghz
- Doing 4 times the non-SSE2 algorithm takes 11.43 seconds
- Doing 1 time the SSE2 algorithm(processes the same data) takes 12.15 seconds
Anyone can help me why this is happening? I'm really confused about the results.
In both cases I'm compiling with g++ using -O3 as flag.
PS: The algorithm doesn't use floating point math, it uses the SSE's integer instructions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在过去 5 年左右的时间里,英特尔对其 SSE 实施进行了重大改进,而 AMD 并没有真正跟上。最初,两者实际上都只是 64 位执行单元,128 位操作被分解为 2 个微操作。不过,自从推出 Core 和 Core 2 以来,Intel CPU 就拥有完整的 128 位 SSE 实现,这意味着 128 位操作有效地获得了 2 倍的吞吐量提升(1 个微操作与 2 个微操作)。较新的 Intel CPU 还具有多个 SSE 执行单元,这意味着您可以获得 > 128 位 SIMD 指令每时钟吞吐量 1 条指令。
Intel has made big improvements to their SSE implementation over the last 5 years or so, which AMD has not really kept up with. Originally both were really just 64 bit execution units, and 128 bit operations were broken down into 2 micro-ops. Ever since Core and Core 2 were introduced though, Intel CPUs have had a full 128 bit SSE implementation, which means that 128 bit operations effectively got a 2x throughput boost (1 micro op versus 2). More recent Intel CPUs also have multiple SSE execution units which means you can get > 1 instruction per clock throughput for 128 bit SIMD instructions.