Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hexagon] -Build Hexagon runtime components using the Hexagon SDK (Clone of #7671) #7741

Merged
merged 18 commits into from
Aug 21, 2023

Conversation

pranavb-ca
Copy link
Contributor

This is work by @alexreinking. This is essentially #7671 with main merged into it to fix clang-tidy and clang-format issues. I am opening this new PR because I dont have access to his branch.
Here is the opening comment from his PR.


This is a reimplementation of #7659 that uses ExternalProject and the Hexagon SDK-provided toolchain files. This will require relatively less maintenance when porting the build between Hexagon SDK versions.

Notable changes:

The source files in src/runtime/hexagon_remote have been arranged into subdirectories qurt and android based on which toolchain must compile them. This avoids a horrible use of recursive CMake.
To-do:

  • Use SYSTEM includes for the SDK directories.
  • Decide what to do about the new dependency.
    • Should Hexagon be off by default?
    • Should this part of the build be controlled by a new switch?
    • Should Halide depend on hexagon_runtime?
  • Update GHA CI (clang-tidy missing Hexagon SDK)
  • Add install rules for these artifacts (if need be)
    • Should/can these be part of our binary distribution?
  • Update or remove the Makefile for this part.
  • Remove precompiled binaries from the repository
  • Update documentation
    • Requires Hexagon SDK 4.3.0.0, specifically.

Future work:

  • Port to latest Hexagon SDK

Copy link
Contributor

@steven-johnson steven-johnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending green

@steven-johnson
Copy link
Contributor

steven-johnson commented Aug 4, 2023

clang-tidy is still failing -- note that changes to the buildbot master have no effect on clang-tidy (which is run via GitHub Actions).

EDIT: I think I have a fix.

@steven-johnson
Copy link
Contributor

So even with the Buildbot fix landed, this still won't work as-is: The rules in FindHexagonSDK.cmake seem to assume that the SDK will always be found... which isn't true for most buildbots (and, in general, for most people building Halide); e.g. the arm-32-linux buildbots don't have a Hexagon SDK (and never will, it's not available for that architecture).

I'm not sure how to fix those rules, unfortunately, but we need to fix them before this can land.

@pranavb-ca
Copy link
Contributor Author

Thanks @steven-johnson. I was out of office today. Let me look into this on Monday and get back to you here.

@pranavb-ca
Copy link
Contributor Author

So even with the Buildbot fix landed, this still won't work as-is: The rules in FindHexagonSDK.cmake seem to assume that the SDK will always be found... which isn't true for most buildbots (and, in general, for most people building Halide); e.g. the arm-32-linux buildbots don't have a Hexagon SDK (and never will, it's not available for that architecture).

I'm not sure how to fix those rules, unfortunately, but we need to fix them before this can land.

@steven-johnson - This is to take care of the Halide configuration failure in the bots that don't handle hexagon. halide/build_bot#253

@steven-johnson
Copy link
Contributor

That buildbot fix is a good one (and I have landed it) but it won't address this issue at all; your fix simply reduces unnecessary build time for LLVM on those bots, but the issue at hand here is that the Halide CMake rules for finding the Hexagon SDK will fail if the SDK isn't found; this is irrelevant to how LLVM is built.

@pranavb-ca
Copy link
Contributor Author

That buildbot fix is a good one (and I have landed it) but it won't address this issue at all; your fix simply reduces unnecessary build time for LLVM on those bots, but the issue at hand here is that the Halide CMake rules for finding the Hexagon SDK will fail if the SDK isn't found; this is irrelevant to how LLVM is built.

The revert of the build fix notwithstanding, for the sake of checking my understanding of cmake, isnt it correct that the Hexagon SDK will be searched for only if this condition is true? https://github.com/halide/Halide/pull/7741/files#diff-b54200773c0b5ab32237121a90d2145324228571bce9b10a4c16e1f5361902baR342

