halide / Halide

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

Required Hexagon runtime symbol 'halide_hexagon_remote_load_library' not found. #4650

Closed andrewjong closed 4 years ago

andrewjong commented 4 years ago

Hi all,

I'm trying to follow the Halide for Hexagon HVX instructions on the Readme, but run into an error: "Required Hexagon runtime symbol 'halide_hexagon_remote_load_library' not found."

The steps I took:

I get this error:

bin/host-hvx_128/test Error: Required Hexagon runtime symbol 'halide_hexagon_remote_load_library' not found. make: *** [Makefile:31: test] Aborted (core dumped)

The same error appears if I try host-hvx_64.

I found @steven-johnson 's issue from last year, but there didn't seem to be a solution.

Help, please? Thanks much.

dsharletg commented 4 years ago

I think that Hexagon Tools 7.2.12 is quite old at this point. I'm not sure if that is causing the problem here in particular, but it seems like it would be a good idea to upgrade anyways.

That error means that we aren't loading the Hexagon runtime (when running on the simulator: https://github.com/halide/Halide/tree/master/src/runtime/hexagon_remote/bin/host). So either we aren't able to find that library, or, the library is failing to load (because of a missing dependency?). running with HL_TARGET=host-hvx_128-debug might give more information.

andrewjong commented 4 years ago

Hi @dsharletg , thanks very much for your fast response.

This is the output when I run wih host-hvx_128-debug

bin/host/halide_blur.generator -g halide_blur -e static_library,h,registration,stmt,assembly -o bin/host-hvx_128-debug target=host-hvx_128-debug
g++ -O3 -std=c++11 -I ../../distrib/include/ -I ../../distrib/tools/  -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi -fopenmp -Wall -O2 -Ibin/host-hvx_128-debug test.cpp bin/host-hvx_128-debug/halide_blur.a -o bin/host-hvx_128-debug/test  -ldl -lpthread -lz
bin/host-hvx_128-debug/test
Entering Pipeline halide_blur
Target: x86-64-linux-avx-avx2-debug-f16c-fma-hvx_128-sse41
 Input Buffer input: buffer(0, 0x0, 0x7fda8f55b080, 1, uint16, {0, 648, 1}, {0, 482, 648})
 Output Buffer blur_y: buffer(0, 0x0, 0x55c64a41c700, 0, uint16, {0, 640, 1}, {0, 480, 640})
dlerror: libwrapper.so: cannot open shared object file: No such file or directory
dlerror: libhalide_hexagon_host.dll: cannot open shared object file: No such file or directory
Hexagon: init_hexagon_runtime (user_context: 0x0)
    halide_get_library_symbol('halide_hexagon_remote_load_library') -> 
        0x0
Error: Required Hexagon runtime symbol 'halide_hexagon_remote_load_library' not found.
make: *** [Makefile:31: test] Aborted (core dumped)
rm bin/host-hvx_128-debug/halide_blur.a

It seems it can't find the library libhalide_hexagon_host.dll. Is this related to Hexagon Tools?

dsharletg commented 4 years ago

Yes, I think you need to update your hexagon tools. There are two relevant lines:

dlerror: libwrapper.so: cannot open shared object file: No such file or directory
dlerror: libhalide_hexagon_host.dll: cannot open shared object file: No such file or directory

The first error is because we actually loaded libhalide_hexagon_host.so, but one of its dependencies (libwrapper.so) was not found. libwrapper.so is part of the Hexagon tools. (Because that failed, we then tried to load the dll: https://github.com/halide/Halide/blob/5b15eb5acea109232a56fc696cd821a7d8c10563/src/runtime/hexagon_host.cpp#L123-L125 but that's only relevant on windows).

andrewjong commented 4 years ago

Thank you very much! That's quite helpful. I'll try to find an updated Hexagon Tools and report back.

andrewjong commented 4 years ago

Found Hexagon Tools, was confusing because Halide's Readme on Hexagon is out of date.

export HL_HEXAGON_TOOLS=/home/user/Qualcomm/Hexagon_SDK/3.5.1/tools/HEXAGON_Tools/8.3.07/Tools
dpalermo commented 4 years ago

Just a quick follow-up. Is the SDK 3.5.1 from https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools installing tools/HEXAGON_Tools/8.3.07 for you?

andrewjong commented 4 years ago

Yes that's correct. I was confused because the Readme made me think that it would be under /home/user/Qualcomm/Hexagon_Tools/8.0/Tools/

(where /home/user/Qualcomm is my $SDK_LOC)

But it was really under /home/user/Qualcomm/Hexagon_SDK/3.5.1/tools/HEXAGON_Tools/8.3.07/Tools

Thanks for all your help.

I am running into another problem, however, that I'm looking into.