【问题标题】:How to profile code in hexagon dsp simulator如何在 hexagon dsp 模拟器中分析代码
【发布时间】:2018-10-09 03:05:28
【问题描述】:

我一直在尝试使用 -pg 编译我的代码以在模拟器中启用分析,一旦我这样做,它就会给我链接器错误。

编译命令

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

错误

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.

这是我第一次为 DSP 芯片,特别是六边形 682 编写代码。除了程序员参考手册之外,还有其他教程或参考资料,因为它们对帮助我理解事情的工作原理没有多大帮助。特别是我不明白 SIMD 编程是如何工作的。我不确定 SIMD 寄存器的大小。此外,在 DSP 芯片中使用浮点似乎不是一个好主意。那么如果我将我的代码转换为使用定点会更好。

【问题讨论】:

  • 您拥有哪个版本的 SDK 或工具?试试“hexagon-clang++ --version
  • sdk 3.3.3 和 Hexagon Clang 版本 8.1.05(基于 LLVM 4.0.0)

标签: clang profiling hexagon-dsp


【解决方案1】:

您可以使用hexagon-sim 生成分析数据,而无需重新构建检测二进制文件。

hexagon-sim --profile ./hello 将生成hexagon-gprof 消费所需的gmon 输入文件。

例如(取自 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*

另请注意,SDK 附带了hexagon-profiler,这是一个更丰富的工具,可让您深入查看性能计数器——除了执行哪些代码和执行频率之外的信息。

有关详细信息,请参阅“Hexagon Profiler 用户指南”(文档号 80-N2040-10 A)。

有没有除程序员以外的教程或参考资料 参考手册,因为它们在帮助我方面不是很有用 了解事情是如何运作的。

特别是我不明白 SIMD 编程的工作原理。我不知道 SIMD 寄存器的大小是多少。

Hexagon 的矢量编程扩展名为“HVX”。 https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools 提供了一个特定于 HVX 的 PRM——它描述了不同的 512 位和 1024 位矢量模式。

【讨论】:

    猜你喜欢
    • 2021-10-15
    • 1970-01-01
    • 2021-11-03
    • 2021-09-12
    • 1970-01-01
    • 2023-03-31
    • 2010-10-02
    • 1970-01-01
    相关资源
    最近更新 更多