Companion

Constants and factory functions of BackendConfig.

Properties

Link copied to clipboard
const val ALL_GPU_LAYERS: Int

Sentinel for gpuLayers: offload all layers.

Link copied to clipboard
const val AUTO_THREADS: Int

Sentinel for cpuThreads: choose automatically. The engines then use the runtime's performance core count (KggmlRuntime.recommendedThreadCount()): on Android and Linux with differing per-core cpu_capacity (phones), the cores with at least 75% of the fastest core's capacity, at most 4 of them, so a slower tier is never mixed in (all 7 cores of a Tensor G6 made inference several times slower); otherwise the cores at the highest clock (SMT siblings counted once). Apple: the performance cores; Windows: the cores of the highest efficiency class. resolveCpuThreads is the platform-neutral fallback.

Link copied to clipboard

CPU-only configuration (no GPU offload). Safe for iOS background execution.

Link copied to clipboard

Default configuration: automatic backend, all layers offloaded, automatic thread count, each engine's default flash attention.

Link copied to clipboard
const val MAX_AUTO_THREADS: Int = 8

Upper bound used when AUTO_THREADS is resolved (more threads rarely help memory-bound inference).

Link copied to clipboard
const val MAX_CPU_THREADS: Int = 512

Upper bound accepted for an explicit cpuThreads value.