resolved_optimizations
Classes
ConstantInterningStats
dataclass
ResolvedOptimizationStats
dataclass
Summary of resolved-model optimization passes.
Attributes:
-
constant_interning(ConstantInterningStats) –Stats for exact duplicate constant interning.
Functions
intern_duplicate_constants
intern_duplicate_constants(model: AirModel, *, tensor_rules: list[AttributeRuleset] | None = None) -> ConstantInterningStats
Alias exact duplicate constant payloads to a shared storage root.
This pass is intended to run after operator resolve() hooks have created
backend-only constants such as weight_sum tensors and LUT payloads, and
before memory planning assigns offsets. The tensor IDs stay distinct for
debuggability; only the underlying storage is shared via alias_of.
Parameters:
-
(modelAirModel) –AIR model to optimize in place.
-
(tensor_ruleslist[AttributeRuleset] | None, default:None) –Optional per-tensor placement rules. Duplicate constants are interned only when these rules resolve to the same source and destination memory intent.
Returns:
-
ConstantInterningStats–Summary stats for the pass.
optimize_resolved_model
optimize_resolved_model(model: AirModel, *, tensor_rules: list[AttributeRuleset] | None = None) -> ResolvedOptimizationStats
Run resolved-model optimization passes.
This phase sits between operator resolution and memory planning so future redundancy-reduction passes can operate on the fully materialized AIR graph without interfering with graph-level transforms or emit-time layout.