halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.89k stars 1.07k forks source link

Using Hexagon DSP on consumer hardware #5200

Open mirsadm opened 4 years ago

mirsadm commented 4 years ago

I am wondering if it is possible use the Hexagon DSP on a consumer device? I'm interested in comparing the difference in performance between the CPU and DSP on my device but have not had much luck in getting it to work. I'm using the Halide distribution from the Hexagon SDK. It appears to support an "unsigned" mode on newer devices (Snapdragon 855). I'm getting errors ranging from unable to load 'libhalide_hexagon_host.so' to access denied when running dlopen on 'libhalide_hexagon_remote_skel.so' if I package the shared library with my app.

Any help would be appreciated.

dsharletg commented 4 years ago

@pranavb-ca @dpalermo would be best equipped to answer this.

My experience is that you need devices that allow unsigned or debug-signed code to run. However, if you see an "unsigned" mode, it seems like that should work....?

Other obstacles you might be encountering are:

pranavb-ca commented 4 years ago

Indeed, on 855 there is unsigned mode execution that is available. I checked and realized we haven't upstream this yet. But, there is not reason not to. Let me push it up in a bit. Other than that like @dsharletg mentioned, if you are writing an app (apk) you need to ensure that libhalide_hexagon_host.so is packaged in your app itself (https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs). And again as mentioned before, you need to set up ADSP_LIBRARY_PATH to access libhalide_hexagon_remote_skel.so

mirsadm commented 4 years ago

@dsharletg @pranavb-ca Thanks for the help. I did manage to get it working by uploading the shared libraries to the SD card and setting the environment variable to point to that instead. For whatever reason packaging inside the APK didn't seem to work. They didn't seem to be available outside the APK. Right now it seems to fail to allocate any size memory with ion_malloc() when copying to the device. I haven't had much time to investigate this issue yet, I could just be using it incorrectly I guess.

Neustradamus commented 3 years ago

Hello guys,

I wish you a Happy New Year!

I contact you because you work on Hexagon DSP SDK.

And a lot of people have problems with AC3 and the Snapdragon 835 (Qualcomm Hexagon 682 DSP):

I think a translator is needed.

What do you think?

Or who can help?

Thanks in advance.