Deeploy.Targets.Generic.TileConstraints.BOPTileConstraint.BOPTileConstraint
- class Deeploy.Targets.Generic.TileConstraints.BOPTileConstraint.BOPTileConstraint
Bases:
TileConstraintTile constraint class for binary operators, i.e. operators that have exactly 2 inputs and 1 output.
When the second input is a scalar (total size 1), it is kept full-size and only the first input and the output are tiled together. This supports ONNX broadcasting in operators that have a corresponding scalar kernel.
Warning
Broadcasting support is partial – only the case of a fully-scalar second input (np.prod(input2.shape) == 1) is handled. Other ONNX broadcasting patterns – input1 scalar, partial broadcasting such as (N, 1) + (1, M), single-dim broadcasting such as (N, M, K) + (N, 1, K), or rank-mismatched shapes such as (N, M) + (M,) – fall through to the non-scalar branch, where the dim-equality constraints will fail to satisfy. Operators that need full ONNX broadcasting must use a different tile constraint.
Methods
- __init__()
__init__()addGeometricalConstraint(tilerModel, ...)Override this function to add your geometric constraints.
addPolicyConstraint(tilerModel, parseDict, ctxt)Override this function to add your custom constraints to your node.
constructSymbolicNodeRep(tilerModel, ...)extractBaseAddr(tilingSolution, ...)getBaseAddr(tilingSolution, targetMemLevel, name)sanitizeTilingSchedule(tilingSchedule)serializeTilingSolution(tilingSolution, ...)Compute the required input tiles as a sequence of HyperRectangles
wrapTilingSolution(tilingSolution, ...)Attributes
Name of the first input tensor as defined by the operator's parser
Name of the second input tensor as defined by the operator's parser
Name of the output tensor as defined by the operator's parser
- dataIn1Name = 'data_in_1'
Name of the first input tensor as defined by the operator’s parser
- Type:
str
- dataIn2Name = 'data_in_2'
Name of the second input tensor as defined by the operator’s parser
- Type:
str
- dataOutName = 'data_out'
Name of the output tensor as defined by the operator’s parser
- Type:
str
- classmethod addGeometricalConstraint(tilerModel: TilerModel, parseDict: Dict, ctxt: NetworkContext) TilerModel
Override this function to add your geometric constraints. Each dimension of the output tensors should be determinable through a linear equation that utilizes the dimensions of the input tensors and the attributes of the nodes.
- classmethod serializeTilingSolution(tilingSolution: NodeMemoryConstraint, absoluteOutputCubes: List[AbsoluteHyperRectangle], targetMemLevel: str, ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[VariableReplacementScheme, TilingSchedule]
Compute the required input tiles as a sequence of HyperRectangles
- Parameters:
tilingSolution (NodeMemoryConstraint) – The final tiling solution computed in the midend
absoluteOutputCubes (List[AbsoluteHyperRectangle]) – A list of HyperRectangles that represent tiles of the operator’s outputs with absolute offsets
targetMemLevel (str) – The name of the MemoryLevel registered within the Platform’s MemoryHierarchy where tiles should be transferred into (e.g.: L2, L1,… )
ctxt (NetworkContext) – The current NetworkContext
operatorRepresentation (Dict) – The operator’s node representation dictionary
- Returns:
Return a VariableReplacementScheme to express which expressions within the target template might have to be replaced due to tiling. Also return a TilingSchedule to define one input HyperRectangle tuple for each output tile
- Return type:
- Raises:
Exception – Raises an exception unless overridden in the calling class
- static addPolicyConstraint(tilerModel: TilerModel, parseDict: Dict, ctxt: NetworkContext) TilerModel
Override this function to add your custom constraints to your node.