[mlir][linalg] Change the FillOp library call signature.
Adapt the FillOp library call signature to the updated operand order introduced in https://reviews.llvm.org/D10412. The patch reverts the special treatment of FillOp in LinalgToStandard. Differential Revision: https://reviews.llvm.org/D104360
This commit is contained in:
parent
aa58fdb396
commit
f1844f15c1
|
@ -73,18 +73,18 @@ getReassociationIndicesForReshape(ShapedType sourceType, ShapedType targetType);
|
|||
/// Examples:
|
||||
///
|
||||
/// 1. linalg.fill(%f, %A) : f32, memref<f32>
|
||||
/// name mangles into `linalg_fill_viewf32_f32_impl`
|
||||
/// name mangles into `linalg_fill_f32_viewf32`
|
||||
///
|
||||
/// 2. linalg.dot %A, %B, %C :
|
||||
/// (memref<?xf32, stride_specification>,
|
||||
/// memref<?xf32, stride_specification>, memref<f32>)
|
||||
/// name mangles into `linalg_dot_viewxf32_viewxf32_viewf32_impl`
|
||||
/// name mangles into `linalg_dot_viewxf32_viewxf32_viewf32`
|
||||
///
|
||||
/// 3. linalg.matmul(...) :
|
||||
/// memref<?x?xf32, stride_specification>,
|
||||
/// memref<?x?xf32, stride_specification>,
|
||||
/// memref<?x?xf32, stride_specification>
|
||||
/// name mangles into `linalg_matmul_viewxxf32_viewxxf32_viewxxf32_impl`
|
||||
/// name mangles into `linalg_matmul_viewxxf32_viewxxf32_viewxxf32`
|
||||
std::string generateLibraryCallName(Operation *op);
|
||||
|
||||
/// Returns `num` AffineDimExpr dimensions at positions
|
||||
|
|
|
@ -100,21 +100,9 @@ LogicalResult mlir::linalg::LinalgOpToLibraryCallRewrite::matchAndRewrite(
|
|||
if (isa<CopyOp>(op))
|
||||
return failure();
|
||||
|
||||
// Swap the operand order of the FillOp to maintain the pretty printed
|
||||
// signature that takes an output buffer followed by the fill value.
|
||||
SmallVector<Value> originalOperandOrder = op->getOperands();
|
||||
if (auto fillOp = dyn_cast<FillOp>(op.getOperation())) {
|
||||
Value value = fillOp.value();
|
||||
Value output = fillOp.output();
|
||||
op->setOperands(ValueRange{output, value});
|
||||
}
|
||||
|
||||
auto libraryCallName = getLibraryCallSymbolRef(op, rewriter);
|
||||
if (!libraryCallName) {
|
||||
// Restore the operand order in case it has been modified.
|
||||
op->setOperands(originalOperandOrder);
|
||||
if (!libraryCallName)
|
||||
return failure();
|
||||
}
|
||||
|
||||
// TODO: Add support for more complex library call signatures that include
|
||||
// indices or captured values.
|
||||
|
|
Loading…
Reference in New Issue