CompiledModelPolicy enum
Ordered accelerator policy for building a CompiledModel.
This is deliberately separate from Accelerator. An accelerator is a
hardware target, while a policy describes preference and fallback order;
an unordered Set<Accelerator> cannot distinguish an automatic choice
from an exact request.
Values
- auto → const CompiledModelPolicy
-
Package-recommended selection.
In flutter_litert 3.9 this means a strict GPU request at Precision.fp32, with a complete CPU-only retry when GPU construction fails. It does not first request a mixed
{gpu, cpu}graph. NPU is intentionally excluded because availability and correctness remain device- and model-specific.Auto is a construction policy, not a correctness test or benchmark. A model that compiles can still be numerically unsuitable for a backend; validate production models separately with
verifyCompiledModel. - cpu → const CompiledModelPolicy
-
CPU only.
- gpu → const CompiledModelPolicy
-
GPU compilation with no complete CPU retry.
"Strict" here describes the requested accelerator set and fallback policy. Use
CompiledModel.isFullyAcceleratedto inspect whether the runtime placed the whole graph on an accelerator. - gpuWithCpuFallback → const CompiledModelPolicy
-
Request a mixed
{gpu, cpu}graph, then retry the whole model CPU-only if construction fails. - npu → const CompiledModelPolicy
-
NPU compilation with no complete CPU retry.
- npuWithCpuFallback → const CompiledModelPolicy
-
Request a mixed
{npu, cpu}graph, then retry the whole model CPU-only if construction fails.NPU is experimental and must be validated per model and target device.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
CompiledModelPolicy> - A constant List of the values in this enum, in order of their declaration.