Deeploy.TilingExtension.TilingCodegen.minimizeVariableReplacement
- Deeploy.TilingExtension.TilingCodegen.minimizeVariableReplacement(scheme: VariableReplacementScheme, operatorRepresentation: Dict[str, str | Any]) Tuple[VariableReplacementScheme, Dict]
Optimize a variable replacement scheme by eliminating constant replacements.
Analyzes the replacement scheme and removes variables that have the same value across all tiles, directly setting them in the operator representation instead. This optimization reduces memory usage and improves performance.
- Parameters:
scheme (VariableReplacementScheme) – The original variable replacement scheme to optimize.
operatorRepresentation (OperatorRepresentation) – The operator representation that will be updated with constant values.
- Returns:
A tuple containing: - The minimized VariableReplacementScheme with only non-constant variables - A dictionary of updates to apply to the operator representation
- Return type:
Tuple[VariableReplacementScheme, Dict]
Notes
Variables with identical values across all tiles are considered constants and are removed from the replacement scheme. Their single value is set directly in the operator representation.