Qualcomm® Hexagon™ DSP¶
Game developers have another tool to create best-in-class mobile experiences that are uniquely available for Qualcomm platforms. Snapdragon SoCs have Hexagon, which is a programmable digital signal processor (DSP) alongside the Kryo CPU and Adreno GPU. Hexagon was designed for modem and multimedia functions, and is optimized for performance and power efficiency.
Instead of pushing performance with large frequency values, Hexagon allows for high throughput of work per cycle and a lower clock speed. While Hexagon is not designed for game development, its architecture and programmable nature allows game developers to offload tasks to it, alleviate work on other cores, and conserve power.
This guide introduces basic concepts and techniques relevant for game development. For more in-depth information about programming for the Hexagon, please visit Hexagon DSP SDK.
An important aspect of Hexagon, is that communication with DSP is done through inter-process communication (IPC). To accomplish this, using the FastRPC (Remote Procedure Call) library is required. This process has a higher latency than a roundtrip to the GPU, so a careful investigation of tasks that could be offloaded to the GPU is necessary to identify the best usage of this path and to stay within your game frame budget. The DSP does not share caches with other cores and data transfers must be done through DRAM. Handing buffers to and from the CPU, GPU, and DSP is streamlined in Android via Android Native Hardware Buffers which allow for no-copy buffer management.
Hexagon Vector eXtensions¶
One of the most powerful aspects that game developers can leverage to make optimal use of Hexagon is proper use of its co-processor. The co-processor allows for single instruction multiple data (SIMD) vector operations via the Hexagon Vector eXtensions (HVX) instruction set.
For example, in Hexagon DSP v66, SIMD operations execute on large vector registers of up to 1024 bits each. On top of this, multiple SIMD instructions can be executed in parallel.
For in-depth documentation on leveraging this HVX set, visit the HVX Reference Manual.
Hexagon Programming Primer¶
Hexagon is programmed by the Hexagon SDK. This SDK comes with a comprehensive set of documentation describing Hexagon DSP, how to program for it, and includes various sample applications.
As shown in the picture below, a DSP program is split into two main parts. The portion that interfaces with the client method in the application’s space uses a Stub, which is the compiler generated functionality that interfaces with the DSP RPC driver.
It is worth noting that DSP offloading is serial at this point, and the calls done to FastRPC are blocking. The portion that interfaces with the DSP level is handled by an auto generated Skel code that takes care of unmarshaling parameters, and interfaces between executing in the application’s DSP and the DSP RPC Framework.