BackendConfig
Runtime compute configuration passed to every engine at construction time.
Instances are validated on construction (including via copy); invalid combinations throw IllegalArgumentException.
Constructors
Types
Constants and factory functions of BackendConfig.
Properties
requested compute backend; resolved by the engine with ComputeBackend.resolve.
number of CPU worker threads. AUTO_THREADS (-1) lets the SDK choose (see resolveCpuThreads); otherwise must be in 1..MAX_CPU_THREADS.
number of model layers to offload to the GPU. ALL_GPU_LAYERS (-1) offloads every layer, 0 keeps everything on the CPU. Must be >= -1, and must be 0 or -1 when backend is ComputeBackend.CPU_ONLY.
flash attention kernels where the engine and backend support them: true turns them on, false off, and null (the default) uses each engine's own default (Whisper: on; llama.cpp: its automatic choice per device; stable-diffusion.cpp: off).
Functions
The number of GPU layers to request from native code once backend has been resolved to resolvedBackend: always 0 for ComputeBackend.CPU_ONLY, otherwise gpuLayers.
The concrete thread count to pass to native code. Explicit values are returned unchanged; AUTO_THREADS resolves to availableProcessors clamped to 1..MAX_AUTO_THREADS.
Whether to use flash attention: useFlashAttention when it is set, otherwise engineDefault (the calling engine's own default).