A Halide user using Hexagon already needs the SDK in offload mode (use of `.hexagon()) - all correctness tests that test HVX use by required HL_HEXAGON_TOOLS`` which in turn resides inside the SDK. (While it is possible for a user to get access only LLVM Hexagon Tools and not the entire SDK, in my experience that is rarely the case)

@steven-johnson
Copy link
Contributor

The revert of the build fix notwithstanding, for the sake of checking my understanding of cmake, isnt it correct that the Hexagon SDK will be searched for only if this condition is true? https://github.com/halide/Halide/pull/7741/files#diff-b54200773c0b5ab32237121a90d2145324228571bce9b10a4c16e1f5361902baR342

Yes, but TARGET_HEXAGON only means "we can generate Hexagon code", which shouldn't require the SDK to be present -- it should only require that LLVM is built with Hexagon codegen enabled.

A Halide user using Hexagon already needs the SDK in offload mode (use of .hexagon()) - all correctness tests that test HVX use by required `HL_HEXAGON_TOOLS`` which in turn resides inside the SDK. (While it is possible for a user to get access only LLVM Hexagon Tools and not the entire SDK, in my experience that is rarely the case)

A user only requires it if they are running the correctness tests for Hexagon -- which we don't run on systems that don't have the SDK.

@pranavb-ca
Copy link
Contributor Author

The revert of the build fix notwithstanding, for the sake of checking my understanding of cmake, isnt it correct that the Hexagon SDK will be searched for only if this condition is true? https://github.com/halide/Halide/pull/7741/files#diff-b54200773c0b5ab32237121a90d2145324228571bce9b10a4c16e1f5361902baR342

Yes, but TARGET_HEXAGON only means "we can generate Hexagon code", which shouldn't require the SDK to be present -- it should only require that LLVM is built with Hexagon codegen enabled.

A Halide user using Hexagon already needs the SDK in offload mode (use of .hexagon()) - all correctness tests that test HVX use by required `HL_HEXAGON_TOOLS`` which in turn resides inside the SDK. (While it is possible for a user to get access only LLVM Hexagon Tools and not the entire SDK, in my experience that is rarely the case)

A user only requires it if they are running the correctness tests for Hexagon -- which we don't run on systems that don't have the SDK.

Ok, I get it. So, this means that we should perhaps have a CMake variable that optionally builds the hexagon_remote runtime and that defaults to OFF in most cases. Does that sound reasonable?

@steven-johnson
Copy link
Contributor

CMake variable that optionally builds the hexagon_remote runtime and that defaults to OFF in most cases

Yes.

@pranavb-ca
Copy link
Contributor Author

CMake variable that optionally builds the hexagon_remote runtime and that defaults to OFF in most cases

Yes.

Done.
Also added to the buildbot -> halide/build_bot#256

@steven-johnson
Copy link
Contributor

buildbot updated, re-running tests here

@steven-johnson
Copy link
Contributor

steven-johnson commented Aug 14, 2023

Looks like we still have legit build failures: https://buildbot.halide-lang.org/master/#/builders/163/builds/69

FAILED: src/runtime/hexagon_remote/halide_hexagon_remote.h src/runtime/hexagon_remote/halide_hexagon_remote_skel.c src/runtime/hexagon_remote/halide_hexagon_remote_stub.c /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote.h /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote_skel.c /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote_stub.c 
cd /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote && /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/ipc/fastrpc/qaic/Ubuntu16/qaic -I /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/incs/stddef /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-source/src/runtime/hexagon_remote/halide_hexagon_remote.idl
/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/ipc/fastrpc/qaic/Ubuntu16/qaic: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory

@pranavb-ca
Copy link
Contributor Author

Looks like we still have legit build failures: https://buildbot.halide-lang.org/master/#/builders/163/builds/69

FAILED: src/runtime/hexagon_remote/halide_hexagon_remote.h src/runtime/hexagon_remote/halide_hexagon_remote_skel.c src/runtime/hexagon_remote/halide_hexagon_remote_stub.c /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote.h /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote_skel.c /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/halide_hexagon_remote_stub.c 
cd /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote && /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/ipc/fastrpc/qaic/Ubuntu16/qaic -I /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/incs/stddef /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-source/src/runtime/hexagon_remote/halide_hexagon_remote.idl
/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/ipc/fastrpc/qaic/Ubuntu16/qaic: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory

@steven-johnson - Is it possible to install libffi on buildbot worker?
Alternatively, if the idea is to not expose someone who builds Halide to this dependency then, we'd have to run qaic offline and check in its outputs (build/src/runtime/hexagon_remote/halide_hexagon_remote_skel.c, build/src/runtime/hexagon_remote/halide_hexagon_remote_stub.c and build/src/runtime/hexagon_remote/halide_hexagon-remote.h) into the repository.

@steven-johnson
Copy link
Contributor

@steven-johnson - Is it possible to install libffi on buildbot worker?

If it's just sudo apt libffi-dev or similar, then yes, easy-peasy :-) I'll go try that now.

Alternatively, if the idea is to not expose someone who builds Halide to this dependency

I don't have strong feelings about this -- it's always preferable to avoid extra requirements, of course, but since this already has one large extra requirement anyway (i.e.: the Hexagon SDK), one more if probably no big deal. (We should add this to a README, of course.)

@steven-johnson
Copy link
Contributor

Update: looks like both the linuxbots already have libffi-dev installed, but not the right version (libffi.so.7 instead of 6). I'll see if I can figure out how to make them happy.

@steven-johnson
Copy link
Contributor

So it appears that libffi.so.6 is no longer available in Ubuntu 20.04 (which is what our buildbots are running). Various suggestions include manually downloading and installing the Ubuntu 19 version; I'll try that.

(Ideally, the Hexagon SDK code would upgrade to use the newer versions at some point :-)

@steven-johnson
Copy link
Contributor

With libffi.6 installed, new failures:

https://buildbot.halide-lang.org/master/#/builders/163/builds/73

[28/714] Performing configure step for 'hexagon_remote-qurt'
loading initial cache file /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/tmp/hexagon_remote-qurt-cache-Release.cmake
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- The C compiler identification is Clang 10.0.0
-- The CXX compiler identification is Clang 10.0.0
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/src/hexagon_remote-qurt-build
ninja: build stopped: subcommand failed.

@pranavb-ca
Copy link
Contributor Author

With libffi.6 installed, new failures:

https://buildbot.halide-lang.org/master/#/builders/163/builds/73

[28/714] Performing configure step for 'hexagon_remote-qurt'
loading initial cache file /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/tmp/hexagon_remote-qurt-cache-Release.cmake
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- The C compiler identification is Clang 10.0.0
-- The CXX compiler identification is Clang 10.0.0
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/src/hexagon_remote-qurt-build
ninja: build stopped: subcommand failed.

Thank you very much @steven-johnson for installing libffi.so. Let me dig into the failures now.

@pranavb-ca
Copy link
Contributor Author

pranavb-ca commented Aug 16, 2023

(Ideally, the Hexagon SDK code would upgrade to use the newer versions at some point :-)

Better still :) The latest version of the hexagon SDK has a 'qaic' binary that doesn't depend on libffi

$>ldd ./qaic/Ubuntu20/qaic  | grep libffi
$>ldd ./qaic/Ubuntu18/qaic  | grep libffi
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fceda1ca000)

@pranavb-ca
Copy link
Contributor Author

With libffi.6 installed, new failures:

https://buildbot.halide-lang.org/master/#/builders/163/builds/73

[28/714] Performing configure step for 'hexagon_remote-qurt'
loading initial cache file /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/tmp/hexagon_remote-qurt-cache-Release.cmake
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- CMAKE_HOST_SYSTEM_NAME:Linux
-- Hexagon TOOLS ROOT:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11
-- _QURT_INSTALL_DIR:/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/rtos/qurt/computev65
-- Hexagon C Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- Hexagon  CXX Executable Linker Line:-march=hexagon -mcpu=hexagonv65 -o <TARGET> -G0 /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0_standalone.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/crt0.o /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/init.o -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/ -L/home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/ --no-threads --dynamic-linker= -E --force-dynamic -u main --start-group <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS> /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/libhexagon.a --end-group --start-group -lstandalone -lc -lgcc --end-group /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/target/hexagon/lib/v65/G0/fini.o
-- The C compiler identification is Clang 10.0.0
-- The CXX compiler identification is Clang 10.0.0
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
System is unknown to cmake, create:
Platform/QURT to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/HEXAGON_Tools/8.4.11/Tools/bin/hexagon-clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/hexagon/src/hexagon_remote-qurt-build
ninja: build stopped: subcommand failed.

There seem to be problems in the Android NDK on the worker.

FAILED: src/runtime/hexagon_remote/arm-32-android/src/halide_hexagon_host-armeabi-v7a-stamp/halide_hexagon_host-armeabi-v7a-configure /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/arm-32-android/src/halide_hexagon_host-armeabi-v7a-stamp/halide_hexagon_host-armeabi-v7a-configure 
cd /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/arm-32-android/src/halide_hexagon_host-armeabi-v7a-build && /snap/cmake/1130/bin/cmake -GNinja -C/home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/arm-32-android/tmp/halide_hexagon_host-armeabi-v7a-cache-Release.cmake /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-source/src/runtime/hexagon_remote/android && /snap/cmake/1130/bin/cmake -E touch /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/arm-32-android/src/halide_hexagon_host-armeabi-v7a-stamp/halide_hexagon_host-armeabi-v7a-configure
loading initial cache file /home/halidenightly/build_bot/worker/halide-testbranch-main-llvm18-x86-64-linux-cmake/halide-build/src/runtime/hexagon_remote/arm-32-android/tmp/halide_hexagon_host-armeabi-v7a-cache-Release.cmake
CMake Error at /snap/cmake/1130/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:130 (message):
  Could not find toolchain file:
  /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools/android-ndk-r19c/build/cmake/android.toolchain.cmake
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

OTOH, on my local machine, I do see the toolchain file in the ndk

ls 4.3.0.0/tools/android-ndk-r19c/build/cmake/android.toolchain.cmake -ltr
-rw-r--r-- 1 pranavb users 26469 Mar  1  2019 4.3.0.0/tools/android-ndk-r19c/build/cmake/android.toolchain.cmake

@steven-johnson
Copy link
Contributor

The SDK installed on the buildbots doesn't appear to have the android ndk at all, at least not under tools:

$ ls /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools
HEXAGON_Tools  qhcg

If you can point me at a pristine installer for the HVX SDK, I can do a fresh reinstall if we think that might help.

@pranavb-ca
Copy link
Contributor Author

The SDK installed on the buildbots doesn't appear to have the android ndk at all, at least not under tools:

$ ls /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools
HEXAGON_Tools  qhcg

If you can point me at a pristine installer for the HVX SDK, I can do a fresh reinstall if we think that might help.

Thank you, sounds good. Let me get an installer from our SDK team.

@pranavb-ca
Copy link
Contributor Author

The SDK installed on the buildbots doesn't appear to have the android ndk at all, at least not under tools:

$ ls /home/halidenightly/Qualcomm/Hexagon_SDK/4.3.0/tools
HEXAGON_Tools  qhcg

If you can point me at a pristine installer for the HVX SDK, I can do a fresh reinstall if we think that might help.

Thank you, sounds good. Let me get an installer from our SDK team.

@steven-johnson - There are two different ways to go about this.

$>find android-ndk-r19c/build/ -iname "*.cmake"
android-ndk-r19c/build/cmake/system_libs.cmake
android-ndk-r19c/build/cmake/android.toolchain.cmake
android-ndk-r19c/build/cmake/platforms.cmake
android-ndk-r19c/build/cmake/abis.cmake

** I don't know why it wasn't there the first time we set this up.

  • The other option is to install the hexagon sdk with a full android ndk again.
    ** The way to do this now is to use the Qualcomm Package Manager (QPM) which has a cli option (qpm-cli. It requires a one-time account set up. If you are interested in going this route, let me know, i'll send you a detailed email on how to install the sdk using qpm-cli

The second option will be better in the long term when we (soon) want to update the SDK.

@steven-johnson
Copy link
Contributor

I installed the unsupported NDK. Trying again.

@pranavb-ca
Copy link
Contributor Author

I installed the unsupported NDK. Trying again.

Thank you very much. The test passed (https://buildbot.halide-lang.org/master/#/builders/163/builds/84) and the failure in https://buildbot.halide-lang.org/master/#/builders/154/builds/93 is unrelated.

@steven-johnson steven-johnson merged commit fcc1c3b into main Aug 21, 2023
3 checks passed
@steven-johnson steven-johnson deleted the pdb_codelinaro_hexagon/use_cmake_toolchain branch August 21, 2023 21:16
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
…one of halide#7671) (halide#7741)

* Add CMakeLists.txt to build the hexagon_remote runtime.

* Print an error message if libhalide_hexagon_host.so is not found.

* Fix case mismatch in hexagon_remote/CMakeLists.txt

* Remove some code that had been commented out in hexagon_remote/CMakeLists.txt

* Remove unused argument in macro in hexagon_remote/CMakeLists.txt

* add find module for Hexagon

* move more variables to find module

* Build binary modules with ExternalProject

* group platform-speicifc sources into subdirectories

* Pass HEXAGON_TOOLS_ROOT, too

* Use the desired layout for the build-tree artifacts

* Use SYSTEM for Hexagon SDK include dirs

* trigger buildbots

* Ignore code in src/runtime/hexagon_remote/bin/src for clang-tidy

* Just skip hexagon_remote entirely for Halide_CLANG_TIDY_BUILD

* Add an option to enable the building of the hexagon remote runtime

---------

Co-authored-by: Alex Reinking <[email protected]>
Co-authored-by: Steven Johnson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants