GCC -O2 与 -march / -ftree-vectorize
我正在针对一个在两个图像( 2000Hx3000W 和 6800Hx8500W )上执行索贝尔内核卷积的程序尝试几个编译器开关。有一些我无法解释的观察结果,以下是数据 - 编译器标志和以秒为单位的时间(请关注最后一列,因为它表示较大图像的 Y 轴卷积):
O2-march=barcelona 0.1483326 0.833264 1.6018882 28.6711242
O2-ftree-vectorize 0.1462104 0.847973 1.506708 26.628592
O2 0.1468406 0.8368156 1.5999718 20.61377564
O2-ftree-vectorize-march=barcelona 0.1441898 0.827366 1.4687354 15.2572644
我期望 -O2- March=barcelona 稍微好一些,考虑到我运行的机器是 AMD barcelona。关于为什么 -O2 比 -O2 -march 有什么想法吗?
关于 -ftree-vectorize,它应该能够并行运行指令,因为我的循环是无依赖性的。但是,-O2-ftree-vectorize-march=barcelona 是其中最好的,单独来看,时间上存在合理的差异。
如果我能理解这种行为那就太好了。
问候,
萨彦
I am trying out several compiler switches against a program that performs sobel kernel convolution on two images( 2000Hx3000W and 6800Hx8500W ). There are some observations that I am not able to interprete, following are the data - compiler flags and time taken in secs (please focus on the last column, as it signifies convolution on Y axis for the larger image):
O2-march=barcelona 0.1483326 0.833264 1.6018882 28.6711242
O2-ftree-vectorize 0.1462104 0.847973 1.506708 26.628592
O2 0.1468406 0.8368156 1.5999718 20.61377564
O2-ftree-vectorize-march=barcelona 0.1441898 0.827366 1.4687354 15.2572644
I expected -O2-march=barcelona to be moderately better, considering the machine I am running on is AMD barcelona. Any ideas as to why -O2 is better than -O2 -march?
About -ftree-vectorize, it should be able to run instructions in parallel since my loop is dependence free. But then, -O2-ftree-vectorize-march=barcelona is the best of the lot, when individually there are reasonable differences in timing.
It would be great if I could understand this behavior.
Regards,
Sayan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论