[Mlir-commits] [mlir] [mlir][linalg] Cleanup `MatmulOp` TableGen formatting, NFC (PR #117435)
Felix Schneider
llvmlistbot at llvm.org
Sat Nov 23 06:36:13 PST 2024
https://github.com/ubfx created https://github.com/llvm/llvm-project/pull/117435
This just matches the indentation to the other ops.
>From 49ddbb29ad0946f49ba46bc5caf6b234f79bee0d Mon Sep 17 00:00:00 2001
From: Felix Schneider <fx.schn at gmail.com>
Date: Sat, 23 Nov 2024 15:31:47 +0100
Subject: [PATCH] [mlir][linalg] Cleanup `MatmulOp` TableGen formatting, NFC
---
.../Dialect/Linalg/IR/LinalgStructuredOps.td | 152 +++++++++---------
1 file changed, 76 insertions(+), 76 deletions(-)
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 37eec6e07963b1..a1b5e7f8197f75 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -564,7 +564,7 @@ def MatmulOp : LinalgStructuredBase_Op<"matmul", [
let summary = [{
Performs a matrix multiplication of two 2D inputs without broadcast or transpose.
- }];
+ }];
let description = [{
Numeric casting is performed on the operands to the inner multiply,
promoting them to the same data type as the accumulator/output.
@@ -604,83 +604,83 @@ def MatmulOp : LinalgStructuredBase_Op<"matmul", [
]
ins(%arg0, %arg1 : memref<5x3xf32>, memref<7xf32>) outs(%arg2: memref<3x7xf32>)
```
- }];
-
- let arguments = (ins
- Variadic<AnyType>:$inputs,
- Variadic<AnyShaped>:$outputs,
- DefaultValuedOptionalAttr<AffineMapArrayAttr, "{}">:$indexing_maps,
- DefaultValuedOptionalAttr<TypeFnAttr, "TypeFn::cast_signed">:$cast
- );
- let results = (outs Variadic<AnyRankedTensor>:$result_tensors);
- let regions = (region AnyRegion:$region);
-
- let skipDefaultBuilders = 1;
- let builders = [
- OpBuilder<
- (ins "ValueRange":$inputs, "ValueRange":$outputs,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
- [{
- buildMatmulOp($_builder, $_state, std::nullopt, inputs, outputs,
- attributes, MatmulOp::getRegionBuilder(),
- MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
- }]>,
- OpBuilder<
- (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
- "ValueRange":$outputs,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
- [{
- buildMatmulOp($_builder, $_state, resultTensorTypes,
- inputs, outputs, attributes, MatmulOp::getRegionBuilder(),
- MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
- }]>,
- OpBuilder<
- (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
- "ValueRange":$outputs,
- "Attribute":$cast, CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
- [{
- $_state.addAttribute("cast", cast);
- buildMatmulOp($_builder, $_state, resultTensorTypes, inputs, outputs,
- attributes, MatmulOp::getRegionBuilder(),
- MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
- }]>
-
- ];
- let hasCustomAssemblyFormat = 1;
- let hasFolder = 1;
- let hasVerifier = 1;
-
- let extraClassDeclaration = structuredOpsBaseDecls # [{
- SmallVector<utils::IteratorType> getIteratorTypesArray();
-
- /// Implements the block region builder.
- static void regionBuilder(ImplicitLocOpBuilder &b,
- Block &block, ArrayRef<NamedAttribute> attrs);
-
- /// Returns a list of AffineMap with the typical matmul indexing charactristic.
- static SmallVector<AffineMap> getDefaultIndexingMaps(MLIRContext *context);
-
- /// Returns true if the given broadcast map \p bcastMap is valid for this op.
- bool isValidLhsRhsBroadcastMap(AffineMap bcastMap);
-
- static std::function<void(ImplicitLocOpBuilder &,
- Block &, ArrayRef<NamedAttribute>)>
- getRegionBuilder() {
- return regionBuilder;
- }
+ }];
- ::mlir::MutableOperandRange getDpsInitsMutable() {
- return getOutputsMutable();
- }
+ let arguments = (ins
+ Variadic<AnyType>:$inputs,
+ Variadic<AnyShaped>:$outputs,
+ DefaultValuedOptionalAttr<AffineMapArrayAttr, "{}">:$indexing_maps,
+ DefaultValuedOptionalAttr<TypeFnAttr, "TypeFn::cast_signed">:$cast
+ );
+ let results = (outs Variadic<AnyRankedTensor>:$result_tensors);
+ let regions = (region AnyRegion:$region);
+
+ let skipDefaultBuilders = 1;
+ let builders = [
+ OpBuilder<
+ (ins "ValueRange":$inputs, "ValueRange":$outputs,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
+ [{
+ buildMatmulOp($_builder, $_state, std::nullopt, inputs, outputs,
+ attributes, MatmulOp::getRegionBuilder(),
+ MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
+ }]>,
+ OpBuilder<
+ (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputs,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
+ [{
+ buildMatmulOp($_builder, $_state, resultTensorTypes,
+ inputs, outputs, attributes, MatmulOp::getRegionBuilder(),
+ MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
+ }]>,
+ OpBuilder<
+ (ins "TypeRange":$resultTensorTypes, "ValueRange":$inputs,
+ "ValueRange":$outputs,
+ "Attribute":$cast, CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes),
+ [{
+ $_state.addAttribute("cast", cast);
+ buildMatmulOp($_builder, $_state, resultTensorTypes, inputs, outputs,
+ attributes, MatmulOp::getRegionBuilder(),
+ MatmulOp::getDefaultIndexingMaps($_builder.getContext()));
+ }]>
+
+ ];
+ let hasCustomAssemblyFormat = 1;
+ let hasFolder = 1;
+ let hasVerifier = 1;
+
+ let extraClassDeclaration = structuredOpsBaseDecls # [{
+ SmallVector<utils::IteratorType> getIteratorTypesArray();
+
+ /// Implements the block region builder.
+ static void regionBuilder(ImplicitLocOpBuilder &b,
+ Block &block, ArrayRef<NamedAttribute> attrs);
+
+ /// Returns a list of AffineMap with the typical matmul indexing characteristic.
+ static SmallVector<AffineMap> getDefaultIndexingMaps(MLIRContext *context);
+
+ /// Returns true if the given broadcast map \p bcastMap is valid for this op.
+ bool isValidLhsRhsBroadcastMap(AffineMap bcastMap);
+
+ static std::function<void(ImplicitLocOpBuilder &,
+ Block &, ArrayRef<NamedAttribute>)>
+ getRegionBuilder() {
+ return regionBuilder;
+ }
+
+ ::mlir::MutableOperandRange getDpsInitsMutable() {
+ return getOutputsMutable();
+ }
- // Generic methods.
- static unsigned getNumRegionArgs();
- std::string getLibraryCallName();
- bool hasDynamicIndexingMaps();
- /// Check if the op has broadcast and/or transpose semantic. Returns true if the
- /// user defined indexing maps are not equal to default map.
- bool hasUserDefinedMaps();
- }];
+ // Generic methods.
+ static unsigned getNumRegionArgs();
+ std::string getLibraryCallName();
+ bool hasDynamicIndexingMaps();
+ /// Check if the op has broadcast and/or transpose semantic. Returns true if the
+ /// user defined indexing maps are not equal to default map.
+ bool hasUserDefinedMaps();
+ }];
}
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list