OnQ Blog

How to use FastRPC to offload from CPU to Qualcomm Hexagon DSP

23 juil. 2015

Qualcomm products mentioned within this post are offered by Qualcomm Technologies, Inc. and/or its subsidiaries.

What do drones, robots and cameras have in common?

They can all take advantage of the DSP for higher performance in real-time tasks. In drones, that means flight control; in robots, that means balance and walking; and in cameras, it means image pre- and post-processing. Offloading real-time tasks from the CPU to the DSP is a big step toward higher performance, with the sweetener of much lower power consumption.

How To Use Hexagon DSP And FastRPC

Our Hexagon SDK exposes FastRPC, a remote procedure call framework allowing clients to transparently make remote method invocations between the Qualcomm Snapdragon processor (APPS) and the application DSP (aDSP). It’s available now on the Snapdragon 8074 built into the DragonBoard 800, a product of Intrinsyc Technologies Corporation, as well as the 8084 and 8994.

FastRPC is designed around several features that make offloading tasks as easy as possible:

  • Initiating the remote invocation looks the same as if you called it locally, you provide the function definition via IDL (Interface Description Language).
  • Tools auto-generate interface header and libs to handle parameter passing, cache coherency.
  • For FastRPC calls into dynamic modules the framework loads the aDSP module for you.
  • FastRPC is synchronous. That eliminates the complexity of having the kernel manage state between aDSP and APPS in an asynchronous call.

The diagram shows the invocation of a single method in which the client resides on APPS (e.g., Snapdragon CPU) and the object resides on the aDSP (e.g., Hexagon). The stub and skel are auto-generated, you only need to call the function from the applications processor and provide the implementation of that function on the aDSP.

On an Android device that supports FastRPC, these are the steps to get your job offloaded to the aDSP.

  1. Download and install the Hexagon SDK.
  2. Describe your job’s API in IDL (Interface Description Language).
  3. Auto generate your header, and the stub and skel libraries.
  4. Implement your API on the DSP, link it and the skel library into a shared object, push the shared object to the device.
  5. Link the stub to your android native app and call your API.
  6. (Optional) Create java bindings for your API and call you API from an APK.

That’s it.

A Drone Developer Kit?

Not exactly.

But we’re seeing developers take the Snapdragon processor in that direction, and the Hexagon DSP goes with it. You can do plenty more on the DSP than just multimedia, so dig in and find out for yourself.

If you’re a drone or robotics developer looking for faster execution of real-time tasks with lower power consumption, apply for access to the Hexagon SDK. It includes full documentation and code samples for invoking FastRPC.

And stay tuned for more how-to’s and use cases involving Hexagon.