[Hexagon] Experimental Qualcomm Hexagon DSP HAL driver (part 1: list and open devices) (#25188)

This is the first part of upstreaming the Hexagon HAL driver that
Roofline is developing in a separate plugin repository
(https://github.com/RooflineAI/iree-hexagon-plugins). The driver runs on
Android arm64 hosts and is compatible with Qualcomm Snapdragon SoCs,
using FastRPC to drive the Hexagon DSP. It lives in
`experimental/runtime/src/iree/hal/drivers/hexagon` and is neither
included in the cmake build nor in the bazel build by default.

This initial PR adds the part of the runtime for listing Hexagon devices
and opening a Hexagon device. However, no functionality is provided by
this device yet, so it immediately will fail with UNIMPLEMENTED.

See `experimental/runtime/src/iree/hal/drivers/hexagon/README.md` for
how to build the (partial) Hexagon runtime and how to test it.

# Commits on this PR

- **[Bazel] Add Android arm64 cross-compilation toolchain**
Adds a C/C++ toolchain and platform for building the runtime for Android
  arm64 with the Android NDK r28 (API level 28):
  `bazel build --config=android_arm64 //tools:iree-run-module`.
The NDK is located via the `ANDROID_NDK` (or `ANDROID_NDK_HOME`)
environment
  variable. Without a configured NDK the repository is a stub and the
toolchain targets are only analyzed for Android, so host builds are not
  affected.
  `iree_is_android` now also matches the Android platform in addition to
  `--define=iree_is_android=true`.

- **[Hexagon] Add build support for the Hexagon SDK**
  Prepares building the experimental Hexagon HAL driver:
  - `@hexagon_sdk` repository (Bazel), downloading the free Hexagon SDK
    release or using an existing installation via
    `--repo_env=HEXAGON_SDK_ROOT`, and `iree_hexagon_sdk.cmake` (CMake,
    `HEXAGON_SDK_ROOT`).
- `iree_hexagon_interface`: generates FastRPC stub/skel sources from IDL
    files with the SDK qaic compiler.
- `iree_hexagon_dsp_library`: builds a FastRPC skeleton shared library
for
    the DSP by invoking the SDK compiler directly.
  - `bazel_to_cmake` conversions for the above and for
    `experimental/runtime/src`, a package root mirroring `runtime/src`.
  - `experimental/runtime` is no longer ignored by Bazel.

All Hexagon targets are restricted to Android aarch64, so host builds do
not
  fetch the SDK.

- **[Hexagon] Add FastRPC interface and DSP library**
Adds the FastRPC interface between the Hexagon HAL driver on the Android
host and the DSP (interface `hexagon_dsp : remote_handle64`, without any
RPCs yet) and the DSP library `libhexagon_dsp_skel.so` for Hexagon v79,
  implementing opening and closing of the RPC session.

- **[Hexagon] Add experimental Hexagon HAL driver**
Adds the host side of the experimental Qualcomm Hexagon DSP HAL driver
for
  Android aarch64. The driver lists the DSP domains supporting unsigned
protection domains as devices. Creating a device opens a FastRPC session
  with the DSP, which loads `libhexagon_dsp_skel.so`. Allocation,
executables, command buffers, and queue operations are not implemented
yet
  and return `UNIMPLEMENTED`.
  Enable with:
  - `bazel build --config=hexagon //tools:iree-run-module`
- `cmake ... -DIREE_EXTERNAL_HAL_DRIVERS=hexagon
-DHEXAGON_SDK_ROOT=<path>`

- **[Hexagon] Add README and code owners for the Hexagon HAL driver**
  Documents building, deploying, and manually verifying the experimental
  Hexagon HAL driver.

# Local Testing

Log of local testing with a OnePlus 13 phone:
```
~/iree$ add push ../iree-build-android/tools/iree-run-module /data/local/tmp/schuermans-roofline/upstream/bin/
../iree-build-android/tools/iree-run-module: 1 file pushed, 0 skipped. 333.6 MB/s (10283608 bytes in 0.029s)
~/iree$ adb push ../iree-build-android/experimental/runtime/src/iree/hal/drivers/hexagon/dsp/libhexagon_dsp_skel.so /data/local/tmp/schuermans-roofline/upstream/lib/hexagon
../iree-build-android/experimental/runtime/src/iree/hal/drivers/hexagon/dsp/libhexagon_dsp_skel.so: 1 file pushed, 0 skipped. 127.3 MB/s (9128 bytes in 0.000s)
~/iree$ adb shell 'cd /data/local/tmp/schuermans-roofline/upstream/; bin/iree-run-module --list_drivers'
# ============================================================================
# Available HAL drivers
# ============================================================================
# Use --list_devices={driver name} to enumerate available devices.

      local-sync: Local execution using a lightweight inline synchronous queue
      local-task: Local execution using the IREE multithreading task system
          vulkan: Vulkan HAL Rewrite Scaffold
         hexagon: Qualcomm Hexagon DSP (experimental)
~/iree$ adb shell 'cd /data/local/tmp/schuermans-roofline/upstream/; bin/iree-run-module --list_devices'
local-sync://
local-task://
vulkan://GPU-435100000700000000d57000140000d5
hexagon://CDSP
~/iree$ adb shell 'cd /data/local/tmp/schuermans-roofline/upstream/; bin/iree-run-module --device=hexagon://CDSP --module=model.vmfb'
iree/experimental/runtime/src/iree/hal/drivers/hexagon/device.c:586: UNIMPLEMENTED; hexagon executables not implemented; creating VM context; creating run context
~/iree$ 
```
The last UNIMPLEMENTED error is expected for now, becuase the runtime
implementation is still very incomplete.

---------

Signed-off-by: Stefan Schuermans <schuermans@roofline.ai>
Co-authored-by: L-roro <115032777+L-roro@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
46 files changed
tree: bbeee14f83f7032fb14f5feb5603af621e382ce9
  1. .github/
  2. build_tools/
  3. compiler/
  4. core/
  5. docs/
  6. experimental/
  7. integrations/
  8. lib/
  9. llvm-external-projects/
  10. runtime/
  11. samples/
  12. tests/
  13. third_party/
  14. tools/
  15. .bazel_to_cmake.cfg.py
  16. .bazelignore
  17. .bazelrc
  18. .bazelversion
  19. .clang-format
  20. .git-blame-ignore-revs
  21. .gitattributes
  22. .gitignore
  23. .gitmodules
  24. .pre-commit-config.yaml
  25. .yamllint.yml
  26. AUTHORS
  27. BUILD.bazel
  28. CITATION.cff
  29. CMakeLists.txt
  30. configure_bazel.py
  31. CONTRIBUTING.md
  32. GOVERNANCE.md
  33. LICENSE
  34. MAINTAINERS.md
  35. MODULE.bazel
  36. README.md
  37. RELEASING.md
README.md

IREE: Intermediate Representation Execution Environment

IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.

See our website for project details, user guides, and instructions on building from source.

IREE Discord Status pre-commit OpenSSF Best Practices

Project news

Project status

Release status

Releases notes are published on GitHub releases.

PackageRelease status
GitHub release (stable)GitHub Release
GitHub release (nightly)GitHub Release
iree-base-compilerPyPI version
iree-base-runtimePyPI version

For more details on the release process, see https://iree.dev/developers/general/release-management/.

Build status

CI PkgCI

Nightly build status

Operating systemBuild status
LinuxCI - Linux arm64 clang
macOSCI - macOS arm64 clang

For the full list of workflows see https://iree.dev/developers/general/github-actions/.

Communication channels

Related project channels

  • MLIR topic within LLVM Discourse: IREE is enabled by and heavily relies on MLIR. IREE sometimes is referred to in certain MLIR discussions. Useful if you are also interested in MLIR evolution.

Architecture overview

IREE Architecture IREE Architecture

See our website for more information.

Presentations and talks

Community meeting recordings: IREE YouTube channel

DateTitleRecordingSlides
2025-06-10Data-Tiling in IREE: Achieving High Performance Through Compiler Design (AsiaLLVM)recordingslides
2025-05-17Introduction to GPU architecture and IREE's GPU CodeGen Pipelinerecordingslides
2025-02-12The Long Tail of AI: SPIR-V in IREE and MLIR (Vulkanised)recordingslides
2024-10-01Unveiling the Inner Workings of IREE: An MLIR-Based Compiler for Diverse Hardwarerecording
2021-06-09IREE Runtime Design Tech Talkrecordingslides
2020-08-20IREE CodeGen (MLIR Open Design Meeting)recordingslides
2020-03-18Interactive HAL IR Walkthroughrecording
2020-01-31End-to-end MLIR Workflow in IREE (MLIR Open Design Meeting)recordingslides

License

IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.