Table of Contents

Namespace InferenceEngine.Core.Worker

Classes

InferenceWorkerHost

The child-process message loop. The consumer's worker executable calls RunAsync<TInput, TOutput>(Func<InferenceEngineOptions, BaseInferenceEngine<TInput, TOutput>>, IWorkerSerializer<TInput, TOutput>?, Stream?, Stream?, CancellationToken, ILogger?) with a factory that builds ITS engine (a normal BaseInferenceEngine<TInput, TOutput> — exactly like the headless --diag inference path). The loop reads length-prefixed JSON requests on stdin and writes responses on stdout; logging passes through on stderr. Because this process loads no Avalonia/GL, comgr's LLVM is the only LLVM in it → no Mesa/comgr collision.

SystemTextJsonWorkerSerializer<TInput, TOutput>

Default IWorkerSerializer<TInput, TOutput> using JsonSerializer. byte[] is serialized as a base64 string (System.Text.Json's built-in behavior), so byte[]→List<T> engines (e.g. ONNX detection) work out of the box.

WorkerEngineOptions

Serializable subset of InferenceEngineOptions sent over IPC. Delegates (OnSessionInitialized) cannot cross the boundary and are intentionally omitted.

WorkerEnvelope

Single envelope for all worker messages. The Kind discriminator selects the role of the other fields. Framed on the wire as <4-byte little-endian length><UTF-8 JSON>.

Interfaces

IWorkerSerializer<TInput, TOutput>

Serializes TInput/TOutput across the out-of-process IPC boundary. The default SystemTextJsonWorkerSerializer<TInput, TOutput> handles byte[] as base64 (System.Text.Json's built-in) and POCOs as JSON.