HexagonTpu.Runtime (hexagon_tpu v0.1.0)

Copy Markdown

A QNN backend runtime: the dlopen'd backend library plus its backend and device handles.

The HTP (NPU) is a shared SoC resource — use htp/0 to get a process-wide memoized runtime instead of creating one per caller. Explicit create/1 remains useful for the CPU backend or custom library paths (e.g. host-side testing).

Closing a runtime while contexts created from it are still alive is not supported; close contexts first (or just let the GC destructors handle teardown in dependency order).

Summary

Functions

Frees the QNN backend/device handles. Idempotent. Do not close a runtime that still has live contexts.

Creates a QNN runtime.

Returns the shared HTP runtime, creating it on first use.

Backend library name, build id and device availability.

Types

t()

@type t() :: %HexagonTpu.Runtime{resource: reference()}

Functions

close(runtime)

Frees the QNN backend/device handles. Idempotent. Do not close a runtime that still has live contexts.

create(opts \\ [])

Creates a QNN runtime.

Options:

  • :backend - :htp (default) or :cpu
  • :lib_path - override the backend library name/path
  • :system_lib_path - override the QnnSystem library (default "libQnnSystem.so")
  • :log_level - :none | :error | :warn | :info | :verbose | :debug (default :warn)

htp(opts \\ [])

Returns the shared HTP runtime, creating it on first use.

info(runtime)

Backend library name, build id and device availability.