More Power & Flexibility, Yet Greater Usability in 5 Ways – Hexagon DSP SDK 3.3.2

Wednesday 12/20/17 10:00am
Posted By Felix Baum
  • Up0
  • Down0

We’re on a mission here to make it easier for you to program the Qualcomm® Hexagon™ DSP.

It’s kind of a shame to throw workloads like inference, scene classification, image processing and video playback enhancement at the CPU and GPU of an edge device like a smartphone, where they burn up cycles and wear down the battery. The easier we make it for you to program the DSP, the sooner your apps can run those and similar workloads with higher performance and lower power consumption.

That’s why our newly released Hexagon DSP SDK 3.3.2 has “usability” written all over it.

Woman standing next to man on movie set

If you’re an embedded developer, you’ll find this kit contains the kinds of programming tools you’re used to. And if you’re a mobile app developer, you’ll find what you need to smooth the transition to DSP programming, which-let’s face it-may seem formidable to some of you, even though it doesn’t need to be.

In this post, I’ll go through ways we’ve rolled much greater usability into the SDK.

1. Don’t program the DSP from scratch. We have plenty of sample code for you.

To show how serious we are about usability, we’ve beefed up the sample code and documentation in the SDK. You’ll find sample code for the Hexagon Vector eXtensions (HVX) benchmark and for using Halide on Hexagon. There’s an updated Getting Started guide and updates to the documentation for the profiler, simulator and debugger. We’ve included a user guide for QuRT (the real-time OS running on Hexagon) and DSP Compute, and an update on the HVX context save/restore feature.

2. Don’t rewrite your C++ algorithms. We support them on the DSP.

We’ve seen many developers turn to DSP programming from the embedded world, tempted by the twin sirens of high performance and low power consumption. They’ve spent ages perfecting algorithms in C or C++ that run, say, low-light video capture, image stabilization or convolutional neural networks on the CPU. Not many of them want to recode and optimize all that work to run on the DSP when they’re not even certain they’ll see the promised benefits.

Since last January we’ve provided a compiler and library designed to let you use C++ in your DSP programming with the Hexagon SDK. And now, in SDK 3.3.2 we’ve updated the compiler toolchain to allow frameworks and algorithms written in C++ 11/14 to execute on the Hexagon DSP.

That means that, without needing to rewrite those algorithms, you can simply recompile them for the DSP to get them to execute on Hexagon. That’s a big first step and you may see a performance boost and power savings just from that. In most cases, we expect that you’ll need to optimize some more.

3. Don’t write your own programming tools. We’ve included them.

Hexagon contains DSP logic along with CPU-like capabilities and features, so think of it as an embedded processor. In Hexagon SDK 3.3.2 we’ve beefed up the tool set for writing, debugging and profiling to ensure your apps get the most from the underlying hardware:

  • Full toolbox - In the SDK you’ll find a full LLVM toolchain (compiler, linker, assembler), diagnostic logging, a performance monitor, a dynamic linker and loader, and a simulator that supports co-simulation and virtual platforms.
  • Debugger - We’ve added support for LLDB, which means better support for C and C++ code. When you connect your development workstation and a reference board or device via USB, you can now perform common debugging operations in your IDE, such as single-stepping through your code, using breakpoints and inspecting registers or memory contents.
  • IDE plug-in - The SDK includes a plug-in for the Eclipse IDE for better integration with your dev environment.
  • Profiler - In sysMon, the DSP profiler, we’ve refined and exposed capabilities to give you deeper insight into algorithm performance. To help you see how your code performs on Hexagon, sysMon now collects and displays performance, cache and other relevant metrics.

With this more powerful complement of the tools you’re used to, we think you’ll find the SDK much more usable.

4. Don’t create your own image processing language. We have a Halide tool set for you.

If you work on camera and image processing, you’ve probably heard of or used Halide for high-performance vision and imaging algorithms. We figured that Halide and Hexagon made a good match, so we worked with Google to build a Halide toolset for HVX. Here’s what we have for you:

  • Halide compiler - As part of Hexagon SDK 3.3.2 and the Hexagon LLVM tool set, the Halide tool set offers a Halide compiler that targets the Hexagon DSP and HVX. That means that, if you’re familiar with C++ constructs, you don’t need deep knowledge of the underlying processor architecture to start authoring Halide programs. Instead, you can focus on getting as much performance for your image algorithm from the DSP as possible.
  • Halide runtime - This runtime is designed to make it easy for you to transparently dispatch kernels to Hexagon by adding a simple .hexagon() directive. That’s an important convenience in heterogeneous computing.
  • Halide conciseness - In our own testing with image processing on devices powered by Qualcomm Snapdragon 835 and 845 mobile platforms, we started with an efficient algorithm that took about 175 lines of assembly code. We then rewrote it into a C routine with about 100 lines of code and a slight drop in performance. Finally, we rewrote it in Halide using less than two dozen lines of code and got back to the same level of performance as with assembly code. YMMV, but if you like coding tight, you’ll probably like Halide.

5. Don’t write your own neural network library. We have one for you.

There’s more and more talk about how on-device processing gives your AI applications the edge, and how it makes sense to train neural network models in the cloud, then run inference on the device. Most companies are trying to optimize their AI processing on the CPU or GPU, but at Qualcomm Technologies, Inc. (QTI), we’ve spent the last couple of years optimizing AI processing on the DSP.

Next step: Download the SDK

While Hexagon is one of the blocks of the heterogeneous computing model on Snapdragon, Hexagon DSP SDK 3.3.2 feels like an embedded development platform of its own. It supports devices powered by Snapdragon models SDM630, SDM660, SDM820, SDM835, SDM845 and SDM670.