EN 中文
Back to Overview

LiteRtLm_GetAvailableBackends

Environment probing interface. Returns a list of supported inference backends on the current hardware platform. Recommended to call before configuring the Engine to decide the optimal execution strategy.

01. Startup Probing Flowchart

graph TD Start[App Startup] --> Probe[LiteRtLm_GetAvailableBackends] Probe --> Detect{Detect Hardware} Detect -->|Found Vulkan/Metal| GPU["Return 'gpu,cpu'"] Detect -->|Generic Only| CPU["Return 'cpu'"] GPU --> Decision[Set Config.backend based on result]

This interface is a pure static probing function that can be called without creating an engine, providing a basis for subsequent LiteRtLm_Config decisions.

02. Function Prototype & Return Value

const char* LiteRtLm_GetAvailableBackends();
Return TypeMemory Contract & Semantics
const char* Static String.
Points to constant memory within the DLL; do not call free(). Returns comma-separated identifiers (e.g., "cpu,gpu").

03. Dynamic Configuration Example

const char* Backends = LiteRtLm_GetAvailableBackends();
FString Supported(Backends);

LiteRtLm_Config config = {0};
if (Supported.Contains("gpu")) {
    config.backend = "gpu"; // Found GPU acceleration support
} else {
    config.backend = "cpu"; // Fallback to CPU
}