CixP1.Job (CixP1 v0.1.1)

Copy Markdown View Source

A single inference invocation on a CixP1.Graph.

Lifecycle: create/1load_input/3 (once per input) → infer/2get_output/2 (once per output). A job holds its graph's IO buffers; create a fresh job per concurrent inference, or reuse one job for repeated sequential inferences on the same graph.

For one-shot inference prefer CixP1.run/2, which wires these steps together.

Summary

Functions

Creates a job bound to graph.

Reads output tensor index as a raw binary (sized per its descriptor).

Runs the job on the NPU and blocks until it finishes or timeout_ms elapses (a value <= 0 means wait indefinitely). Runs on a dirty scheduler.

Loads data (a raw binary matching the input descriptor's :size) into input tensor index.

Types

t()

@type t() :: %CixP1.Job{graph: CixP1.Graph.t(), resource: reference()}

Functions

create(graph)

@spec create(CixP1.Graph.t()) :: {:ok, t()} | {:error, String.t()}

Creates a job bound to graph.

get_output(job, index)

@spec get_output(t(), non_neg_integer()) :: {:ok, binary()} | {:error, String.t()}

Reads output tensor index as a raw binary (sized per its descriptor).

infer(job, timeout_ms \\ 5000)

@spec infer(t(), integer()) :: :ok | {:error, String.t()}

Runs the job on the NPU and blocks until it finishes or timeout_ms elapses (a value <= 0 means wait indefinitely). Runs on a dirty scheduler.

load_input(job, index, data)

@spec load_input(t(), non_neg_integer(), binary()) :: :ok | {:error, String.t()}

Loads data (a raw binary matching the input descriptor's :size) into input tensor index.