免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4782 | 回复: 7
打印 上一主题 下一主题

换了快几倍的ARM,为什么性能没提上去 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-20 23:06 |显示全部楼层 |倒序浏览
我有个用opencv处理图像的程序,之前在200M的ARM核(TI DM6446)上跑,monavista gcc工具链,性能不怎么样。
现在换了块600M的ARM11(freescale 的imx31 多媒体处理器)的处理器,在一般的arm  linux gcc工具链上编译,用的同一编译徒然,性能没有提高,反而降低了。
:em12: :em12: 这是为什么

有人对工具链gcc有深入一点的了解吗,是不是gcc编译器没有产生充分利用处理器硬件特性的机器码。比如我的imx31有VPF,浮点运算单元,gcc却没有产生利用这一特性的代码.


[ 本帖最后由 magicboatrocket 于 2009-10-20 23:08 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-10-21 13:42 |显示全部楼层
说到memory, 大小是差不多,肯定是够程序用的。不说我还不注意,查了下,先前的系统的是SDRAM,64M,后来的系统是用mobile DDR内存,64M。
SDRAM, mobile DDR的内存性能比较如何?有人有insight吗


imx31板子有提供编译器,但我无法确定他提供的编译器好不好。平时对arm-linux-gcc工具也就关注能不能把程序编译过去,对它产生的指令的质量就没什么了解了。
想问T-bagwell兄台,怎么测试软浮点和硬浮点运算的问题呢?反汇编,查硬浮点指令?

[ 本帖最后由 magicboatrocket 于 2009-10-21 13:45 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2009-10-21 14:03 |显示全部楼层
memory方面应该不会影响太大。觉得还是编译器的原因


Mobile DDR for automotive
While there are a lot of memory options for vehicular electronics, here we have sought to demonstrate that Mobile DDR is a good, high-quality choice for many -applications because it functions in a broad temperature range ("40 to 105C), consumes relatively little power, and is available in a variety of densities and configurations for the automotive market long haul.

http://www.embedded.com/design/208403917?pgno=2

论坛徽章:
0
4 [报告]
发表于 2009-10-21 17:39 |显示全部楼层
谢谢T-bagwell兄,opencv里的确很多浮点运算,这些浮点运算对Intel的架构有做优化,但对ARM就没有了。有些浮点运算我在做移植的时候直接用标准库函数了。

写几个测试函数,但我要怎么知道编译器是用硬浮点还是软浮点来算的呢

论坛徽章:
0
5 [报告]
发表于 2009-10-21 20:04 |显示全部楼层
呵呵,确实是比较头疼的问题


imx31工具链,没有看到--with-float=soft的选项,不过感觉这个工具链相对montavista工具链比较简单
[root@localhost ~]# arm-linux-gcc  -v
Reading specs from /opt/mtwk/usr/local/gcc-3.4.3-glibc-2.3.4/arm-linux/lib/gcc/arm-linux/3.4.3/specs
Configured with: /usr/src/RPM/BUILD/crosstool/source/gcc-3.4.3/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/opt/mtwk/usr/local/gcc-3.4.3-glibc-2.3.4/arm-linux --with-headers=/opt/mtwk/usr/local/gcc-3.4.3-glibc-2.3.4/arm-linux/arm-linux/include --with-local-prefix=/opt/mtwk/usr/local/gcc-3.4.3-glibc-2.3.4/arm-linux/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.3
[root@localhost ~]#



DM6446带的montavista的工具链,有--with-float=soft,但事实是用它编译出来的程序运行起来比imx31带的工具链编译出来的程序速度快。

[root@localhost bin]# ./arm-linux-gcc -v
Reading specs from /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin/../lib/gcc/armv5tl-montavista-linuxeabi/3.4.3/specs
Configured with: ../configure --host=i686-pc-linux-gnu --target=armv5tl-montavista-linuxeabi --prefix=/opt/montavista/foundation/devkit/arm/v5t_le --exec-prefix=/opt/montavista/foundation/devkit/arm/v5t_le --bindir=/opt/montavista/foundation/devkit/arm/v5t_le/bin --sbindir=/opt/montavista/foundation/devkit/arm/v5t_le/sbin --sysconfdir=/opt/montavista/foundation/devkit/arm/v5t_le/etc --datadir=/opt/montavista/foundation/devkit/arm/v5t_le/share --includedir=/opt/montavista/foundation/devkit/arm/v5t_le/include --libdir=/opt/montavista/foundation/devkit/arm/v5t_le/lib --libexecdir=/opt/montavista/foundation/devkit/arm/v5t_le/libexec --localstatedir=/opt/montavista/foundation/devkit/arm/v5t_le/var --sharedstatedir=/opt/montavista/foundation/devkit/arm/v5t_le/share --mandir=/opt/montavista/foundation/devkit/arm/v5t_le/man --infodir=/opt/montavista/foundation/devkit/arm/v5t_le/info --build=i686-pc-linux-gnu --program-transform-name=s,^,arm_v5t_le-, --enable-cross --with-sysroot=/opt/montavista/foundation/devkit/arm/v5t_le/target --enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-threads=posix --disable-multilib --with-gxx-include-dir=${prefix}/lib/gcc/armv5tl-montavista-linuxeabi/3.4.3/../../../../target/usr/include/c++/3.4.3 --with-numa-policy=yes --with-float=soft --with-cpu=arm10tdmi --with-interwork --with-arch=armv5t --with-tune=arm10tdmi --libexecdir=/opt/montavista/foundation/devkit/arm/v5t_le/lib
Thread model: posix
gcc version 3.4.3 (MontaVista 3.4.3-25.0.30.0501131 2005-07-23)
[root@localhost bin]#

论坛徽章:
0
6 [报告]
发表于 2009-10-21 20:53 |显示全部楼层
用arm-linux-objdump -p 查看,硬浮点

[root@localhost lib]# arm-linux-objdump -p  libjpeg.a
In archive libjpeg.a:

jcapimin.o:     file format elf32-littlearm
private flags = 0: [APCS-32] [FPA float format]

论坛徽章:
0
7 [报告]
发表于 2009-10-21 23:14 |显示全部楼层
从老外那里得知
gcc 4.2 toolchain has support to do ARM vfp
the compiler options you would want to use would be: -mfpu=vfp -mfloat-abi=softvfp

我的toolchain才3.4.3 版本的,应该还不直持硬件的浮点单元。
上面用arm-linux-objdump -p 看格式是错误的方法。

关键部分我再慢慢详细的测一下


  1. static void timestamp( char* buffer) {

  2.     static int startSecond = 0;
  3.     static int startMs = 0;
  4.     struct timeval tv;
  5.     int deltaSecond, deltaMs;

  6.     gettimeofday(&tv, NULL);

  7.     /* Running for the first time? */
  8.     if(startSecond == 0) {

  9.         /* Copy to prev so that we get 0 delta. */
  10.         startSecond = tv.tv_sec;
  11.         startMs = tv.tv_usec;

  12.     }

  13.     /* Calculate the delta (in microseconds). */
  14.     deltaSecond = tv.tv_sec - startSecond;
  15.     deltaMs = tv.tv_usec - startMs;



  16.     /* Create the string giving offset from start in seconds. */
  17.        snprintf(buffer, BUFFER_SIZE, "%u.%u",deltaSecond,deltaMs);
  18. }
复制代码

[ 本帖最后由 magicboatrocket 于 2009-10-21 23:18 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2009-10-22 23:12 |显示全部楼层
问题解决

感谢 “ARM VFP的一点体会”文档的作者,写得相当棒!!!
http://linux.chinaunix.net/bbs/thread-1125926-1-1.html

利用这个文档,我找到一个支持vfp的4.1版本的gcc。把所有库,程序
加 CFLAGS="-mfpu=vfp -mfloat-abi=softfp" ,用新的toolchian重新遍过。
现在性能满足了。

居然有差不多20 ~ 25倍的差距:wink:
VFP硬浮点奶真强大也!

评分

参与人数 2可用积分 +36 收起 理由
T-bagwell + 30 分享精神鼓励
chenyx + 6 分享经验

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP