How to profile code in hexagon dsp simulator

狂风中的少年 提交于 2020-01-05 04:23:08

问题


I have been trying to compile my code using -pg to enable profiling in the simulator and once I do that it gives me linker errors.

Compilation command

hexagon-clang++ main.cpp -o hello -mv62 -pg

Error

hexagon-clang++  main.cpp -o hello -mv62 -pg
Error: /tmp/main-924ac3.o(.text+0x30): undefined reference to `mcount'
Error: /tmp/main-924ac3.o(.text+0x130): undefined reference to `mcount'
Fatal: Linking had errors.

This is my first time to write code for DSP chip, specifically the hexagon 682. Are there any tutorials or references other than the programmer reference manual because they haven't been very useful in helping me understand how things work. Specially I don't understand how SIMD programming works. I am not sure what's the size of SIMD registers. Also it seems that using Floating point in DSP chips is not a great idea. So would it be better if I convert my code to use fixed point.


回答1:


You can use hexagon-sim to generate the profiling data without rebuilding instrumented binaries.

hexagon-sim --profile ./hello will generate the gmon input file(s) necessary for hexagon-gprof to consume.

e.g. (taken from SDK 3.3.3 Examples/)

hexagon-clang -O2 -g -mv5   -c -o mandelbrot.o mandelbrot.c
hexagon-clang -O2 -g -mv5 mandelbrot.o -o mandelbrot -lhexagon
hexagon-sim -mv5 --timing --profile mandelbrot
hexagon-gprof mandelbrot gmon.t*

Note also that the SDK comes with hexagon-profiler, a richer tool that allows you to see in depth performance counters -- information beyond just which code was executed and how often.

See "Hexagon Profiler User Guide" (doc number 80-N2040-10 A) for details.

Are there any tutorials or references other than the programmer reference manual because they haven't been very useful in helping me understand how things work.

Specially I don't understand how SIMD programming works. I am not sure what's the size of SIMD registers.

Hexagon's vector programming extension is called "HVX". There's a HVX-specific PRM that's available at https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools -- it describes different 512-bit and 1024-bit vector modes.



来源:https://stackoverflow.com/questions/50076455/how-to-profile-code-in-hexagon-dsp-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!