CixP1 (CixP1 v0.1.1)

Copy Markdown View Source

Elixir bindings for the CIX P1 (Arm-China "Zhouyi") NPU on the Orange Pi 6 / 6 Plus, via the CIX NOE runtime (libnoe).

This is a thin, low-level wrapper over the NOE inference API. It loads a pre-compiled graph binary and runs inference on raw tensor binaries; model pre/post-processing (image resize, detection decoding, …) is left to the caller. An optional CixP1.Nx layer converts tensor binaries to/from Nx.Tensor when :nx is available.

Requirements

Runs only on a Nerves image built from nerves_system_orangepi6 (v0.2.0+), which provides the aipu kernel driver, libnoe/libaipudrv, and the LD_LIBRARY_PATH needed to resolve them. Models must be compiled to the NOE .cix format (NOE Compiler / CIX AI Model Hub).

One-shot inference

{:ok, ctx}  = CixP1.Context.new()
{:ok, graph} = CixP1.Graph.load(ctx, "/data/models/mobilenet.cix")
{:ok, [logits]} = CixP1.run(graph, [image_binary])

See CixP1.Context, CixP1.Graph, and CixP1.Job for the step-by-step API.

Summary

Functions

Runs one inference: creates a job on graph, loads inputs (a list of raw binaries, one per input tensor in order), runs the NPU, and collects every output tensor as a raw binary.

Functions

run(graph, inputs, opts \\ [])

@spec run(CixP1.Graph.t(), [binary()], keyword()) ::
  {:ok, [binary()]} | {:error, String.t()}

Runs one inference: creates a job on graph, loads inputs (a list of raw binaries, one per input tensor in order), runs the NPU, and collects every output tensor as a raw binary.

opts:

  • :timeout_ms — inference timeout (default 5000; <= 0 waits forever)

Returns {:ok, [binary]} (outputs in tensor order) or {:error, reason}.