|
MLIR 22.0.0git
|
Transformation to drop unit-extent dimensions from linalg.generic operations. More...
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
Public Types | |
| enum class | RankReductionStrategy { ReassociativeReshape , ExtractInsertSlice } |
| using | ControlFnTy = std::function<SmallVector<unsigned>(Operation *)> |
| Instances of this type are used to control which dimensions of an operand are considered for dropping unit extent dimensions. | |
| using | CollapseFnTy |
| Instances of this type are used to control how operand values are collapsed after dropping unit extent dimensions. | |
| using | ExpandFnTy |
| Instances of this type are used to control how result values are expanded into their original shape after dropping unit extent dimensions. | |
Public Attributes | |
| RankReductionStrategy | rankReductionStrategy |
| ControlFnTy | controlFn |
| Function to control which dimensions, if any, are to be considered for dropping unit extent dimensions. | |
| CollapseFnTy | collapseFn |
| Function to control how operands are collapsed into their new target shape after dropping unit extent dimensions. | |
| ExpandFnTy | expandFn |
| Function to control how results are expanded into their original shape after dropping unit extent dimensions. | |
Transformation to drop unit-extent dimensions from linalg.generic operations.
Definition at line 521 of file Transforms.h.
Instances of this type are used to control how operand values are collapsed after dropping unit extent dimensions.
Next to the control struct, rewriter and location, the function receives the operand value to collapse, the new target shape and how old dimensions should be grouped. The function needs to insert the necessary operations to collapse the operand to the target shape and returns the new operand value. If the operand should not be collapsed, the function should return failure, leading to the transformation to be aborted.
Definition at line 559 of file Transforms.h.
| using mlir::linalg::ControlDropUnitDims::ControlFnTy = std::function<SmallVector<unsigned>(Operation *)> |
Instances of this type are used to control which dimensions of an operand are considered for dropping unit extent dimensions.
The parameter to the function is the operation itself, the expected return is a list of dimensions to consider for dropping unit extent dimensions. If the operation should not be have any dimensions dropped, implementations should return an empty list.
Definition at line 533 of file Transforms.h.
Instances of this type are used to control how result values are expanded into their original shape after dropping unit extent dimensions.
Next to the control construct, rewriter and location, the function recieves the result value, the original value to replace and and information on how the new dimensions were grouped. The function needs to insert the necessary operations to expand the result to the original shape and returns the new result value. If the result should not be expanded, the function should return failure, leading to the transformation to be aborted.
Definition at line 586 of file Transforms.h.
|
strong |
| Enumerator | |
|---|---|
| ReassociativeReshape | |
| ExtractInsertSlice | |
Definition at line 522 of file Transforms.h.
| CollapseFnTy mlir::linalg::ControlDropUnitDims::collapseFn |
Function to control how operands are collapsed into their new target shape after dropping unit extent dimensions.
For the default behavior
Definition at line 568 of file Transforms.h.
| ControlFnTy mlir::linalg::ControlDropUnitDims::controlFn |
Function to control which dimensions, if any, are to be considered for dropping unit extent dimensions.
The default behavior is to consider all dimensions of a linalg.generic or tensor.pad operation for dropping. Users of the dropUnitDims interface can override the default behavior by setting this member to their own implementation.
Definition at line 540 of file Transforms.h.
| ExpandFnTy mlir::linalg::ControlDropUnitDims::expandFn |
Function to control how results are expanded into their original shape after dropping unit extent dimensions.
The default behavior
Definition at line 595 of file Transforms.h.
| RankReductionStrategy mlir::linalg::ControlDropUnitDims::rankReductionStrategy |
Definition at line 524 of file Transforms.h.