[Mlir-commits] [mlir] [MLIR][Linalg] Change the syntax of elementwise kind attribute (PR #222569)
Renato Golin
llvmlistbot at llvm.org
Thu Sep 10 04:46:21 PDT 2026
https://github.com/rengolin updated https://github.com/llvm/llvm-project/pull/222569
>From 1ffbc8ed299c9d3bb62f4a0bbd11f302107b9a9c Mon Sep 17 00:00:00 2001
From: rengolin <rengolin at systemcall.eu>
Date: Thu, 10 Sep 2026 02:47:03 -0700
Subject: [PATCH 1/3] [MLIR][Linalg] Change the syntax of elementwise kind
attribute
Remove the need to add a "kind=" lead for the elementwise operation name, as well as the fully specified namespace for the attribute, shortening the syntax from:
```
linalg.elementwise kind=#linalg.elementwise_kind<add>
```
to
```
linalg.elementwise <add>
```
Closes #221194
---
mlir/docs/Tutorials/transform/Ch1.md | 18 +-
mlir/docs/Tutorials/transform/Ch4.md | 4 +-
mlir/docs/Tutorials/transform/ChH.md | 2 +-
.../mlir/Dialect/Linalg/IR/LinalgInterfaces.h | 2 +-
.../Dialect/Linalg/IR/LinalgStructuredOps.td | 6 +-
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp | 27 +--
.../Dialect/Linalg/Transforms/Specialize.cpp | 4 +-
.../Dialect/Arith/sharding-propagation.mlir | 8 +-
.../Dialect/Bufferization/canonicalize.mlir | 4 +-
.../Dialect/Linalg/block-pack-matmul.mlir | 4 +-
...ic-by-unfolding-projected-permutation.mlir | 6 +-
.../test/Dialect/Linalg/elementwise/fold.mlir | 40 ++--
.../elementwise/generalize-named-ops.mlir | 14 +-
.../Dialect/Linalg/elementwise/invalid.mlir | 17 +-
.../Dialect/Linalg/elementwise/roundtrip.mlir | 18 +-
.../Dialect/Linalg/fold-add-into-dest.mlir | 32 +--
.../linalg-morph-elementwise-to-named.mlir | 64 +++---
.../Dialect/Linalg/match-ops-interpreter.mlir | 6 +-
mlir/test/Dialect/Linalg/reshape_fusion.mlir | 4 +-
...oundtrip-morphism-linalg-category-ops.mlir | 196 +++++++++---------
.../scalable-unpack-producer-fusion.mlir | 24 +--
.../Linalg/specialize-generic-ops.mlir | 86 ++++----
.../transform-op-fuse-into-containing.mlir | 40 ++--
.../Dialect/Linalg/transform-op-fuse.mlir | 146 ++++++-------
.../Linalg/transform-op-generalize.mlir | 4 +-
...-rewrite-in-destination-passing-style.mlir | 4 +-
...ansform-op-specialize-elemwise-binary.mlir | 34 +--
mlir/test/Dialect/SCF/canonicalize.mlir | 8 +-
.../Dialect/SCF/parallel-loop-unroll.mlir | 12 +-
.../SparseTensor/encoding_with_symbols.mlir | 4 +-
.../SparseTensor/external_after_codegen.mlir | 2 +-
.../Transform/test-promote-tensors.mlir | 6 +-
.../transform/Ch1/invalidation-1.mlir | 8 +-
.../transform/Ch1/invalidation-2.mlir | 4 +-
.../test/Examples/transform/Ch1/sequence.mlir | 8 +-
.../test/Examples/transform/Ch2/sequence.mlir | 6 +-
.../test/Examples/transform/Ch3/sequence.mlir | 6 +-
.../test/Examples/transform/Ch4/multiple.mlir | 8 +-
.../test/Examples/transform/Ch4/sequence.mlir | 4 +-
.../TilingInterface/query-fusability.mlir | 6 +-
.../tile-and-fuse-consumer-using-slices.mlir | 36 ++--
.../tile-and-fuse-consumer.mlir | 34 +--
.../TilingInterface/tile-elementwise.mlir | 28 +--
.../tile-fuse-and-yield-using-interface.mlir | 2 +-
mlir/test/python/dialects/linalg/ops.py | 22 +-
45 files changed, 504 insertions(+), 514 deletions(-)
diff --git a/mlir/docs/Tutorials/transform/Ch1.md b/mlir/docs/Tutorials/transform/Ch1.md
index c9cb7d330c1e6..14bccfbdb0c2b 100644
--- a/mlir/docs/Tutorials/transform/Ch1.md
+++ b/mlir/docs/Tutorials/transform/Ch1.md
@@ -19,13 +19,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant 0.0 : f32
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>]
ins(%biased, %c0f : tensor<512x512xf32>, f32)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
@@ -101,13 +101,13 @@ sequence.mlir:5:13: remark: matmul
^
sequence.mlir:5:13: note: see current operation: %0 = linalg.matmul ins(%arg0, %arg1 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
sequence.mlir:9:13: remark: elemwise_binaries
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
^
-sequence.mlir:9:13: note: see current operation: %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
+sequence.mlir:9:13: note: see current operation: %1 = linalg.elementwise <add> ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
sequence.mlir:15:13: remark: elemwise_binaries
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
^
-sequence.mlir:15:13: note: see current operation: %2 = linalg.elementwise kind=#linalg.elementwise_kind<max_signed> indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>] ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
+sequence.mlir:15:13: note: see current operation: %2 = linalg.elementwise <max_signed> indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>] ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
```
Note that `%arg2` is associated with both elementwise payload operations. Any handle is associated with a list of entities. Individual transformations may or may not care about the order of elements in that list.
@@ -168,11 +168,11 @@ func.func @fc_relu(%arg0: tensor<512x512xf32>,
: tensor<4x32xf32> into tensor<512x512xf32>
}
}
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %1 = linalg.elementwise <add>
ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
%cst = arith.constant 0.000000e+00 : f32
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %2 = linalg.elementwise <max_signed>
indexing_maps = [#map2, #map3, #map2]
ins(%1, %cst : tensor<512x512xf32>, f32)
outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
@@ -391,7 +391,7 @@ test/Examples/transform/Ch1/invalidation-2.mlir:106:18: note: invalidated by thi
%func, %call = transform.loop.outline %outline_target {func_name = "outlined"}
^
test/Examples/transform/Ch1/invalidation-2.mlir:24:13: note: ancestor payload op
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
^
test/Examples/transform/Ch1/invalidation-2.mlir:24:13: note: nested payload op
%matmul = linalg.matmul ins(%lhs, %rhs: tensor<512x512xf32>, tensor<512x512xf32>)
diff --git a/mlir/docs/Tutorials/transform/Ch4.md b/mlir/docs/Tutorials/transform/Ch4.md
index f9a0dff5c90e3..438493e25123f 100644
--- a/mlir/docs/Tutorials/transform/Ch4.md
+++ b/mlir/docs/Tutorials/transform/Ch4.md
@@ -42,13 +42,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant 0.0 : f32
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, f32)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
diff --git a/mlir/docs/Tutorials/transform/ChH.md b/mlir/docs/Tutorials/transform/ChH.md
index ce24c5add631c..d2036dc8e97d6 100644
--- a/mlir/docs/Tutorials/transform/ChH.md
+++ b/mlir/docs/Tutorials/transform/ChH.md
@@ -290,7 +290,7 @@ scf.forall (%co) in (2) {
scf.forall (%n, %y, %xo) in (5, 80, 20) {
tensor.extract_slice
// Implicit dimensions [ni=0:1, y=0:1, xi=0:5, ci=0:64]
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed> // ...
+ %relued = linalg.elementwise <max_signed> // ...
scf.forall.in_parallel {
tensor.parallel_insert_slice // ...
}
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h
index 682d016849e88..28039eb8230fb 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h
@@ -148,7 +148,7 @@ isaTransposeOpInterface(GenericOp genericOp);
/// Checks whether a given `genericOp` is semantically equivalent to a single
/// linalg elementwise unary op, e.g.
-/// `linalg.elementwise kind=#linalg.elementwise_kind<exp>`.
+/// `linalg.elementwise <exp>`.
/// If `allowNonIdentityMaps` is true, operations with custom indexing maps are
/// included in the check. Note that these operations can only be represented by
/// the category op.
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index d5100483f3a00..2b6fc04ac0991 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -573,16 +573,14 @@ def ElementwiseOp : LinalgStructuredBase_Op<"elementwise", [
Defining a unary linalg.elementwise with default indexing-map:
```mlir
- %exp = linalg.elementwise
- kind=#linalg.elementwise_kind<exp>
+ %exp = linalg.elementwise <exp>
ins(%x : tensor<4x16x8xf32>)
outs(%y: tensor<4x16x8xf32>) -> tensor<4x16x8xf32>
```
Defining a binary linalg.elementwise with user-defined indexing-map:
```mlir
- %add = linalg.elementwise
- kind=#linalg.elementwise_kind<add>
+ %add = linalg.elementwise <add>
indexing_maps = [#transpose, #broadcast, #identity]
ins(%exp, %arg1 : tensor<4x16x8xf32>, tensor<4x16xf32>)
outs(%arg2: tensor<4x8x16xf32>) -> tensor<4x8x16xf32>
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 09d0ba4d2a31c..657e183513e30 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -5139,24 +5139,13 @@ ElementwiseOp::getDefaultIndexingMaps(unsigned numMaps, unsigned numDims,
}
ParseResult ElementwiseOp::parse(OpAsmParser &parser, OperationState &result) {
- // Expect e.g. `kind = #linalg.elemwise_kind<add>`
- Attribute attr;
+ // Expect e.g. `<add>` (also accepts the full `#linalg.elementwise_kind<add>`).
+ ElementwiseKindAttr kindAttr;
mlir::linalg::ElementwiseKind elemwiseKindVal;
- if (parser.parseKeyword("kind") || parser.parseEqual())
+ if (parser.parseCustomAttributeWithFallback(kindAttr))
return failure();
-
- if (succeeded(parser.parseAttribute(attr))) {
- auto elemwiseKindAttr = dyn_cast<ElementwiseKindAttr>(attr);
- if (!elemwiseKindAttr)
- return parser.emitError(parser.getCurrentLocation(),
- "expected ElementwiseKind attribute");
- elemwiseKindVal = elemwiseKindAttr.getValue();
- } else {
- return parser.emitError(parser.getCurrentLocation(),
- "expected operation 'kind' attribute");
- }
- result.addAttribute(
- "kind", ElementwiseKindAttr::get(parser.getContext(), elemwiseKindVal));
+ elemwiseKindVal = kindAttr.getValue();
+ result.addAttribute("kind", kindAttr);
// Parse optional `indexing_maps`
SmallVector<Attribute, 3> indexingMapsAttr;
@@ -5212,8 +5201,8 @@ ParseResult ElementwiseOp::parse(OpAsmParser &parser, OperationState &result) {
}
void ElementwiseOp::print(OpAsmPrinter &p) {
- p << " kind=";
- p.printAttribute(getKindAttr());
+ p << " ";
+ p.printStrippedAttrOrType(getKindAttr());
SmallVector<StringRef, 3> elidedAttrs = {"operandSegmentSizes", "kind",
"indexing_maps"};
unsigned arity =
@@ -5239,7 +5228,7 @@ void ElementwiseOp::regionBuilder(
function_ref<InFlightDiagnostic()> emitError) {
std::optional<ElementwiseKind> elemwiseKind;
for (auto attr : attrs) {
- if (attr.getName() == b.getStringAttr("kind")) {
+ if (attr.getName() == "kind") {
auto kindAttr = dyn_cast<ElementwiseKindAttr>(attr.getValue());
if (!kindAttr) {
if (emitError)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
index 587aecc7adaf1..a73c466484c0d 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
@@ -74,7 +74,7 @@ static bool areBinOpsSwapped(GenericOp genericOp) {
// linalg.yield %0: f32
// } -> tensor<?xf32>
// Here, the returned index is 1, and the generic op can be represented as
-// %0 = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// %0 = linalg.elementwise <mul>
// indexing_maps = [#mapA, affine_map<(d0) -> ()>, #mapRes]
// ins(%A, %cst : tensor<?xf32>, f32) outs(...) -> tensor<?xf32>
static bool findIndexOfScalarOperand(GenericOp genericOp, int &index) {
@@ -105,7 +105,7 @@ static bool findIndexOfScalarOperand(GenericOp genericOp, int &index) {
// } -> tensor<?x?xf32>
//
// is specialized to
-// linalg.elementwise kind=#linalg.elementwise_kind<exp> ...
+// linalg.elementwise <exp> ...
//
// A named op is emitted instead for binary/ternary ops that still have a
// linalg.* named equivalent (e.g. linalg.add).
diff --git a/mlir/test/Dialect/Arith/sharding-propagation.mlir b/mlir/test/Dialect/Arith/sharding-propagation.mlir
index 509c443ff9732..dab7a86b84827 100644
--- a/mlir/test/Dialect/Arith/sharding-propagation.mlir
+++ b/mlir/test/Dialect/Arith/sharding-propagation.mlir
@@ -17,7 +17,7 @@ shard.grid @grid4x4(shape = 4x4)
// CHECK-NEXT: [[vsharded_4:%.*]] = shard.shard [[vsharded]] to [[vsharding_3]] annotate_for_users : tensor<1024x1024xf32>
// CHECK-NEXT: [[vsharding_5:%.*]] = shard.sharding @grid4x4 split_axes = {{\[\[}}0]] : !shard.sharding
// CHECK-NEXT: [[vsharded_6:%.*]] = shard.shard [[vsharded_2]] to [[vsharding_5]] annotate_for_users : tensor<1024x1024xf32>
-// CHECK-NEXT: [[v1:%.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> indexing_maps = {{.*}} ins([[vsharded_4]], [[vcst_0]] : tensor<1024x1024xf32>, f32) outs([[vsharded_6]] : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
+// CHECK-NEXT: [[v1:%.*]] = linalg.elementwise <add> indexing_maps = {{.*}} ins([[vsharded_4]], [[vcst_0]] : tensor<1024x1024xf32>, f32) outs([[vsharded_6]] : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
// CHECK-NEXT: [[vsharding_7:%.*]] = shard.sharding @grid4x4 split_axes = {{\[\[}}0]] : !shard.sharding
// CHECK-NEXT: [[vsharded_8:%.*]] = shard.shard [[v1]] to [[vsharding_7]] : tensor<1024x1024xf32>
// CHECK-NEXT: return [[vsharded_8]] : tensor<1024x1024xf32>
@@ -27,7 +27,7 @@ func.func @test_shard_constant() -> (tensor<1024x1024xf32>) attributes {llvm.emi
%sharded_1 = shard.shard %cst_1 to %sharding_1 : tensor<1024x1024xf32>
%ci = arith.constant 43.4e+00 : f32
%o1 = tensor.empty() : tensor<1024x1024xf32>
- %res = linalg.elementwise kind=#linalg.elementwise_kind<add> indexing_maps = [#id, #sc, #id] ins(%sharded_1, %ci : tensor<1024x1024xf32>, f32) outs(%o1 : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
+ %res = linalg.elementwise <add> indexing_maps = [#id, #sc, #id] ins(%sharded_1, %ci : tensor<1024x1024xf32>, f32) outs(%o1 : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
return %res : tensor<1024x1024xf32>
}
@@ -43,14 +43,14 @@ func.func @test_shard_constant() -> (tensor<1024x1024xf32>) attributes {llvm.emi
// CHECK-NEXT: [[vsharded_4:%.*]] = shard.shard [[vsharded]] to [[vsharding_3]] annotate_for_users : tensor<1024x1024xf32>
// CHECK-NEXT: [[vsharding_5:%.*]] = shard.sharding @grid4x4 split_axes = {{\[\[}}0]] : !shard.sharding
// CHECK-NEXT: [[vsharded_6:%.*]] = shard.shard [[vsharded_2]] to [[vsharding_5]] annotate_for_users : tensor<1024x1024xf32>
-// CHECK-NEXT: [[v1:%.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> indexing_maps = {{.*}} ins([[vsharded_4]], [[vcst_0]] : tensor<1024x1024xf32>, f32) outs([[vsharded_6]] : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
+// CHECK-NEXT: [[v1:%.*]] = linalg.elementwise <add> indexing_maps = {{.*}} ins([[vsharded_4]], [[vcst_0]] : tensor<1024x1024xf32>, f32) outs([[vsharded_6]] : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
// CHECK-NEXT: [[vsharding_7:%.*]] = shard.sharding @grid4x4 split_axes = {{\[\[}}0]] : !shard.sharding
// CHECK-NEXT: [[vsharded_8:%.*]] = shard.shard [[v1]] to [[vsharding_7]] : tensor<1024x1024xf32>
func.func @test_shard_constant_back() -> (tensor<1024x1024xf32>) attributes {llvm.emit_c_interface} {
%cst_1 = arith.constant dense<0.000000e+00> : tensor<1024x1024xf32>
%ci = arith.constant 43.4e+00 : f32
%o1 = tensor.empty() : tensor<1024x1024xf32>
- %res = linalg.elementwise kind=#linalg.elementwise_kind<add> indexing_maps = [#id, #sc, #id] ins(%cst_1, %ci : tensor<1024x1024xf32>, f32) outs(%o1 : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
+ %res = linalg.elementwise <add> indexing_maps = [#id, #sc, #id] ins(%cst_1, %ci : tensor<1024x1024xf32>, f32) outs(%o1 : tensor<1024x1024xf32>) -> tensor<1024x1024xf32>
%sharding_1 = shard.sharding @grid4x4 split_axes = [[0]] : !shard.sharding
%sharded_1 = shard.shard %res to %sharding_1 : tensor<1024x1024xf32>
return %sharded_1 : tensor<1024x1024xf32>
diff --git a/mlir/test/Dialect/Bufferization/canonicalize.mlir b/mlir/test/Dialect/Bufferization/canonicalize.mlir
index 887011e5be375..d235e673c2336 100644
--- a/mlir/test/Dialect/Bufferization/canonicalize.mlir
+++ b/mlir/test/Dialect/Bufferization/canonicalize.mlir
@@ -317,14 +317,14 @@ func.func @tensor_cast_to_buffer_layout_and_memspace(%arg0 : tensor<4x6x16x32xi8
func.func @load_after_write_from_buffer_cast(%arg0: index, %arg1: index,
%arg2: tensor<?x?xf32>) -> f32 {
%0 = bufferization.to_buffer %arg2 : tensor<?x?xf32> to memref<?x?xf32>
- linalg.elementwise kind=#linalg.elementwise_kind<ceil> ins(%0 : memref<?x?xf32>) outs(%0 : memref<?x?xf32>)
+ linalg.elementwise <ceil> ins(%0 : memref<?x?xf32>) outs(%0 : memref<?x?xf32>)
%1 = memref.load %0[%arg0, %arg1] : memref<?x?xf32>
return %1 : f32
}
// CHECK-SAME: %[[IDX0:[0-9a-z]+]]: index, %[[IDX1:[0-9a-z]+]]: index
// CHECK-SAME: %[[TENSOR:[0-9a-z]+]]: tensor<?x?xf32>
// CHECK: %[[M:.+]] = bufferization.to_buffer %[[TENSOR]] : tensor<?x?xf32> to memref<?x?xf32>
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<ceil> ins(%[[M]] : memref<?x?xf32>) outs(%[[M]] : memref<?x?xf32>)
+// CHECK: linalg.elementwise <ceil> ins(%[[M]] : memref<?x?xf32>) outs(%[[M]] : memref<?x?xf32>)
// CHECK: %[[RES:.*]] = memref.load %[[M]][%[[IDX0]], %[[IDX1]]] : memref<?x?xf32>
// CHECK: return %[[RES]] : f32
diff --git a/mlir/test/Dialect/Linalg/block-pack-matmul.mlir b/mlir/test/Dialect/Linalg/block-pack-matmul.mlir
index 1017bc047c67b..6ac4c12ff5379 100644
--- a/mlir/test/Dialect/Linalg/block-pack-matmul.mlir
+++ b/mlir/test/Dialect/Linalg/block-pack-matmul.mlir
@@ -142,7 +142,7 @@ func.func @block_matmul_with_consumer(
%0 = tensor.empty() : tensor<128x128xf32>
%1 = linalg.matmul ins(%A, %B : tensor<128x128xf32>, tensor<128x128xf32>)
outs(%C : tensor<128x128xf32>) -> tensor<128x128xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1, %D : tensor<128x128xf32>, tensor<128x128xf32>)
+ %2 = linalg.elementwise <add> ins(%1, %D : tensor<128x128xf32>, tensor<128x128xf32>)
outs(%0 : tensor<128x128xf32>) -> tensor<128x128xf32>
return %2 : tensor<128x128xf32>
}
@@ -155,7 +155,7 @@ func.func @block_matmul_with_consumer(
// CHECK: %[[RES_UNPACKED:.+]] = linalg.unpack %[[GEMM_RES_PACKED]]
// CHECK-SAME: inner_dims_pos = [0, 1] inner_tiles = [32, 16]
// CHECK-SAME: into %[[C]] : tensor<4x8x32x16xf32> -> tensor<128x128xf32>
-// CHECK: %[[ADD_RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[ADD_RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[RES_UNPACKED]], %[[D]] : tensor<128x128xf32>, tensor<128x128xf32>) outs(%[[RES_DST]] : tensor<128x128xf32>)
// CHECK: return %[[ADD_RES]] : tensor<128x128xf32>
diff --git a/mlir/test/Dialect/Linalg/decompose-generic-by-unfolding-projected-permutation.mlir b/mlir/test/Dialect/Linalg/decompose-generic-by-unfolding-projected-permutation.mlir
index 3cc39c5ac8333..991434b81c699 100644
--- a/mlir/test/Dialect/Linalg/decompose-generic-by-unfolding-projected-permutation.mlir
+++ b/mlir/test/Dialect/Linalg/decompose-generic-by-unfolding-projected-permutation.mlir
@@ -20,7 +20,7 @@ func.func @transpose_and_broadcast(%x : tensor<7x8x9xf32>, %y: tensor<5x9x7x8x1
// CHECK: %[[X_trans:.+]] = linalg.transpose ins(%[[X]] : tensor<7x8x9xf32>) outs(%[[E0]] : tensor<9x7x8xf32>) permutation = [2, 0, 1]
// CHECK: %[[E1:.+]] = tensor.empty() : tensor<5x9x7x8x10xf32>
// CHECK: %[[X_trans_bc:.+]] = linalg.broadcast ins(%[[X_trans]] : tensor<9x7x8xf32>) outs(%[[E1]] : tensor<5x9x7x8x10xf32>) dimensions = [0, 4]
-// CHECK: {{.*}} = linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[X_trans_bc]], %[[Y]] : tensor<5x9x7x8x10xf32>, tensor<5x9x7x8x10xf32>) outs(%[[Z]] : tensor<5x9x7x8x10xf32>) -> tensor<5x9x7x8x10xf32>
+// CHECK: {{.*}} = linalg.elementwise <div> ins(%[[X_trans_bc]], %[[Y]] : tensor<5x9x7x8x10xf32>, tensor<5x9x7x8x10xf32>) outs(%[[Z]] : tensor<5x9x7x8x10xf32>) -> tensor<5x9x7x8x10xf32>
// CHECK-NOT: linalg.generic
// -----
@@ -44,7 +44,7 @@ func.func @transpose_only(%x : tensor<32x2x16xf32>, %y: tensor<2x16x32xf32>, %z
// CHECK-SAME: %[[X:.+]]: tensor<32x2x16xf32>, %[[Y:.+]]: tensor<2x16x32xf32>, %[[Z:.+]]: tensor<2x16x32xf32>) -> tensor<2x16x32xf32> {
// CHECK: %[[E0:.+]] = tensor.empty() : tensor<2x16x32xf32>
// CHECK: %[[X_trans:.+]] = linalg.transpose ins(%[[X]] : tensor<32x2x16xf32>) outs(%[[E0]] : tensor<2x16x32xf32>) permutation = [1, 2, 0]
-// CHECK: {{.*}} = linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[X_trans]], %[[Y]] : tensor<2x16x32xf32>, tensor<2x16x32xf32>) outs(%[[Z]] : tensor<2x16x32xf32>) -> tensor<2x16x32xf32>
+// CHECK: {{.*}} = linalg.elementwise <div> ins(%[[X_trans]], %[[Y]] : tensor<2x16x32xf32>, tensor<2x16x32xf32>) outs(%[[Z]] : tensor<2x16x32xf32>) -> tensor<2x16x32xf32>
// CHECK-NOT: linalg.generic
// -----
@@ -67,5 +67,5 @@ func.func @broadcast_only(%x : tensor<2x16x32xf32>, %y: tensor<2x32xf32>, %z :
// CHECK-SAME: %[[X:.+]]: tensor<2x16x32xf32>, %[[Y:.+]]: tensor<2x32xf32>, %[[Z:.+]]: tensor<2x16x32xf32>) -> tensor<2x16x32xf32> {
// CHECK: %[[E0:.+]] = tensor.empty() : tensor<2x16x32xf32>
// CHECK: %[[X_bc:.+]] = linalg.broadcast ins(%[[Y]] : tensor<2x32xf32>) outs(%[[E0]] : tensor<2x16x32xf32>) dimensions = [1]
-// CHECK: {{.*}} = linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[X]], %[[X_bc]] : tensor<2x16x32xf32>, tensor<2x16x32xf32>) outs(%arg2 : tensor<2x16x32xf32>) -> tensor<2x16x32xf32>
+// CHECK: {{.*}} = linalg.elementwise <div> ins(%[[X]], %[[X_bc]] : tensor<2x16x32xf32>, tensor<2x16x32xf32>) outs(%arg2 : tensor<2x16x32xf32>) -> tensor<2x16x32xf32>
// CHECK-NOT: linalg.generic
diff --git a/mlir/test/Dialect/Linalg/elementwise/fold.mlir b/mlir/test/Dialect/Linalg/elementwise/fold.mlir
index 3a0bec37d9463..5b9fa1b556a3a 100644
--- a/mlir/test/Dialect/Linalg/elementwise/fold.mlir
+++ b/mlir/test/Dialect/Linalg/elementwise/fold.mlir
@@ -4,7 +4,7 @@
// CHECK-DAG: #[[TRANSPOSED:.+]] = affine_map<(d0, d1, d2) -> (d1, d0, d2)>
//
// CHECK: func.func @unary_transpose(%[[A:.+]]: tensor<16x8x32xf32>, %[[B:.+]]: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <exp>
// CHECK-SAME: indexing_maps = [#[[TRANSPOSED]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]] : tensor<16x8x32xf32>) outs(%[[B]] : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
// CHECK-NEXT: return %[[RES]] : tensor<8x16x32xf32>
@@ -12,7 +12,7 @@
func.func @unary_transpose(%A: tensor<16x8x32xf32>, %B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%empty = tensor.empty() : tensor<8x16x32xf32>
%transposed_A = linalg.transpose ins(%A : tensor<16x8x32xf32>) outs(%empty : tensor<8x16x32xf32>) permutation = [1, 0, 2]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %result = linalg.elementwise <exp>
ins(%transposed_A : tensor<8x16x32xf32>) outs(%B : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
return %result : tensor<8x16x32xf32>
}
@@ -23,7 +23,7 @@ func.func @unary_transpose(%A: tensor<16x8x32xf32>, %B: tensor<8x16x32xf32>) ->
// CHECK-DAG: #[[TRANSPOSED:.+]] = affine_map<(d0, d1) -> (d1, d0)>
//
// CHECK: func.func @binary_transposed(%[[A:.+]]: tensor<?x?xf32>, %[[B:.+]]: tensor<?x?xf32>, %[[C:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[IDENTITY]], #[[TRANSPOSED]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[C]] : tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NEXT: return %[[RES]] : tensor<?x?xf32>
@@ -36,7 +36,7 @@ func.func @binary_transposed(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>, %C: tenso
%empty = tensor.empty(%dim1, %dim0) : tensor<?x?xf32>
%transposed_B = linalg.transpose ins(%B : tensor<?x?xf32>) outs(%empty : tensor<?x?xf32>) permutation = [1, 0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
ins(%A, %transposed_B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%C : tensor<?x?xf32>) -> tensor<?x?xf32>
return %result : tensor<?x?xf32>
@@ -48,7 +48,7 @@ func.func @binary_transposed(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>, %C: tenso
// CHECK-DAG: #[[BROADCASTED:.+]] = affine_map<(d0, d1, d2) -> (d0, d2)>
//
// CHECK: func.func @unary_broadcasted(%[[A:.+]]: tensor<8x32xf32>, %[[B:.+]]: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <exp>
// CHECK-SAME: indexing_maps = [#[[BROADCASTED]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]] : tensor<8x32xf32>) outs(%[[B]] : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
// CHECK-NEXT: return %[[RES]] : tensor<8x16x32xf32>
@@ -56,7 +56,7 @@ func.func @binary_transposed(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>, %C: tenso
func.func @unary_broadcasted(%A: tensor<8x32xf32>, %B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%empty = tensor.empty() : tensor<8x16x32xf32>
%broadcasted_A = linalg.broadcast ins(%A : tensor<8x32xf32>) outs(%empty : tensor<8x16x32xf32>) dimensions = [1]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %result = linalg.elementwise <exp>
ins(%broadcasted_A : tensor<8x16x32xf32>) outs(%B : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
return %result : tensor<8x16x32xf32>
}
@@ -67,7 +67,7 @@ func.func @unary_broadcasted(%A: tensor<8x32xf32>, %B: tensor<8x16x32xf32>) -> t
// CHECK-DAG: #[[BROADCASTED:.+]] = affine_map<(d0, d1) -> (d0)>
//
// CHECK: func.func @binary_broadcasted(%[[A:.+]]: tensor<?x?xf32>, %[[B:.+]]: tensor<?xf32>, %[[C:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[IDENTITY]], #[[BROADCASTED]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?x?xf32>, tensor<?xf32>) outs(%[[C]] : tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NEXT: return %[[RES]] : tensor<?x?xf32>
@@ -80,7 +80,7 @@ func.func @binary_broadcasted(%A: tensor<?x?xf32>, %B: tensor<?xf32>, %C: tensor
%empty = tensor.empty(%dim1, %dim0) : tensor<?x?xf32>
%broadcasted_B = linalg.broadcast ins(%B : tensor<?xf32>) outs(%empty : tensor<?x?xf32>) dimensions = [1]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
ins(%A, %broadcasted_B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%C : tensor<?x?xf32>) -> tensor<?x?xf32>
return %result : tensor<?x?xf32>
@@ -92,7 +92,7 @@ func.func @binary_broadcasted(%A: tensor<?x?xf32>, %B: tensor<?xf32>, %C: tensor
// CHECK-DAG: #[[COMPOSED_MAP:.+]] = affine_map<(d0, d1) -> (d0)>
//
// CHECK: func.func @fold_broadcast_after_transpose_fold(%[[A:.+]]: tensor<16xf32>, %[[B:.+]]: tensor<16x32xf32>) -> tensor<16x32xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <exp>
// CHECK-SAME: indexing_maps = [#[[COMPOSED_MAP]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]] : tensor<16xf32>) outs(%[[B]] : tensor<16x32xf32>) -> tensor<16x32xf32>
// CHECK-NEXT: return %[[RES]] : tensor<16x32xf32>
@@ -105,7 +105,7 @@ func.func @fold_broadcast_after_transpose_fold(%A: tensor<16xf32>, %B: tensor<16
%broadcasted_A = linalg.broadcast ins(%A : tensor<16xf32>) outs(%empty_b : tensor<32x16xf32>) dimensions = [0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %result = linalg.elementwise <exp>
indexing_maps = [#transpose, #identity]
ins(%broadcasted_A : tensor<32x16xf32>) outs(%B : tensor<16x32xf32>) -> tensor<16x32xf32>
return %result : tensor<16x32xf32>
@@ -117,7 +117,7 @@ func.func @fold_broadcast_after_transpose_fold(%A: tensor<16xf32>, %B: tensor<16
// CHECK-DAG: #[[COMPOSED_MAP:.+]] = affine_map<(d0, d1, d2) -> (d2, d1)>
//
// CHECK: func.func @fold_transpose_after_broadcast_fold(%[[A:.+]]: tensor<32x16xf32>, %[[B:.+]]: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <exp>
// CHECK-SAME: indexing_maps = [#[[COMPOSED_MAP]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]] : tensor<32x16xf32>) outs(%[[B]] : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
// CHECK-NEXT: return %[[RES]] : tensor<8x16x32xf32>
@@ -129,7 +129,7 @@ func.func @fold_transpose_after_broadcast_fold(%A: tensor<32x16xf32>, %B: tensor
%empty_t = tensor.empty() : tensor<16x32xf32>
%transposed_A = linalg.transpose ins(%A : tensor<32x16xf32>) outs(%empty_t : tensor<16x32xf32>) permutation = [1, 0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %result = linalg.elementwise <exp>
indexing_maps = [#broadcast, #identity]
ins(%transposed_A : tensor<16x32xf32>) outs(%B : tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
return %result : tensor<8x16x32xf32>
@@ -141,7 +141,7 @@ func.func @fold_transpose_after_broadcast_fold(%A: tensor<32x16xf32>, %B: tensor
// CHECK-DAG: #[[COMPOSED_MAP:.+]] = affine_map<(d0, d1) -> (d0)>
//
// CHECK: func.func @fold_broadcast_after_transpose_fold_binary(%[[A:.+]]: tensor<?xf32>, %[[B:.+]]: tensor<?x?xf32>, %[[C:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[COMPOSED_MAP]], #[[IDENTITY]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?xf32>, tensor<?x?xf32>) outs(%[[C]] : tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NEXT: return %[[RES]] : tensor<?x?xf32>
@@ -158,7 +158,7 @@ func.func @fold_broadcast_after_transpose_fold_binary(%A: tensor<?xf32>, %B: ten
%empty_b = tensor.empty(%dim1, %dim0) : tensor<?x?xf32>
%broadcasted_A = linalg.broadcast ins(%A : tensor<?xf32>) outs(%empty_b : tensor<?x?xf32>) dimensions = [0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
indexing_maps = [#transpose, #identity, #identity]
ins(%broadcasted_A, %B : tensor<?x?xf32>, tensor<?x?xf32>) outs(%C : tensor<?x?xf32>) -> tensor<?x?xf32>
@@ -171,7 +171,7 @@ func.func @fold_broadcast_after_transpose_fold_binary(%A: tensor<?xf32>, %B: ten
// CHECK-DAG: #[[COMPOSED_MAP:.+]] = affine_map<(d0, d1, d2) -> (d2, d1)>
//
// CHECK: func.func @fold_transpose_after_broadcast_fold_binary(%[[A:.+]]: tensor<?x?xf32>, %[[B:.+]]: tensor<?x?x?xf32>, %[[C:.+]]: tensor<?x?x?xf32>) -> tensor<?x?x?xf32> {
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[COMPOSED_MAP]], #[[IDENTITY]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?x?xf32>, tensor<?x?x?xf32>) outs(%[[C]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
// CHECK-NEXT: return %[[RES]] : tensor<?x?x?xf32>
@@ -190,7 +190,7 @@ func.func @fold_transpose_after_broadcast_fold_binary(%A: tensor<?x?xf32>, %B: t
%empty_t = tensor.empty(%dim1, %dim2) : tensor<?x?xf32>
%transposed_A = linalg.transpose ins(%A : tensor<?x?xf32>) outs(%empty_t : tensor<?x?xf32>) permutation = [1, 0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
indexing_maps = [#broadcast, #identity, #identity]
ins(%transposed_A, %B : tensor<?x?xf32>, tensor<?x?x?xf32>) outs(%C : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
return %result : tensor<?x?x?xf32>
@@ -204,7 +204,7 @@ func.func @fold_transpose_after_broadcast_fold_binary(%A: tensor<?x?xf32>, %B: t
// CHECK: func.func @fold_failed_diagonal_map(%[[A:.+]]: tensor<16xf32>, %[[B:.+]]: tensor<16xf32>, %[[C:.+]]: tensor<16xf32>) -> tensor<16xf32> {
// CHECK-NEXT: %[[EMPTY:.+]] = tensor.empty() : tensor<16x16xf32>
// CHECK-NEXT: %[[BROADCASTED_B:.+]] = linalg.broadcast ins(%[[B]] : tensor<16xf32>) outs(%[[EMPTY]] : tensor<16x16xf32>) dimensions = [0]
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[IDENTITY]], #[[DIAGONAL]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[BROADCASTED_B]] : tensor<16xf32>, tensor<16x16xf32>) outs(%[[C]] : tensor<16xf32>) -> tensor<16xf32>
// CHECK-NEXT: return %[[RES]] : tensor<16xf32>
@@ -215,7 +215,7 @@ func.func @fold_transpose_after_broadcast_fold_binary(%A: tensor<?x?xf32>, %B: t
func.func @fold_failed_diagonal_map(%A: tensor<16xf32>, %B: tensor<16xf32>, %C: tensor<16xf32>) -> tensor<16xf32> {
%empty = tensor.empty() : tensor<16x16xf32>
%broadcasted_B = linalg.broadcast ins(%B : tensor<16xf32>) outs(%empty : tensor<16x16xf32>) dimensions = [0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
indexing_maps = [#identity, #diagonal, #identity]
ins(%A, %broadcasted_B : tensor<16xf32>, tensor<16x16xf32>) outs(%C : tensor<16xf32>) -> tensor<16xf32>
return %result : tensor<16xf32>
@@ -229,7 +229,7 @@ func.func @fold_failed_diagonal_map(%A: tensor<16xf32>, %B: tensor<16xf32>, %C:
// CHECK: func.func @fold_failed_constant_map(%[[A:.+]]: tensor<16xf32>, %[[B:.+]]: tensor<16x32xf32>, %[[C:.+]]: tensor<16xf32>) -> tensor<16xf32> {
// CHECK-NEXT: %[[EMPTY:.+]] = tensor.empty() : tensor<32x16xf32>
// CHECK-NEXT: %[[TRANSPOSED_B:.+]] = linalg.transpose ins(%[[B]] : tensor<16x32xf32>) outs(%[[EMPTY]] : tensor<32x16xf32>) permutation = [1, 0]
-// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: %[[RES:.+]] = linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[IDENTITY]], #[[CONSTANT]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]], %[[TRANSPOSED_B]] : tensor<16xf32>, tensor<32x16xf32>) outs(%[[C]] : tensor<16xf32>) -> tensor<16xf32>
// CHECK-NEXT: return %[[RES]] : tensor<16xf32>
@@ -240,7 +240,7 @@ func.func @fold_failed_diagonal_map(%A: tensor<16xf32>, %B: tensor<16xf32>, %C:
func.func @fold_failed_constant_map(%A: tensor<16xf32>, %B: tensor<16x32xf32>, %C: tensor<16xf32>) -> tensor<16xf32> {
%empty = tensor.empty() : tensor<32x16xf32>
%transposed_B = linalg.transpose ins(%B : tensor<16x32xf32>) outs(%empty : tensor<32x16xf32>) permutation = [1, 0]
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %result = linalg.elementwise <add>
indexing_maps = [#identity, #constant, #identity]
ins(%A, %transposed_B : tensor<16xf32>, tensor<32x16xf32>) outs(%C : tensor<16xf32>) -> tensor<16xf32>
return %result : tensor<16xf32>
diff --git a/mlir/test/Dialect/Linalg/elementwise/generalize-named-ops.mlir b/mlir/test/Dialect/Linalg/elementwise/generalize-named-ops.mlir
index e884858c016f4..8eb21a7e11983 100644
--- a/mlir/test/Dialect/Linalg/elementwise/generalize-named-ops.mlir
+++ b/mlir/test/Dialect/Linalg/elementwise/generalize-named-ops.mlir
@@ -14,7 +14,7 @@
//
func.func @unary_exp(%A : tensor<8x16x32xf32>, %B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<exp>
+ <exp>
ins(%A : tensor<8x16x32xf32>)
outs(%B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
return %r : tensor<8x16x32xf32>
@@ -36,7 +36,7 @@ func.func @unary_exp(%A : tensor<8x16x32xf32>, %B: tensor<8x16x32xf32>) -> tens
//
func.func @unary_transpose_broadcast_tanh(%A : tensor<32x16xf32>, %B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<tanh>
+ <tanh>
indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d1)>,
affine_map<(d0, d1, d2) -> (d0, d1, d2)>]
ins(%A : tensor<32x16xf32>)
@@ -59,7 +59,7 @@ func.func @unary_transpose_broadcast_tanh(%A : tensor<32x16xf32>, %B: tensor<8x1
//
func.func @binary_div_on_memrefs(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16x8xf32>) {
linalg.elementwise
- kind=#linalg.elementwise_kind<div>
+ <div>
ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>)
outs(%C: memref<16x8xf32>)
return
@@ -80,7 +80,7 @@ func.func @binary_div_on_memrefs(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C
//
func.func @binary_mul_on_tensors(%A : tensor<16x8xf32>, %B: tensor<16x8xf32>, %C: tensor<16x8xf32>) -> tensor<16x8xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<mul>
+ <mul>
ins(%A, %B: tensor<16x8xf32>, tensor<16x8xf32>)
outs(%C: tensor<16x8xf32>) -> tensor<16x8xf32>
return %r : tensor<16x8xf32>
@@ -102,7 +102,7 @@ func.func @binary_mul_on_tensors(%A : tensor<16x8xf32>, %B: tensor<16x8xf32>, %C
//
func.func @binary_transpose_a(%A : tensor<8x16xf32>, %B: tensor<16x8xf32>, %C: tensor<16x8xf32>) -> tensor<16x8xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<sub>
+ <sub>
indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0, d1)>,
affine_map<(d0, d1) -> (d0, d1)>]
@@ -128,7 +128,7 @@ func.func @binary_transpose_a(%A : tensor<8x16xf32>, %B: tensor<16x8xf32>, %C: t
//
func.func @binary_transpose_a_broadcast_b(%A : tensor<8x16xf32>, %B: tensor<16xf32>, %C: tensor<16x8xf32>) -> tensor<16x8xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<add>
+ <add>
indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0)>,
affine_map<(d0, d1) -> (d0, d1)>]
@@ -154,7 +154,7 @@ func.func @binary_transpose_a_broadcast_b(%A : tensor<8x16xf32>, %B: tensor<16xf
//
func.func @ternary(%A : tensor<32x16xi1>, %B: tensor<8x16x32xf32>, %C : tensor<8x16x32xf32>, %D : tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<select>
+ <select>
indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d1)>,
affine_map<(d0, d1, d2) -> (d0, d1, d2)>,
affine_map<(d0, d1, d2) -> (d0, d1, d2)>,
diff --git a/mlir/test/Dialect/Linalg/elementwise/invalid.mlir b/mlir/test/Dialect/Linalg/elementwise/invalid.mlir
index fe03519ae94b8..217b69924824f 100644
--- a/mlir/test/Dialect/Linalg/elementwise/invalid.mlir
+++ b/mlir/test/Dialect/Linalg/elementwise/invalid.mlir
@@ -1,9 +1,8 @@
// RUN: mlir-opt %s -split-input-file -verify-diagnostics
func.func @misspelt_op_div(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16x8xf32>) {
- // expected-error at +3 {{expected ::mlir::linalg::ElementwiseKind to be one of: exp, log, abs, ceil, floor}}
- // expected-error at +2 {{failed to parse ElementwiseKindAttr parameter}}
- // expected-error at +1 {{custom op 'linalg.elementwise' expected operation 'kind' attribute}}
- linalg.elementwise kind=#linalg.elementwise_kind<dive> ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
+ // expected-error at +2 {{custom op 'linalg.elementwise' failed to parse ElementwiseKindAttr parameter 'value' which is to be a `::mlir::linalg::ElementwiseKind`}}
+ // expected-error at +1 {{custom op 'linalg.elementwise' expected ::mlir::linalg::ElementwiseKind to be one of: exp, log, abs, ceil, floor, negf, reciprocal, round, sqrt, rsqrt, square, tanh, erf, sin, cos, tan, acos, acosh, asin, asinh, atan, atanh, log10, log1p, log2, add, sub, mul, div, div_unsigned, max_signed, min_signed, max_unsigned, min_unsigned, powf, select}}
+ linalg.elementwise <dive> ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
return
}
@@ -12,7 +11,7 @@ func.func @misspelt_op_div(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memr
#map = affine_map<(d0, d1) -> (d0, d1)>
func.func @missing_indexing_map(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16x8xf32>) {
// expected-error at +1 {{'linalg.elementwise' op expected the number of indexing_map (2) to be equal to the number of input/output operands (3)}}
- linalg.elementwise kind=#linalg.elementwise_kind<div> indexing_maps = [#map, #map] ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
+ linalg.elementwise <div> indexing_maps = [#map, #map] ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
return
}
@@ -21,7 +20,7 @@ func.func @missing_indexing_map(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C:
#map = affine_map<(d0, d1) -> (d0, d1)>
func.func @identity_map_when_transpose_expected(%A : memref<8x16xf32>, %B: memref<16x8xf32>, %C: memref<16x8xf32>) {
// expected-error at +1 {{'linalg.elementwise' op inferred input/output operand #1 has shape's dimension #0 to be 8, but found 16}}
- linalg.elementwise kind=#linalg.elementwise_kind<div> indexing_maps = [#map, #map, #map] ins(%A, %B: memref<8x16xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
+ linalg.elementwise <div> indexing_maps = [#map, #map, #map] ins(%A, %B: memref<8x16xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>)
return
}
@@ -31,7 +30,7 @@ func.func @identity_map_when_transpose_expected(%A : memref<8x16xf32>, %B: memre
#map1 = affine_map<(d0, d1) -> (d0)>
func.func @incorrect_result_rank(%A : memref<8x16xf32>, %B: memref<8x16xf32>, %C: memref<8xf32>) {
// expected-error at +1 {{'linalg.elementwise' op expected indexing_map #0 to have 1 dim(s) to match the number of loops}}
- linalg.elementwise kind=#linalg.elementwise_kind<div> indexing_maps = [#map, #map, #map1] ins(%A, %B: memref<8x16xf32>, memref<8x16xf32>) outs(%C: memref<8xf32>)
+ linalg.elementwise <div> indexing_maps = [#map, #map, #map1] ins(%A, %B: memref<8x16xf32>, memref<8x16xf32>) outs(%C: memref<8xf32>)
return
}
@@ -40,7 +39,7 @@ func.func @incorrect_result_rank(%A : memref<8x16xf32>, %B: memref<8x16xf32>, %C
func.func @unary_too_many_args(%A : memref<8x16x32xf32>, %B: memref<8x16x32xf32>, %C: memref<8x16x32xf32>) {
// expected-error at +3 {{custom op 'linalg.elementwise' [parseNamedStructuredOpRegion] ods-gen generated region expects 2 args, got 3}}
// expected-error at +2 {{custom op 'linalg.elementwise' unable to parse elemwise op}}
- linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%A, %B : memref<8x16x32xf32>, memref<8x16x32xf32>) outs(%C: memref<8x16x32xf32>)
+ linalg.elementwise <exp> ins(%A, %B : memref<8x16x32xf32>, memref<8x16x32xf32>) outs(%C: memref<8x16x32xf32>)
return
}
@@ -49,6 +48,6 @@ func.func @unary_too_many_args(%A : memref<8x16x32xf32>, %B: memref<8x16x32xf32>
func.func @binary_too_few_args(%A : memref<8x16x32xf32>, %B: memref<8x16x32xf32>) {
// expected-error at +3 {{custom op 'linalg.elementwise' [parseNamedStructuredOpRegion] ods-gen generated region expects 3 args, got 2}}
// expected-error at +2 {{custom op 'linalg.elementwise' unable to parse elemwise op}}
- linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%A : memref<8x16x32xf32>) outs(%B: memref<8x16x32xf32>)
+ linalg.elementwise <add> ins(%A : memref<8x16x32xf32>) outs(%B: memref<8x16x32xf32>)
return
}
diff --git a/mlir/test/Dialect/Linalg/elementwise/roundtrip.mlir b/mlir/test/Dialect/Linalg/elementwise/roundtrip.mlir
index 29cf1b351deeb..2a18cb799e242 100644
--- a/mlir/test/Dialect/Linalg/elementwise/roundtrip.mlir
+++ b/mlir/test/Dialect/Linalg/elementwise/roundtrip.mlir
@@ -6,12 +6,12 @@
// Note - the functions are named @{unary|binary}_{identity|transpose|broadcast|transpose_a|...}_{exp|mul|div|..}
// CHECK: @unary_identity_exp(%[[A:.+]]: tensor<8x16x32xf32>, %[[B:.+]]: tensor<8x16x32xf32>)
-// CHECK: %{{.*}} = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %{{.*}} = linalg.elementwise <exp>
// CHECK-SAME ins(%[[A:.+]] : tensor<8x16x32xf32>) outs(%[[B:.+]] : tensor<8x16x32xf32>)
//
func.func @unary_identity_exp(%A : tensor<8x16x32xf32>, %B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<exp>
+ <exp>
ins(%A : tensor<8x16x32xf32>)
outs(%B: tensor<8x16x32xf32>) -> tensor<8x16x32xf32>
return %r : tensor<8x16x32xf32>
@@ -24,14 +24,14 @@ func.func @unary_identity_exp(%A : tensor<8x16x32xf32>, %B: tensor<8x16x32xf32>)
//
// CHECK: @unary_projection_tanh(%[[A:.+]]: tensor<?x16xf32>,
// CHECK-SAME: %[[B:.+]]: tensor<8x16x?xf32>) -> tensor<8x16x?xf32> {
-// CHECK: {{.*}} = linalg.elementwise kind=#linalg.elementwise_kind<tanh>
+// CHECK: {{.*}} = linalg.elementwise <tanh>
// CHECK-SAME: indexing_maps = [#[[PROJECTION]], #[[IDENTITY]]]
// CHECK-SAME: ins(%[[A]] : tensor<?x16xf32>) outs(%[[B]] : tensor<8x16x?xf32>) -> tensor<8x16x?xf32>
//
func.func @unary_projection_tanh(%A: tensor<?x16xf32>,
%B: tensor<8x16x?xf32>) -> tensor<8x16x?xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<tanh>
+ <tanh>
indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d1)>,
affine_map<(d0, d1, d2) -> (d0, d1, d2)>]
ins(%A : tensor<?x16xf32>)
@@ -44,14 +44,14 @@ func.func @unary_projection_tanh(%A: tensor<?x16xf32>,
// CHECK: @binary_identity_div(%[[A:.+]]: tensor<16x8xf32>, %[[B:.+]]: tensor<16x8xf32>,
// CHECK-SAME: %[[C:.+]]: tensor<16x8xf32>) -> tensor<16x8xf32> {
// CHECK: {{.*}} = linalg.elementwise
-// CHECK-SAME: kind=#linalg.elementwise_kind<div>
+// CHECK-SAME: <div>
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<16x8xf32>, tensor<16x8xf32>)
// CHECK-SAME: outs(%[[C]] : tensor<16x8xf32>) -> tensor<16x8xf32>
//
func.func @binary_identity_div(%A: tensor<16x8xf32>, %B: tensor<16x8xf32>,
%C: tensor<16x8xf32>) -> tensor<16x8xf32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<div>
+ <div>
ins(%A, %B: tensor<16x8xf32>, tensor<16x8xf32>)
outs(%C: tensor<16x8xf32>) -> tensor<16x8xf32>
return %r : tensor<16x8xf32>
@@ -63,14 +63,14 @@ func.func @binary_identity_div(%A: tensor<16x8xf32>, %B: tensor<16x8xf32>,
// CHECK-SAME: %[[B:.+]]: tensor<1x2x3x4x5xi32>,
// CHECK-SAME: %[[C:.+]]: tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32> {
// CHECK: {{.*}} = linalg.elementwise
-// CHECK-SAME: kind=#linalg.elementwise_kind<mul>
+// CHECK-SAME: <mul>
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<1x2x3x4x5xi32>, tensor<1x2x3x4x5xi32>)
// CHECK-SAME: outs(%[[C]] : tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32>
//
func.func @binary_identity_mul_5Di(%A: tensor<1x2x3x4x5xi32>, %B: tensor<1x2x3x4x5xi32>,
%C: tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<mul>
+ <mul>
ins(%A, %B: tensor<1x2x3x4x5xi32>, tensor<1x2x3x4x5xi32>)
outs(%C: tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32>
return %r : tensor<1x2x3x4x5xi32>
@@ -85,7 +85,7 @@ func.func @binary_identity_mul_5Di(%A: tensor<1x2x3x4x5xi32>, %B: tensor<1x2x3x4
func.func @redundant_maps(%A: tensor<1x2x3x4x5xi32>, %B: tensor<1x2x3x4x5xi32>,
%C: tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32> {
%r = linalg.elementwise
- kind=#linalg.elementwise_kind<mul>
+ <mul>
indexing_maps = [#map, #map, #map]
ins(%A, %B: tensor<1x2x3x4x5xi32>, tensor<1x2x3x4x5xi32>)
outs(%C: tensor<1x2x3x4x5xi32>) -> tensor<1x2x3x4x5xi32>
diff --git a/mlir/test/Dialect/Linalg/fold-add-into-dest.mlir b/mlir/test/Dialect/Linalg/fold-add-into-dest.mlir
index 815cbae4258bf..ae943b33d373e 100644
--- a/mlir/test/Dialect/Linalg/fold-add-into-dest.mlir
+++ b/mlir/test/Dialect/Linalg/fold-add-into-dest.mlir
@@ -10,7 +10,7 @@ func.func @fold_add_on_two_matmuls(%arg0: !type, %arg1: !type) -> !type {
%4 = tensor.empty() : !type
%5 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%6 = linalg.matmul ins(%arg1, %0 : !type, !type) outs(%5 : !type) -> !type
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %6 : !type, !type) outs(%1 : !type) -> !type
+ %7 = linalg.elementwise <add> ins(%3, %6 : !type, !type) outs(%1 : !type) -> !type
return %7 : !type
}
@@ -44,7 +44,7 @@ func.func @expect_no_fold_of_add_as_orig_dest_not_additive_zero(%arg0: !type, %a
%2 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%3 = linalg.matmul ins(%arg0, %0 : !type, !type) outs(%2 : !type) -> !type
%4 = linalg.matmul ins(%arg1, %0 : !type, !type) outs(%0 : !type) -> !type
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
+ %5 = linalg.elementwise <add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
return %5 : !type
}
@@ -75,8 +75,8 @@ func.func @expect_no_fold_of_add_as_contraction_result_has_multiple_users(%arg0:
%2 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%3 = linalg.matmul ins(%arg0, %0 : !type, !type) outs(%2 : !type) -> !type
%4 = linalg.matmul ins(%arg1, %0 : !type, !type) outs(%0 : !type) -> !type
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
- %6 = linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%4, %arg0 : !type, !type) outs(%1 : !type) -> !type
+ %5 = linalg.elementwise <add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
+ %6 = linalg.elementwise <mul> ins(%4, %arg0 : !type, !type) outs(%1 : !type) -> !type
return %5, %6 : !type, !type
}
@@ -84,8 +84,8 @@ func.func @expect_no_fold_of_add_as_contraction_result_has_multiple_users(%arg0:
// CHECK: linalg.fill
// CHECK-NEXT: linalg.matmul
// CHECK-NEXT: linalg.matmul
-// CHECK-NEXT: linalg.elementwise kind=#linalg.elementwise_kind<add>
-// CHECK-NEXT: linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK-NEXT: linalg.elementwise <add>
+// CHECK-NEXT: linalg.elementwise <mul>
// CHECK-NEXT: return
module attributes {transform.with_named_sequence} {
@@ -107,7 +107,7 @@ func.func @fold_add_on_matmul_and_func_arg(%arg0: !type, %arg1: !type) -> !type
%1 = tensor.empty() : !type
%2 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%3 = linalg.matmul ins(%arg0, %0 : !type, !type) outs(%2 : !type) -> !type
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
+ %5 = linalg.elementwise <add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
return %5 : !type
}
@@ -135,7 +135,7 @@ func.func @expect_no_fold_of_add_as_operands_do_not_dominate_each_other(%arg0: !
%1 = tensor.empty() : !type
%2 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%3 = linalg.matmul ins(%arg0, %0 : !type, !type) outs(%2 : !type) -> !type
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %3 : !type, !type) outs(%1 : !type) -> !type
+ %4 = linalg.elementwise <add> ins(%3, %3 : !type, !type) outs(%1 : !type) -> !type
return %4 : !type
}
@@ -164,16 +164,16 @@ func.func @expect_no_fold_of_add_as_dominated_op_is_not_a_contraction(%arg0: !ty
%1 = tensor.empty() : !type
%2 = linalg.fill ins(%cst : f32) outs(%1 : !type) -> !type
%3 = linalg.matmul ins(%arg0, %0 : !type, !type) outs(%2 : !type) -> !type
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<sub> ins(%arg1, %0 : !type, !type) outs(%2 : !type) -> !type
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
+ %4 = linalg.elementwise <sub> ins(%arg1, %0 : !type, !type) outs(%2 : !type) -> !type
+ %5 = linalg.elementwise <add> ins(%3, %4 : !type, !type) outs(%1 : !type) -> !type
return %5 : !type
}
// CHECK-LABEL: func.func @expect_no_fold_of_add_as_dominated_op_is_not_a_contraction
// CHECK: linalg.fill
// CHECK-NEXT: linalg.matmul
-// CHECK-NEXT: linalg.elementwise kind=#linalg.elementwise_kind<sub>
-// CHECK-NEXT: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK-NEXT: linalg.elementwise <sub>
+// CHECK-NEXT: linalg.elementwise <add>
// CHECK-NEXT: return
module attributes {transform.with_named_sequence} {
@@ -206,7 +206,7 @@ func.func @expect_no_fold_of_add_as_dest_accumulation_is_not_identity_mapped(%ar
%6 = arith.addf %c, %5 : f32
linalg.yield %6 : f32
} -> !type
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
+ %4 = linalg.elementwise <add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
return %4 : !type
}
@@ -246,7 +246,7 @@ func.func @fold_add_on_a_generic_and_an_argument(%arg0: !type, %arg1: !type) ->
%6 = arith.addf %c, %5 : f32
linalg.yield %6 : f32
} -> !type
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
+ %4 = linalg.elementwise <add> ins(%3, %arg1 : !type, !type) outs(%1 : !type) -> !type
return %4 : !type
}
@@ -277,7 +277,7 @@ func.func @expect_no_fold_due_to_no_memref_support(%arg0: memref<2048x2048xf32>,
linalg.matmul ins(%arg0, %0 : memref<2048x2048xf32>, memref<2048x2048xf32>) outs(%alloc_0 : memref<2048x2048xf32>)
linalg.fill ins(%cst : f32) outs(%alloc : memref<2048x2048xf32>)
linalg.matmul ins(%arg1, %0 : memref<2048x2048xf32>, memref<2048x2048xf32>) outs(%alloc : memref<2048x2048xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%alloc_0, %alloc : memref<2048x2048xf32>, memref<2048x2048xf32>) outs(%alloc : memref<2048x2048xf32>)
+ linalg.elementwise <add> ins(%alloc_0, %alloc : memref<2048x2048xf32>, memref<2048x2048xf32>) outs(%alloc : memref<2048x2048xf32>)
memref.dealloc %alloc_0 : memref<2048x2048xf32>
return %alloc : memref<2048x2048xf32>
}
@@ -305,7 +305,7 @@ func.func @expect_no_fold_when_dominated_dest_is_block_arg(
%lhs: !type, %rhs: !type, %dest: !type, %other: !type) -> !type {
%0 = linalg.matmul ins(%lhs, %rhs : !type, !type) outs(%dest : !type) -> !type
%1 = tensor.empty() : !type
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %other : !type, !type) outs(%1 : !type) -> !type
+ %2 = linalg.elementwise <add> ins(%0, %other : !type, !type) outs(%1 : !type) -> !type
return %2 : !type
}
diff --git a/mlir/test/Dialect/Linalg/linalg-morph-elementwise-to-named.mlir b/mlir/test/Dialect/Linalg/linalg-morph-elementwise-to-named.mlir
index 2baae9a9714c7..c0fe0517cf56a 100644
--- a/mlir/test/Dialect/Linalg/linalg-morph-elementwise-to-named.mlir
+++ b/mlir/test/Dialect/Linalg/linalg-morph-elementwise-to-named.mlir
@@ -8,25 +8,25 @@
func.func @binary_ops_int(%A: tensor<?x?xi32>, %B: tensor<?x?xi32>,
%Out: tensor<?x?xi32>) -> tensor<?x?xi32> {
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %0 = linalg.elementwise <add>
ins(%A, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+ %1 = linalg.elementwise <sub>
ins(%0, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ %2 = linalg.elementwise <mul>
ins(%1, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<div>
+ %3 = linalg.elementwise <div>
ins(%2, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned>
+ %4 = linalg.elementwise <div_unsigned>
ins(%3, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %5 = linalg.elementwise <max_signed>
ins(%4, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
- %6 = linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+ %6 = linalg.elementwise <min_signed>
ins(%5, %B : tensor<?x?xi32>, tensor<?x?xi32>)
outs(%Out : tensor<?x?xi32>) -> tensor<?x?xi32>
return %6 : tensor<?x?xi32>
@@ -35,25 +35,25 @@ func.func @binary_ops_int(%A: tensor<?x?xi32>, %B: tensor<?x?xi32>,
// CHECK-LABEL: binary_ops_int
// CHECK-SAME: %[[A:.+]]: tensor<?x?xi32>, %[[B:.+]]: tensor<?x?xi32>,
// CHECK-SAME: %[[OUT:.+]]: tensor<?x?xi32>)
-// CHECK: %[[ADD:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[ADD:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: %[[SUB:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CHECK: %[[SUB:.+]] = linalg.elementwise <sub>
// CHECK-SAME: ins(%[[ADD]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: %[[MUL:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: %[[MUL:.+]] = linalg.elementwise <mul>
// CHECK-SAME: ins(%[[SUB]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: %[[DIV:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CHECK: %[[DIV:.+]] = linalg.elementwise <div>
// CHECK-SAME: ins(%[[MUL]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: %[[DIVU:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned>
+// CHECK: %[[DIVU:.+]] = linalg.elementwise <div_unsigned>
// CHECK-SAME: ins(%[[DIV]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: %[[MAX:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: %[[MAX:.+]] = linalg.elementwise <max_signed>
// CHECK-SAME: ins(%[[DIVU]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CHECK: linalg.elementwise <min_signed>
// CHECK-SAME: ins(%[[MAX]], %[[B]] : tensor<?x?xi32>, tensor<?x?xi32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xi32>) -> tensor<?x?xi32>
@@ -61,25 +61,25 @@ func.func @binary_ops_int(%A: tensor<?x?xi32>, %B: tensor<?x?xi32>,
func.func @binary_ops_float(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
%Out: tensor<?x?xf32>) -> tensor<?x?xf32> {
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %0 = linalg.elementwise <add>
ins(%A, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+ %1 = linalg.elementwise <sub>
ins(%0, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ %2 = linalg.elementwise <mul>
ins(%1, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<div>
+ %3 = linalg.elementwise <div>
ins(%2, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %4 = linalg.elementwise <max_signed>
ins(%3, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+ %5 = linalg.elementwise <min_signed>
ins(%4, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
- %6 = linalg.elementwise kind=#linalg.elementwise_kind<powf>
+ %6 = linalg.elementwise <powf>
ins(%5, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
return %6 : tensor<?x?xf32>
@@ -88,25 +88,25 @@ func.func @binary_ops_float(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
// CHECK-LABEL: binary_ops_float
// CHECK-SAME: %[[A:.+]]: tensor<?x?xf32>, %[[B:.+]]: tensor<?x?xf32>,
// CHECK-SAME: %[[OUT:.+]]: tensor<?x?xf32>)
-// CHECK: %[[ADD:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[ADD:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: %[[SUB:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CHECK: %[[SUB:.+]] = linalg.elementwise <sub>
// CHECK-SAME: ins(%[[ADD]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: %[[MUL:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: %[[MUL:.+]] = linalg.elementwise <mul>
// CHECK-SAME: ins(%[[SUB]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: %[[DIV:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CHECK: %[[DIV:.+]] = linalg.elementwise <div>
// CHECK-SAME: ins(%[[MUL]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: %[[MAX:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: %[[MAX:.+]] = linalg.elementwise <max_signed>
// CHECK-SAME: ins(%[[DIV]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: %[[MIN:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CHECK: %[[MIN:.+]] = linalg.elementwise <min_signed>
// CHECK-SAME: ins(%[[MAX]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<powf>
+// CHECK: linalg.elementwise <powf>
// CHECK-SAME: ins(%[[MIN]], %[[B]] : tensor<?x?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
@@ -115,7 +115,7 @@ func.func @binary_ops_float(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
// Non-identity indexing maps: should NOT be converted to named op.
func.func @non_identity_maps(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.elementwise
- kind=#linalg.elementwise_kind<exp>
+ <exp>
indexing_maps = [affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0, d1)>]
ins(%A : tensor<?xf32>) outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
@@ -123,7 +123,7 @@ func.func @non_identity_maps(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> tensor
// CHECK-LABEL: non_identity_maps
// CHECK-SAME: %[[A:.+]]: tensor<?xf32>, %[[OUT:.+]]: tensor<?x?xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
// CHECK-SAME: ins(%[[A]] : tensor<?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
@@ -131,13 +131,13 @@ func.func @non_identity_maps(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> tensor
// Kinds without named op equivalent: should NOT be converted.
func.func @no_named_op(%A: tensor<?x?xf32>, %Out: tensor<?x?xf32>) -> tensor<?x?xf32> {
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<sin>
+ %0 = linalg.elementwise <sin>
ins(%A : tensor<?x?xf32>) outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
// CHECK-LABEL: no_named_op
// CHECK-SAME: %[[A:.+]]: tensor<?x?xf32>, %[[OUT:.+]]: tensor<?x?xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sin>
+// CHECK: linalg.elementwise <sin>
// CHECK-SAME: ins(%[[A]] : tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
diff --git a/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir b/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir
index 2718378252403..0d60e5e5655dd 100644
--- a/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir
+++ b/mlir/test/Dialect/Linalg/match-ops-interpreter.mlir
@@ -842,15 +842,15 @@ module attributes { transform.with_named_sequence } {
// expected-remark @below {{op result}}
// expected-note @below {{value handle points to an op result #0}}
// expected-remark @below {{single user}}
- linalg.elementwise kind=#linalg.elementwise_kind<negf> ins(%2 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
+ linalg.elementwise <negf> ins(%2 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
// expected-remark @below {{matched result value}}
// expected-remark @below {{op result}}
// expected-note @below {{value handle points to an op result #0}}
- linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%3 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
+ linalg.elementwise <exp> ins(%3 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
// expected-remark @below {{matched result value}}
// expected-remark @below {{op result}}
// expected-note @below {{value handle points to an op result #0}}
- linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%3 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
+ linalg.elementwise <exp> ins(%3 : tensor<42x42xf32>) outs(%0 : tensor<42x42xf32>) -> tensor<42x42xf32>
return
}
}
diff --git a/mlir/test/Dialect/Linalg/reshape_fusion.mlir b/mlir/test/Dialect/Linalg/reshape_fusion.mlir
index 12980faa00f7e..874de9e14714a 100644
--- a/mlir/test/Dialect/Linalg/reshape_fusion.mlir
+++ b/mlir/test/Dialect/Linalg/reshape_fusion.mlir
@@ -688,7 +688,7 @@ func.func @linalg_add_reshape_consumer_fusion(%arg0 : tensor<?x?xf32>,
%sz1: index) ->
tensor<?x?x4x5xf32>
{
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %0 = linalg.elementwise <add> ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
%1 = tensor.expand_shape %0 [[0], [1, 2, 3]] output_shape [%sz0, %sz1, 4, 5] :
tensor<?x?xf32> into tensor<?x?x4x5xf32>
@@ -720,7 +720,7 @@ func.func @linalg_add_reshape_producer_fusion(%arg0 : tensor<?x7x?x8xf32>,
{
%0 = tensor.collapse_shape %arg0 [[0, 1], [2, 3]] :
tensor<?x7x?x8xf32> into tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
diff --git a/mlir/test/Dialect/Linalg/roundtrip-morphism-linalg-category-ops.mlir b/mlir/test/Dialect/Linalg/roundtrip-morphism-linalg-category-ops.mlir
index b9d7db6227816..63ecbf4e9278d 100644
--- a/mlir/test/Dialect/Linalg/roundtrip-morphism-linalg-category-ops.mlir
+++ b/mlir/test/Dialect/Linalg/roundtrip-morphism-linalg-category-ops.mlir
@@ -6,55 +6,55 @@
// RUN: | FileCheck %s
func.func @unary_ops(%A: memref<7x14x21xf32>, %Out: memref<7x14x21xf32>) {
- linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ linalg.elementwise <exp>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<log>
+ linalg.elementwise <log>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<abs>
+ linalg.elementwise <abs>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<ceil>
+ linalg.elementwise <ceil>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<floor>
+ linalg.elementwise <floor>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<negf>
+ linalg.elementwise <negf>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<reciprocal>
+ linalg.elementwise <reciprocal>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<round>
+ linalg.elementwise <round>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<sqrt>
+ linalg.elementwise <sqrt>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<rsqrt>
+ linalg.elementwise <rsqrt>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<square>
+ linalg.elementwise <square>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<tanh>
+ linalg.elementwise <tanh>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<erf>
+ linalg.elementwise <erf>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<sin>
+ linalg.elementwise <sin>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<cos>
+ linalg.elementwise <cos>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<tan>
+ linalg.elementwise <tan>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<acos>
+ linalg.elementwise <acos>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<acosh>
+ linalg.elementwise <acosh>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<asin>
+ linalg.elementwise <asin>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<asinh>
+ linalg.elementwise <asinh>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<atan>
+ linalg.elementwise <atan>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<atanh>
+ linalg.elementwise <atanh>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<log10>
+ linalg.elementwise <log10>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<log1p>
+ linalg.elementwise <log1p>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<log2>
+ linalg.elementwise <log2>
ins(%A : memref<7x14x21xf32>) outs(%Out : memref<7x14x21xf32>)
return
}
@@ -62,79 +62,79 @@ func.func @unary_ops(%A: memref<7x14x21xf32>, %Out: memref<7x14x21xf32>) {
// CHECK-LABEL: unary_ops
// CHECK-SAME: %[[A:.+]]: memref<7x14x21xf32>, %[[OUT:.+]]: memref<7x14x21xf32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<log>
+// CHECK: linalg.elementwise <log>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<abs>
+// CHECK: linalg.elementwise <abs>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<ceil>
+// CHECK: linalg.elementwise <ceil>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<floor>
+// CHECK: linalg.elementwise <floor>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<negf>
+// CHECK: linalg.elementwise <negf>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<reciprocal>
+// CHECK: linalg.elementwise <reciprocal>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<round>
+// CHECK: linalg.elementwise <round>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sqrt>
+// CHECK: linalg.elementwise <sqrt>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<rsqrt>
+// CHECK: linalg.elementwise <rsqrt>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<square>
+// CHECK: linalg.elementwise <square>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<tanh>
+// CHECK: linalg.elementwise <tanh>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CHECK: linalg.elementwise <erf>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sin>
+// CHECK: linalg.elementwise <sin>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<cos>
+// CHECK: linalg.elementwise <cos>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<tan>
+// CHECK: linalg.elementwise <tan>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<acos>
+// CHECK: linalg.elementwise <acos>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<acosh>
+// CHECK: linalg.elementwise <acosh>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<asin>
+// CHECK: linalg.elementwise <asin>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<asinh>
+// CHECK: linalg.elementwise <asinh>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<atan>
+// CHECK: linalg.elementwise <atan>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<atanh>
+// CHECK: linalg.elementwise <atanh>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<log10>
+// CHECK: linalg.elementwise <log10>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<log1p>
+// CHECK: linalg.elementwise <log1p>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<log2>
+// CHECK: linalg.elementwise <log2>
// CHECK-SAME: ins(%[[A]] : memref<7x14x21xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<7x14x21xf32>)
@@ -142,7 +142,7 @@ func.func @unary_ops(%A: memref<7x14x21xf32>, %Out: memref<7x14x21xf32>) {
func.func @unary_ops_non_identity(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.elementwise
- kind=#linalg.elementwise_kind<log>
+ <log>
indexing_maps = [affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>]
ins(%A : tensor<?xf32>) outs(%Out : tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
@@ -153,7 +153,7 @@ func.func @unary_ops_non_identity(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> t
// CHECK: unary_ops_non_identity
// CHECK-SAME: %[[A:.+]]: tensor<?xf32>, %[[OUT:.+]]: tensor<?x?xf32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<log>
+// CHECK: linalg.elementwise <log>
// CHECK-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_TP]]]
// CHECK-SAME: ins(%[[A]] : tensor<?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
@@ -162,19 +162,19 @@ func.func @unary_ops_non_identity(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> t
func.func @binary_ops_int(%A: memref<10xi32>, %B: memref<10xi32>,
%Out: memref<10xi32>) {
- linalg.elementwise kind=#linalg.elementwise_kind<add>
+ linalg.elementwise <add>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<sub>
+ linalg.elementwise <sub>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ linalg.elementwise <mul>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<div>
+ linalg.elementwise <div>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned>
+ linalg.elementwise <div_unsigned>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ linalg.elementwise <max_signed>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+ linalg.elementwise <min_signed>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
return
}
@@ -183,25 +183,25 @@ func.func @binary_ops_int(%A: memref<10xi32>, %B: memref<10xi32>,
// CHECK-SAME: %[[A:.+]]: memref<10xi32>, %[[B:.+]]: memref<10xi32>,
// CHECK-SAME: %[[OUT:.+]]: memref<10xi32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CHECK: linalg.elementwise <sub>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: linalg.elementwise <mul>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CHECK: linalg.elementwise <div>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned>
+// CHECK: linalg.elementwise <div_unsigned>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: linalg.elementwise <max_signed>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CHECK: linalg.elementwise <min_signed>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
@@ -209,19 +209,19 @@ func.func @binary_ops_int(%A: memref<10xi32>, %B: memref<10xi32>,
func.func @binary_ops_float(%A: memref<10xf32>, %B: memref<10xf32>,
%Out: memref<10xf32>) {
- linalg.elementwise kind=#linalg.elementwise_kind<add>
+ linalg.elementwise <add>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<sub>
+ linalg.elementwise <sub>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ linalg.elementwise <mul>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<div>
+ linalg.elementwise <div>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ linalg.elementwise <max_signed>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+ linalg.elementwise <min_signed>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
- linalg.elementwise kind=#linalg.elementwise_kind<powf>
+ linalg.elementwise <powf>
ins(%A, %B : memref<10xf32>, memref<10xf32>) outs(%Out : memref<10xf32>)
return
}
@@ -230,25 +230,25 @@ func.func @binary_ops_float(%A: memref<10xf32>, %B: memref<10xf32>,
// CHECK-SAME: %[[A:.+]]: memref<10xf32>, %[[B:.+]]: memref<10xf32>,
// CHECK-SAME: %[[OUT:.+]]: memref<10xf32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CHECK: linalg.elementwise <sub>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: linalg.elementwise <mul>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CHECK: linalg.elementwise <div>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: linalg.elementwise <max_signed>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CHECK: linalg.elementwise <min_signed>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<powf>
+// CHECK: linalg.elementwise <powf>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xf32>, memref<10xf32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xf32>)
@@ -256,16 +256,16 @@ func.func @binary_ops_float(%A: memref<10xf32>, %B: memref<10xf32>,
func.func @binary_ops_complex(%A: memref<10xcomplex<f32>>, %B: memref<10xcomplex<f32>>,
%Out: memref<10xcomplex<f32>>) {
- linalg.elementwise kind=#linalg.elementwise_kind<add>
+ linalg.elementwise <add>
ins(%A, %B : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
outs(%Out : memref<10xcomplex<f32>>)
- linalg.elementwise kind=#linalg.elementwise_kind<sub>
+ linalg.elementwise <sub>
ins(%A, %B : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
outs(%Out : memref<10xcomplex<f32>>)
- linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ linalg.elementwise <mul>
ins(%A, %B : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
outs(%Out : memref<10xcomplex<f32>>)
- linalg.elementwise kind=#linalg.elementwise_kind<div>
+ linalg.elementwise <div>
ins(%A, %B : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
outs(%Out : memref<10xcomplex<f32>>)
return
@@ -275,16 +275,16 @@ func.func @binary_ops_complex(%A: memref<10xcomplex<f32>>, %B: memref<10xcomplex
// CHECK-SAME: %[[A:.+]]: memref<10xcomplex<f32>>, %[[B:.+]]: memref<10xcomplex<f32>>,
// CHECK-SAME: %[[OUT:.+]]: memref<10xcomplex<f32>>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xcomplex<f32>>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CHECK: linalg.elementwise <sub>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xcomplex<f32>>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: linalg.elementwise <mul>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xcomplex<f32>>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CHECK: linalg.elementwise <div>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xcomplex<f32>>, memref<10xcomplex<f32>>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xcomplex<f32>>)
@@ -292,9 +292,9 @@ func.func @binary_ops_complex(%A: memref<10xcomplex<f32>>, %B: memref<10xcomplex
func.func @binary_ops_bool(%A: memref<10xi1>, %B: memref<10xi1>,
%Out: memref<10xi1>) {
- linalg.elementwise kind=#linalg.elementwise_kind<add>
+ linalg.elementwise <add>
ins(%A, %B : memref<10xi1>, memref<10xi1>) outs(%Out : memref<10xi1>)
- linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ linalg.elementwise <mul>
ins(%A, %B : memref<10xi1>, memref<10xi1>) outs(%Out : memref<10xi1>)
return
}
@@ -303,10 +303,10 @@ func.func @binary_ops_bool(%A: memref<10xi1>, %B: memref<10xi1>,
// CHECK-SAME: %[[A:.+]]: memref<10xi1>, %[[B:.+]]: memref<10xi1>,
// CHECK-SAME: %[[OUT:.+]]: memref<10xi1>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi1>, memref<10xi1>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi1>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CHECK: linalg.elementwise <mul>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi1>, memref<10xi1>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi1>)
@@ -314,9 +314,9 @@ func.func @binary_ops_bool(%A: memref<10xi1>, %B: memref<10xi1>,
func.func @binary_ops_uint(%A: memref<10xi32>, %B: memref<10xi32>,
%Out: memref<10xi32>) {
- linalg.elementwise kind=#linalg.elementwise_kind<max_unsigned>
+ linalg.elementwise <max_unsigned>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
- linalg.elementwise kind=#linalg.elementwise_kind<min_unsigned>
+ linalg.elementwise <min_unsigned>
ins(%A, %B : memref<10xi32>, memref<10xi32>) outs(%Out : memref<10xi32>)
return
}
@@ -325,10 +325,10 @@ func.func @binary_ops_uint(%A: memref<10xi32>, %B: memref<10xi32>,
// CHECK-SAME: %[[A:.+]]: memref<10xi32>, %[[B:.+]]: memref<10xi32>,
// CHECK-SAME: %[[OUT:.+]]: memref<10xi32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_unsigned>
+// CHECK: linalg.elementwise <max_unsigned>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_unsigned>
+// CHECK: linalg.elementwise <min_unsigned>
// CHECK-SAME: ins(%[[A]], %[[B]] : memref<10xi32>, memref<10xi32>)
// CHECK-SAME: outs(%[[OUT]] : memref<10xi32>)
@@ -337,7 +337,7 @@ func.func @binary_ops_uint(%A: memref<10xi32>, %B: memref<10xi32>,
func.func @binary_ops_non_identity(%A: tensor<?xf32>, %B: tensor<?x?xf32>,
%Out: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.elementwise
- kind=#linalg.elementwise_kind<add>
+ <add>
indexing_maps = [affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>,
affine_map<(d0, d1) -> (d0, d1)>]
ins(%A, %B : tensor<?xf32>, tensor<?x?xf32>)
@@ -352,7 +352,7 @@ func.func @binary_ops_non_identity(%A: tensor<?xf32>, %B: tensor<?x?xf32>,
// CHECK-SAME: %[[A:.+]]: tensor<?xf32>, %[[B:.+]]: tensor<?x?xf32>,
// CHECK-SAME: %[[OUT:.+]]: tensor<?x?xf32>)
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_TP]], #[[MAP_ID]]]
// CHECK-SAME: ins(%[[A]], %[[B]] : tensor<?xf32>, tensor<?x?xf32>)
// CHECK-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
diff --git a/mlir/test/Dialect/Linalg/scalable-unpack-producer-fusion.mlir b/mlir/test/Dialect/Linalg/scalable-unpack-producer-fusion.mlir
index 1bbc5add1f83b..f62d18573aaab 100644
--- a/mlir/test/Dialect/Linalg/scalable-unpack-producer-fusion.mlir
+++ b/mlir/test/Dialect/Linalg/scalable-unpack-producer-fusion.mlir
@@ -26,7 +26,7 @@ func.func @unpack_elemwise_scalable(%arg0: tensor<4x8x?x?xf32>, %arg1: tensor<?x
%1 = linalg.unpack %arg0 inner_dims_pos = [0, 1]
inner_tiles = [%c8_vscale, %c4_vscale] into %0
: tensor<4x8x?x?xf32> -> tensor<?x?xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1: tensor<?x?xf32>)
+ %2 = linalg.elementwise <exp> ins(%1: tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %2 : tensor<?x?xf32>
}
@@ -60,7 +60,7 @@ module attributes {transform.with_named_sequence} {
// ALIGNED: %[[UNPACK:.*]] = linalg.unpack %[[SRC]]
// ALIGNED-SAME: tensor<?x?x?x?xf32> -> tensor<?x?xf32>
// ALIGNED-NOT: tensor.extract_slice %[[UNPACK]]
- // ALIGNED: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
+ // ALIGNED: linalg.elementwise <exp> ins(%[[UNPACK]]
// ALIGNED: scf.yield
// ALIGNED: scf.yield
// ALIGNED: return %[[RES]]
@@ -87,7 +87,7 @@ module attributes {transform.with_named_sequence} {
// EQUAL: %[[UNPACK:.*]] = linalg.unpack
// EQUAL-SAME: tensor<1x1x?x?xf32> -> tensor<?x?xf32>
// EQUAL-NOT: tensor.extract_slice %[[UNPACK]]
- // EQUAL: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
+ // EQUAL: linalg.elementwise <exp> ins(%[[UNPACK]]
// EQUAL: scf.yield
// EQUAL: scf.yield
// EQUAL: return %[[RES]]
@@ -109,8 +109,8 @@ module attributes {transform.with_named_sequence} {
// UNALIGNED: %[[UNPACK:.*]] = linalg.unpack
// UNALIGNED-SAME: tensor<?x?x?x?xf32> -> tensor<?x?xf32>
// UNALIGNED: %[[EXTRACT:.*]] = tensor.extract_slice %[[UNPACK]]
- // UNALIGNED-NOT: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
- // UNALIGNED: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXTRACT]]
+ // UNALIGNED-NOT: linalg.elementwise <exp> ins(%[[UNPACK]]
+ // UNALIGNED: linalg.elementwise <exp> ins(%[[EXTRACT]]
// UNALIGNED: scf.yield
// UNALIGNED: scf.yield
// UNALIGNED: return %[[RES]]
@@ -151,7 +151,7 @@ func.func @fuse_unpack_into_containing(
: tensor<?x?xf32> to tensor<?x?xf32>
%oslice = tensor.extract_slice %o[%i, %j] [%c8_vscale_step, %c4_vscale_step] [1, 1]
: tensor<?x?xf32> to tensor<?x?xf32>
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%slice : tensor<?x?xf32>) outs(%oslice : tensor<?x?xf32>) -> tensor<?x?xf32>
+ %0 = linalg.elementwise <exp> ins(%slice : tensor<?x?xf32>) outs(%oslice : tensor<?x?xf32>) -> tensor<?x?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %0 into %o[%i, %j] [%c8_vscale_step, %c4_vscale_step] [1, 1]
: tensor<?x?xf32> into tensor<?x?xf32>
@@ -175,7 +175,7 @@ module attributes {transform.with_named_sequence} {
// EQUAL: %[[UNPACK:.+]] = linalg.unpack
// EQUAL-SAME: : tensor<1x1x?x?xf32> -> tensor<?x?xf32>
// EQUAL-NOT: tensor.extract_slice %[[UNPACK]]
- // EQUAL: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
+ // EQUAL: linalg.elementwise <exp> ins(%[[UNPACK]]
// No hint: general (unaligned) tiling with a trailing result slice.
transform.named_sequence @unaligned(%arg1: !transform.any_op {transform.readonly}) {
@@ -190,8 +190,8 @@ module attributes {transform.with_named_sequence} {
// UNALIGNED: %[[UNPACK:.+]] = linalg.unpack
// UNALIGNED-SAME: : tensor<?x?x?x?xf32> -> tensor<?x?xf32>
// UNALIGNED: %[[EXTRACTED:.+]] = tensor.extract_slice %[[UNPACK]]
- // UNALIGNED-NOT: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
- // UNALIGNED: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXTRACTED]]
+ // UNALIGNED-NOT: linalg.elementwise <exp> ins(%[[UNPACK]]
+ // UNALIGNED: linalg.elementwise <exp> ins(%[[EXTRACTED]]
// Aligned: the `Multiple` hints assert the containing loop's tile sizes are
// multiples of the inner tiles. Although the loop tile size and inner tile sizes
@@ -214,7 +214,7 @@ module attributes {transform.with_named_sequence} {
// ALIGNED: %[[UNPACK:.+]] = linalg.unpack
// ALIGNED-SAME: : tensor<?x?x?x?xf32> -> tensor<?x?xf32>
// ALIGNED-NOT: tensor.extract_slice %[[UNPACK]]
- // ALIGNED: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
+ // ALIGNED: linalg.elementwise <exp> ins(%[[UNPACK]]
// Dummy entry point so the default RUN line resolves here.
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
@@ -324,7 +324,7 @@ func.func @fuse_unpack_through_block_arg(
shared_outs(%o = %unpack) -> (tensor<?x?xf32>) {
%slice = tensor.extract_slice %o[%i, %j] [%c8_vscale, %c4_vscale] [1, 1]
: tensor<?x?xf32> to tensor<?x?xf32>
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%slice : tensor<?x?xf32>) outs(%slice : tensor<?x?xf32>) -> tensor<?x?xf32>
+ %0 = linalg.elementwise <exp> ins(%slice : tensor<?x?xf32>) outs(%slice : tensor<?x?xf32>) -> tensor<?x?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %0 into %o[%i, %j] [%c8_vscale, %c4_vscale] [1, 1]
: tensor<?x?xf32> into tensor<?x?xf32>
@@ -337,7 +337,7 @@ func.func @fuse_unpack_through_block_arg(
// CHECK: %[[UNPACK:.+]] = linalg.unpack
// CHECK-SAME: : tensor<1x1x?x?xf32> -> tensor<?x?xf32>
// CHECK-NOT: tensor.extract_slice %[[UNPACK]]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[UNPACK]]
+// CHECK: linalg.elementwise <exp> ins(%[[UNPACK]]
module attributes {transform.with_named_sequence} {
// The `Equal` hints assert the containing loop's tile sizes equal the unpack
diff --git a/mlir/test/Dialect/Linalg/specialize-generic-ops.mlir b/mlir/test/Dialect/Linalg/specialize-generic-ops.mlir
index 2ae01dff10107..0c6f3228c7d53 100644
--- a/mlir/test/Dialect/Linalg/specialize-generic-ops.mlir
+++ b/mlir/test/Dialect/Linalg/specialize-generic-ops.mlir
@@ -164,67 +164,67 @@ func.func @unary_ops(%A: tensor<?x?x?xf32>, %Out: tensor<?x?x?xf32>) -> tensor<?
// NAMED-NOT: linalg.elementwise
// NAMED: linalg.generic
-// CATEGORY: %[[RES4:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<floor>
+// CATEGORY: %[[RES4:.+]] = linalg.elementwise <floor>
// CATEGORY-SAME: ins(%[[A]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES5:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<negf>
+// CATEGORY: %[[RES5:.+]] = linalg.elementwise <negf>
// CATEGORY-SAME: ins(%[[RES4]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES6:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<reciprocal>
+// CATEGORY: %[[RES6:.+]] = linalg.elementwise <reciprocal>
// CATEGORY-SAME: ins(%[[RES5]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES7:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<round>
+// CATEGORY: %[[RES7:.+]] = linalg.elementwise <round>
// CATEGORY-SAME: ins(%[[RES6]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES8:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sqrt>
+// CATEGORY: %[[RES8:.+]] = linalg.elementwise <sqrt>
// CATEGORY-SAME: ins(%[[RES7]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES9:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<rsqrt>
+// CATEGORY: %[[RES9:.+]] = linalg.elementwise <rsqrt>
// CATEGORY-SAME: ins(%[[RES8]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES10:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<square>
+// CATEGORY: %[[RES10:.+]] = linalg.elementwise <square>
// CATEGORY-SAME: ins(%[[RES9]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES11:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<tanh>
+// CATEGORY: %[[RES11:.+]] = linalg.elementwise <tanh>
// CATEGORY-SAME: ins(%[[RES10]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES12:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CATEGORY: %[[RES12:.+]] = linalg.elementwise <erf>
// CATEGORY-SAME: ins(%[[RES11]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES13:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sin>
+// CATEGORY: %[[RES13:.+]] = linalg.elementwise <sin>
// CATEGORY-SAME: ins(%[[RES12]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES14:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<cos>
+// CATEGORY: %[[RES14:.+]] = linalg.elementwise <cos>
// CATEGORY-SAME: ins(%[[RES13]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES15:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<tan>
+// CATEGORY: %[[RES15:.+]] = linalg.elementwise <tan>
// CATEGORY-SAME: ins(%[[RES14]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES16:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<acos>
+// CATEGORY: %[[RES16:.+]] = linalg.elementwise <acos>
// CATEGORY-SAME: ins(%[[RES15]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES17:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<acosh>
+// CATEGORY: %[[RES17:.+]] = linalg.elementwise <acosh>
// CATEGORY-SAME: ins(%[[RES16]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES18:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<asin>
+// CATEGORY: %[[RES18:.+]] = linalg.elementwise <asin>
// CATEGORY-SAME: ins(%[[RES17]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES19:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<asinh>
+// CATEGORY: %[[RES19:.+]] = linalg.elementwise <asinh>
// CATEGORY-SAME: ins(%[[RES18]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES20:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<atan>
+// CATEGORY: %[[RES20:.+]] = linalg.elementwise <atan>
// CATEGORY-SAME: ins(%[[RES19]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES21:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<atanh>
+// CATEGORY: %[[RES21:.+]] = linalg.elementwise <atanh>
// CATEGORY-SAME: ins(%[[RES20]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES22:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<log10>
+// CATEGORY: %[[RES22:.+]] = linalg.elementwise <log10>
// CATEGORY-SAME: ins(%[[RES21]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES23:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<log1p>
+// CATEGORY: %[[RES23:.+]] = linalg.elementwise <log1p>
// CATEGORY-SAME: ins(%[[RES22]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
-// CATEGORY: %[[RES24:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<log2>
+// CATEGORY: %[[RES24:.+]] = linalg.elementwise <log2>
// CATEGORY-SAME: ins(%[[RES23]] : tensor<?x?x?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
@@ -253,7 +253,7 @@ func.func @unary_ops_non_identity(%A: tensor<?xf32>, %Out: tensor<?x?xf32>) -> t
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CATEGORY: linalg.elementwise <exp>
// CATEGORY-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_TP]]]
// CATEGORY-SAME: ins(%[[A]] : tensor<?xf32>)
// CATEGORY-SAME: outs(%[[OUT]] : tensor<?x?xf32>) -> tensor<?x?xf32>
@@ -328,22 +328,22 @@ func.func @binary_ops_int(%A: tensor<?x?xi32>, %B: tensor<?x?xi32>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: %[[RES1:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: %[[RES1:.+]] = linalg.elementwise <sub>
// CATEGORY-SAME: ins(%[[A]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES2:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CATEGORY: %[[RES2:.+]] = linalg.elementwise <mul>
// CATEGORY-SAME: ins(%[[RES1]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES3:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CATEGORY: %[[RES3:.+]] = linalg.elementwise <div>
// CATEGORY-SAME: ins(%[[RES2]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES4:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned>
+// CATEGORY: %[[RES4:.+]] = linalg.elementwise <div_unsigned>
// CATEGORY-SAME: ins(%[[RES3]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES5:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CATEGORY: %[[RES5:.+]] = linalg.elementwise <max_signed>
// CATEGORY-SAME: ins(%[[RES4]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES6:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CATEGORY: %[[RES6:.+]] = linalg.elementwise <min_signed>
// CATEGORY-SAME: ins(%[[RES5]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -417,22 +417,22 @@ func.func @binary_ops_float(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: %[[RES1:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: %[[RES1:.+]] = linalg.elementwise <sub>
// CATEGORY-SAME: ins(%[[A]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES2:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CATEGORY: %[[RES2:.+]] = linalg.elementwise <mul>
// CATEGORY-SAME: ins(%[[RES1]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES3:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CATEGORY: %[[RES3:.+]] = linalg.elementwise <div>
// CATEGORY-SAME: ins(%[[RES2]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES4:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CATEGORY: %[[RES4:.+]] = linalg.elementwise <max_signed>
// CATEGORY-SAME: ins(%[[RES3]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES5:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<min_signed>
+// CATEGORY: %[[RES5:.+]] = linalg.elementwise <min_signed>
// CATEGORY-SAME: ins(%[[RES4]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES6:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<powf>
+// CATEGORY: %[[RES6:.+]] = linalg.elementwise <powf>
// CATEGORY-SAME: ins(%[[RES5]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -481,13 +481,13 @@ func.func @binary_ops_complex(%A: tensor<?x?xcomplex<f32>>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: %[[RES1:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: %[[RES1:.+]] = linalg.elementwise <sub>
// CATEGORY-SAME: ins(%[[A]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES2:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CATEGORY: %[[RES2:.+]] = linalg.elementwise <mul>
// CATEGORY-SAME: ins(%[[RES1]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES3:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<div>
+// CATEGORY: %[[RES3:.+]] = linalg.elementwise <div>
// CATEGORY-SAME: ins(%[[RES2]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -516,7 +516,7 @@ func.func @binary_ops_bool(%A: tensor<?x?xi1>, %B: tensor<?x?xi1>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: %[[RES1:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CATEGORY: %[[RES1:.+]] = linalg.elementwise <mul>
// CATEGORY-SAME: ins(%[[A]], %[[B]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -579,7 +579,7 @@ func.func @binary_ops_non_identity(%A: tensor<?xf32>, %B: tensor<?x?xf32>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: linalg.elementwise <sub>
// CATEGORY-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_TP]], #[[MAP_ID]]]
// CATEGORY-SAME: ins(%[[A]], %[[B]] : [[TTY1D]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -623,10 +623,10 @@ func.func @binary_ops_swapped(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
// NAMED: linalg.generic
// CATEGORY-NOT: linalg.generic
-// CATEGORY: %[[RES0:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+// CATEGORY: %[[RES0:.+]] = linalg.elementwise <mul>
// CATEGORY-SAME: ins(%[[B]], %[[A]] : [[TTY]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
-// CATEGORY: %[[RES1:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: %[[RES1:.+]] = linalg.elementwise <sub>
// CATEGORY-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_ID]], #[[MAP_ID]]]
// CATEGORY-SAME: ins(%[[C]], %[[RES0]] : [[TTY1D]], [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -661,7 +661,7 @@ func.func @unary_op_with_scalar(%A: tensor<?xi32>, %Out: tensor<?xi32>)
// CATEGORY-NOT: linalg.generic
// CATEGORY: %[[CST:.+]] = arith.constant 123 : i32
-// CATEGORY: linalg.elementwise kind=#linalg.elementwise_kind<sub>
+// CATEGORY: linalg.elementwise <sub>
// CATEGORY-SAME: indexing_maps = [#[[MAP_BC]], #[[MAP_ID]], #[[MAP_ID]]]
// CATEGORY-SAME: ins(%[[CST]], %[[A]] : i32, [[TTY]])
// CATEGORY-SAME: outs(%[[OUT]] : [[TTY]]) -> [[TTY]]
@@ -690,7 +690,7 @@ func.func @negative_unary_op_using_block_arg_twice(%A: tensor<?xi32>,
// NAMED-NOT: linalg.add
// There is no scalar operand to hoist -> expect no change.
-// CATEGORY-NOT: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CATEGORY-NOT: linalg.elementwise <add>
// ALL: linalg.generic
diff --git a/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir b/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir
index 29a3a8ac7f95d..7f910b3b1e4fe 100644
--- a/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir
@@ -26,8 +26,8 @@ module {
// CHECK: %[[T1:.*]] = linalg.fill {{.*}} outs(%[[T0]]
%6 = tensor.extract_slice %0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- // CHECK: %[[T2:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[T1]]
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ // CHECK: %[[T2:.*]] = linalg.elementwise <exp> ins(%[[T1]]
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
}
@@ -76,8 +76,8 @@ module {
%4 = affine.min #map2(%arg3)[%arg0]
%5 = tensor.extract_slice %o[%3] [%4] [1] : tensor<64xf32> to tensor<?xf32>
- // CHECK: %[[T2:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[INIT_TENSOR]]
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%0 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ // CHECK: %[[T2:.*]] = linalg.elementwise <exp> ins(%[[INIT_TENSOR]]
+ %7 = linalg.elementwise <exp> ins(%0 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<64xf32>
}
@@ -177,8 +177,8 @@ module {
// CHECK: %[[T1:.*]] = linalg.fill {{.*}} outs(%[[T0]]
%6 = tensor.extract_slice %arg1[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- // CHECK: %[[T2:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> {{.*}} outs(%[[T1]]
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ // CHECK: %[[T2:.*]] = linalg.elementwise <exp> {{.*}} outs(%[[T1]]
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
}
@@ -228,8 +228,8 @@ module {
// CHECK: %[[T2:.*]] = linalg.fill {{.*}} outs(%[[T1]]
%6 = tensor.extract_slice %0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- // CHECK: %[[T3:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[T2]] : tensor<?xf32>) outs(%[[T0]] : tensor<?xf32>)
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ // CHECK: %[[T3:.*]] = linalg.elementwise <exp> ins(%[[T2]] : tensor<?xf32>) outs(%[[T0]] : tensor<?xf32>)
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
}
@@ -295,7 +295,7 @@ module {
%c2 = arith.constant 2 : index
%c1 = arith.constant 1 : index
%c0 = arith.constant 0 : index
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<abs> ins(%arg0 : tensor<?x?x?xf32>) outs(%arg1 : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
+ %0 = linalg.elementwise <abs> ins(%arg0 : tensor<?x?x?xf32>) outs(%arg1 : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
%dim = tensor.dim %arg1, %c0 : tensor<?x?x?xf32>
%dim_0 = tensor.dim %arg1, %c1 : tensor<?x?x?xf32>
%dim_1 = tensor.dim %arg1, %c2 : tensor<?x?x?xf32>
@@ -306,12 +306,12 @@ module {
%2 = scf.for %arg4 = %c0 to %dim_0 step %c1 iter_args(%arg5 = %arg3) -> (tensor<?x?x?xf32>) {
%3 = scf.for %arg6 = %c0 to %dim_1 step %c1 iter_args(%arg7 = %arg5) -> (tensor<?x?x?xf32>) {
// CHECK: %[[EX1:.*]] = tensor.extract_slice %[[BBARG2]]{{.*}}: tensor<?x?x?xf32> to tensor<1x1x1xf32>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<abs> ins({{.*}} : tensor<1x1x1xf32>) outs(%[[EX1]] : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
+ // CHECK: linalg.elementwise <abs> ins({{.*}} : tensor<1x1x1xf32>) outs(%[[EX1]] : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
// CHECK: %[[EX2:.*]] = tensor.extract_slice %[[BBARG2]]{{.*}} : tensor<?x?x?xf32> to tensor<1x1x1xf32>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins({{.*}} : tensor<1x1x1xf32>) outs(%[[EX2]] : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
+ // CHECK: linalg.elementwise <exp> ins({{.*}} : tensor<1x1x1xf32>) outs(%[[EX2]] : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
%extracted_slice = tensor.extract_slice %0[%arg2, %arg4, %arg6] [1, 1, 1] [1, 1, 1] : tensor<?x?x?xf32> to tensor<1x1x1xf32>
%extracted_slice_2 = tensor.extract_slice %arg7[%arg2, %arg4, %arg6] [1, 1, 1] [1, 1, 1] : tensor<?x?x?xf32> to tensor<1x1x1xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%extracted_slice : tensor<1x1x1xf32>) outs(%extracted_slice_2 : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
+ %4 = linalg.elementwise <exp> ins(%extracted_slice : tensor<1x1x1xf32>) outs(%extracted_slice_2 : tensor<1x1x1xf32>) -> tensor<1x1x1xf32>
%inserted_slice = tensor.insert_slice %4 into %arg7[%arg2, %arg4, %arg6] [1, 1, 1] [1, 1, 1] : tensor<1x1x1xf32> into tensor<?x?x?xf32>
scf.yield %inserted_slice : tensor<?x?x?xf32>
}
@@ -374,8 +374,8 @@ module {
// CHECK: %[[T1:.*]]:2 = linalg.generic {{.*}} ins(%[[T0]]
%6 = tensor.extract_slice %0#0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- // CHECK: %[[T2:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[T1]]#0
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ // CHECK: %[[T2:.*]] = linalg.elementwise <exp> ins(%[[T1]]#0
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
}
@@ -410,8 +410,8 @@ module {
%2 = tensor.extract_slice %0[%i][1][1] : tensor<2xf32> to tensor<1xf32>
%3 = tensor.extract_slice %arg1[%i][1][1] : tensor<2xf32> to tensor<1xf32>
// CHECK: %[[FUSED:.+]] = linalg.fill
- // CHECK: elementwise kind=#linalg.elementwise_kind<exp> ins(%[[FUSED]]
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%2 : tensor<1xf32>) outs(%3 : tensor<1xf32>) -> tensor<1xf32>
+ // CHECK: elementwise <exp> ins(%[[FUSED]]
+ %4 = linalg.elementwise <exp> ins(%2 : tensor<1xf32>) outs(%3 : tensor<1xf32>) -> tensor<1xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %4 into %arg1[%i][1][1] : tensor<1xf32> into tensor<2xf32>
}
@@ -480,7 +480,7 @@ module {
// CHECK: %[[T1:.*]]:2 = linalg.generic {{.*}}
%6 = tensor.extract_slice %0#0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
// CHECK: tensor.parallel_insert_slice %[[T1]]#0 into %[[ARG7]][%[[I0]]] [%[[I1]]] [1] : tensor<?xf32> into tensor<?xf32>
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
@@ -549,7 +549,7 @@ module {
// CHECK: %[[T1:.*]] = linalg.generic {{.*}}
%6 = tensor.extract_slice %0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
// CHECK: tensor.parallel_insert_slice %[[T1]] into %[[ARG7]][%[[I0]]] [%[[I1]]] [1] : tensor<?xf32> into tensor<?xf32>
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
@@ -616,7 +616,7 @@ module {
// CHECK: %[[T1:.*]] = linalg.generic {{.*}}
%6 = tensor.extract_slice %0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- %7 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
+ %7 = linalg.elementwise <exp> ins(%6 : tensor<?xf32>) outs(%5 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
// CHECK: tensor.parallel_insert_slice %[[T1]] into %[[ARG7]][%[[I0]]] [%[[I1]]] [1] : tensor<?xf32> into tensor<?xf32>
tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
@@ -692,7 +692,7 @@ module {
// CHECK: %[[T2:.*]] = linalg.generic {{.*}}
%7 = tensor.extract_slice %1[%4] [%5] [1] : tensor<?xf32> to tensor<?xf32>
- %8 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%7 : tensor<?xf32>) outs(%6 : tensor<?xf32>) -> tensor<?xf32>
+ %8 = linalg.elementwise <exp> ins(%7 : tensor<?xf32>) outs(%6 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
// CHECK: tensor.parallel_insert_slice %[[T2]] into %[[ARG7]][%[[I0]]] [%[[I1]]] [1] : tensor<?xf32> into tensor<?xf32>
tensor.parallel_insert_slice %8 into %o[%2] [%5] [1] : tensor<?xf32> into tensor<?xf32>
diff --git a/mlir/test/Dialect/Linalg/transform-op-fuse.mlir b/mlir/test/Dialect/Linalg/transform-op-fuse.mlir
index d172d50d6e03c..538e5765cdc23 100644
--- a/mlir/test/Dialect/Linalg/transform-op-fuse.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-fuse.mlir
@@ -5,12 +5,12 @@ func.func @fuse_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -31,16 +31,16 @@ func.func @fuse_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<
// CHECK: %[[PARTIAL_RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: %[[RES:.*]] = scf.for {{.*}}%[[PARTIAL_RES]]
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -62,12 +62,12 @@ func.func @fuse_unary_param(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> t
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -91,12 +91,12 @@ module attributes {transform.with_named_sequence} {
func.func @fuse_unary_forall(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<?x?xf32> {
// CHECK: %[[RES:.*]] = scf.forall
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -117,12 +117,12 @@ func.func @fuse_unary_packed_tile_sizes(%arg0: tensor<?x?xf32>, %arg1: tensor<?x
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -148,12 +148,12 @@ module attributes {transform.with_named_sequence} {
func.func @fuse_unary_packed_tile_sizes_forall(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<?x?xf32> {
// CHECK: %[[RES:.*]] = scf.forall
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -186,9 +186,9 @@ func.func @fuse_unary_packed_tile_sizes_multiple_targets(
// CHECK: scf.for
// CHECK: linalg.elementwise
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %0 = linalg.elementwise <add> ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -214,12 +214,12 @@ module attributes {transform.with_named_sequence} {
func.func @fuse_no_tiling_packed_tile_sizes(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<?x?xf32> {
// CHECK-NOT: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: %[[RES:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: %[[RES:.*]] = linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %1 = linalg.elementwise <add> ins(%0, %arg0 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %1 : tensor<?x?xf32>
}
@@ -287,13 +287,13 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
// CHECK: linalg.unpack
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
// CHECK: return %[[RES]]
func.func @unpack_elemwise(%arg0: tensor<16x48x8x8xf32>, %arg1: tensor<128x384xf32>) -> tensor<128x384xf32> {
%0 = tensor.empty() : tensor<128x384xf32>
%1 = linalg.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %0
: tensor<16x48x8x8xf32> -> tensor<128x384xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1: tensor<128x384xf32>)
+ %2 = linalg.elementwise <exp> ins(%1: tensor<128x384xf32>)
outs(%arg1: tensor<128x384xf32>) -> tensor<128x384xf32>
return %2 : tensor<128x384xf32>
}
@@ -313,13 +313,13 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
// CHECK: linalg.pack
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
// CHECK: return %[[RES]]
func.func @pack_elemwise(%arg0: tensor<128x384xf32>, %arg1: tensor<16x48x8x8xf32>) -> tensor<16x48x8x8xf32> {
%0 = tensor.empty() : tensor<16x48x8x8xf32>
%1 = linalg.pack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %0
: tensor<128x384xf32> -> tensor<16x48x8x8xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1: tensor<16x48x8x8xf32>)
+ %2 = linalg.elementwise <exp> ins(%1: tensor<16x48x8x8xf32>)
outs(%arg1: tensor<16x48x8x8xf32>) -> tensor<16x48x8x8xf32>
return %2 : tensor<16x48x8x8xf32>
}
@@ -339,13 +339,13 @@ module attributes {transform.with_named_sequence} {
// CHECK: linalg.pack
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
// CHECK: return %[[RES]]
func.func @nofuse_pack_elemwise(%arg0: tensor<128x384xf32>, %arg1: tensor<16x48x8x8xf32>) -> tensor<16x48x8x8xf32> {
%0 = tensor.empty() : tensor<16x48x8x8xf32>
%1 = linalg.pack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %0
: tensor<128x384xf32> -> tensor<16x48x8x8xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1: tensor<16x48x8x8xf32>)
+ %2 = linalg.elementwise <exp> ins(%1: tensor<16x48x8x8xf32>)
outs(%arg1: tensor<16x48x8x8xf32>) -> tensor<16x48x8x8xf32>
return %2 : tensor<16x48x8x8xf32>
}
@@ -366,17 +366,17 @@ func.func @fuse_through_slice(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) ->
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg0: tensor<?x?xf32>) -> tensor<?x?xf32>
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%dim0 = tensor.dim %arg1, %c0 : tensor<?x?xf32>
%dim1 = tensor.dim %arg1, %c1 : tensor<?x?xf32>
%1 = tensor.extract_slice %0 [1, 1] [%dim0, %dim1] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %2 = linalg.elementwise <add> ins(%1, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %2 : tensor<?x?xf32>
}
@@ -397,10 +397,10 @@ func.func @fuse_through_slice_and_cast_chain(%arg0: tensor<100x100xf32>, %arg1:
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<100x100xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<100x100xf32>)
outs(%arg0: tensor<100x100xf32>) -> tensor<100x100xf32>
%1 = tensor.cast %0 : tensor<100x100xf32> to tensor<100x?xf32>
%2 = tensor.extract_slice %1 [1, 1] [98, 98] [1, 1] : tensor<100x?xf32> to tensor<98x98xf32>
@@ -410,7 +410,7 @@ func.func @fuse_through_slice_and_cast_chain(%arg0: tensor<100x100xf32>, %arg1:
%dim0 = tensor.dim %arg1, %c0 : tensor<?x?xf32>
%dim1 = tensor.dim %arg1, %c1 : tensor<?x?xf32>
%4 = tensor.extract_slice %3 [1, 1] [%dim0, %dim1] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%4, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %5 = linalg.elementwise <add> ins(%4, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %5 : tensor<?x?xf32>
}
@@ -433,8 +433,8 @@ func.func @fuse_unrelated_slices(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>)
// CHECK: %[[SLICE2:.+]] = tensor.extract_slice %[[SLICE1]]
// CHECK: %[[RES:.*]] = scf.for
// CHECK: scf.for
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: linalg.elementwise <exp>
+ // CHECK: linalg.elementwise <add>
// CHECK: return %[[RES]], %[[SLICE2]]
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
@@ -442,10 +442,10 @@ func.func @fuse_unrelated_slices(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>)
%dim1 = tensor.dim %arg1, %c1 : tensor<?x?xf32>
%slice1 = tensor.extract_slice %arg0 [1, 1] [%dim0, %dim1] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
%slice2 = tensor.extract_slice %slice1 [1, 1] [10, 10] [1, 1] : tensor<?x?xf32> to tensor<10x10xf32>
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg0: tensor<?x?xf32>) -> tensor<?x?xf32>
%1 = tensor.extract_slice %0 [1, 1] [%dim0, %dim1] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
+ %2 = linalg.elementwise <add> ins(%1, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %2, %slice2 : tensor<?x?xf32>, tensor<10x10xf32>
}
@@ -468,11 +468,11 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[LINEAR_IDX:.+]] = affine.linearize_index disjoint [%[[X]], %[[Y]], %[[Z]]] by (2, 3, 10)
// CHECK: %[[SLICE:.+]] = tensor.extract_slice %{{.*}}[%[[LINEAR_IDX]]] [5] [1] : tensor<60xf32> to tensor<5xf32>
// CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[SLICE]] {{\[\[}}0, 1, 2]] output_shape [1, 1, 5]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXPAND]]
+// CHECK: linalg.elementwise <exp> ins(%[[EXPAND]]
func.func @bubble_up_extract_slice_through_expand_shape(%0: tensor<60xf32>) -> tensor<2x3x10xf32> {
%expand = tensor.expand_shape %0 [[0, 1, 2]] output_shape [2, 3, 10] : tensor<60xf32> into tensor<2x3x10xf32>
%empty = tensor.empty() : tensor<2x3x10xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<2x3x10xf32>) outs(%empty : tensor<2x3x10xf32>) -> tensor<2x3x10xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<2x3x10xf32>) outs(%empty : tensor<2x3x10xf32>) -> tensor<2x3x10xf32>
return %exp : tensor<2x3x10xf32>
}
@@ -493,11 +493,11 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[LINEAR_IDX:.+]] = affine.linearize_index disjoint [%[[X]], %[[Y]]{{.*}} by (3, 4, 10)
// CHECK: %[[SLICE:.+]] = tensor.extract_slice %{{.*}}[%[[LINEAR_IDX]]] [20] [1] : tensor<120xf32> to tensor<20xf32>
// CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[SLICE]] {{\[\[}}0, 1, 2]] output_shape [1, 2, 10]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXPAND]]
+// CHECK: linalg.elementwise <exp> ins(%[[EXPAND]]
func.func @bubble_up_extract_slice_through_expand_shape_full_inner_dim(%0: tensor<120xf32>) -> tensor<3x4x10xf32> {
%expand = tensor.expand_shape %0 [[0, 1, 2]] output_shape [3, 4, 10] : tensor<120xf32> into tensor<3x4x10xf32>
%empty = tensor.empty() : tensor<3x4x10xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<3x4x10xf32>) outs(%empty : tensor<3x4x10xf32>) -> tensor<3x4x10xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<3x4x10xf32>) outs(%empty : tensor<3x4x10xf32>) -> tensor<3x4x10xf32>
return %exp : tensor<3x4x10xf32>
}
@@ -517,11 +517,11 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for
// CHECK: scf.for
// CHECK: scf.for
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
func.func @no_bubble_up_extract_slice_through_expand_shape_non_contiguous(%0: tensor<120xf32>) -> tensor<3x4x10xf32> {
%expand = tensor.expand_shape %0 [[0, 1, 2]] output_shape [3, 4, 10] : tensor<120xf32> into tensor<3x4x10xf32>
%empty = tensor.empty() : tensor<3x4x10xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<3x4x10xf32>) outs(%empty : tensor<3x4x10xf32>) -> tensor<3x4x10xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<3x4x10xf32>) outs(%empty : tensor<3x4x10xf32>) -> tensor<3x4x10xf32>
return %exp : tensor<3x4x10xf32>
}
@@ -546,12 +546,12 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[LINEAR_IDX1:.+]] = affine.linearize_index disjoint [%[[Z]], %[[W]]] by (7, 8)
// CHECK: %[[SLICE:.+]] = tensor.extract_slice %{{.*}}[%[[LINEAR_IDX0]], %[[LINEAR_IDX1]]] [20, 4] [1, 1] : tensor<120x56xf32> to tensor<20x4xf32>
// CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[SLICE]] {{\[\[}}0, 1, 2], [3, 4]] output_shape [1, 2, 10, 1, 4]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXPAND]]
+// CHECK: linalg.elementwise <exp> ins(%[[EXPAND]]
module {
func.func @bubble_up_extract_slice_through_expand_shape_multiple_expanded_dims(%0: tensor<120x56xf32>) -> tensor<3x4x10x7x8xf32> {
%expand = tensor.expand_shape %0 [[0, 1, 2], [3, 4]] output_shape [3, 4, 10, 7, 8] : tensor<120x56xf32> into tensor<3x4x10x7x8xf32>
%empty = tensor.empty() : tensor<3x4x10x7x8xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<3x4x10x7x8xf32>) outs(%empty : tensor<3x4x10x7x8xf32>) -> tensor<3x4x10x7x8xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<3x4x10x7x8xf32>) outs(%empty : tensor<3x4x10x7x8xf32>) -> tensor<3x4x10x7x8xf32>
return %exp : tensor<3x4x10x7x8xf32>
}
}
@@ -571,16 +571,16 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for %[[X:[A-Za-z0-9]+]] = {{.*}}
// CHECK: %[[LINEAR_IDX:.+]] = affine.linearize_index disjoint [%[[X]], {{.*}} by (8, 32)
// CHECK: %[[SLICE:.+]] = tensor.extract_slice %{{.*}}[0, 0, %[[LINEAR_IDX]]] [1, 1800, 32] [1, 1, 1] : tensor<1x1800x256xf32> to tensor<1x1800x32xf32>
-// CHECK: %[[ABS:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<abs> ins(%[[SLICE]]
+// CHECK: %[[ABS:.+]] = linalg.elementwise <abs> ins(%[[SLICE]]
// CHECK: %[[EXPAND:.+]] = tensor.expand_shape %[[ABS]] {{\[\[}}0], [1], [2, 3]] output_shape [1, 1800, 1, 32]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[EXPAND]]
+// CHECK: linalg.elementwise <exp> ins(%[[EXPAND]]
module {
func.func @bubble_up_extract_slice_through_expand_shape_and_fuse_with_expand_producer(%0: tensor<1x1800x256xf32>) -> tensor<1x1800x8x32xf32> {
%empty1 = tensor.empty() : tensor<1x1800x256xf32>
- %exp1 = linalg.elementwise kind=#linalg.elementwise_kind<abs> ins(%0 : tensor<1x1800x256xf32>) outs(%empty1 : tensor<1x1800x256xf32>) -> tensor<1x1800x256xf32>
+ %exp1 = linalg.elementwise <abs> ins(%0 : tensor<1x1800x256xf32>) outs(%empty1 : tensor<1x1800x256xf32>) -> tensor<1x1800x256xf32>
%expand = tensor.expand_shape %exp1 [[0], [1], [2, 3]] output_shape [1, 1800, 8, 32] : tensor<1x1800x256xf32> into tensor<1x1800x8x32xf32>
%empty2 = tensor.empty() : tensor<1x1800x8x32xf32>
- %exp2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<1x1800x8x32xf32>) outs(%empty2 : tensor<1x1800x8x32xf32>) -> tensor<1x1800x8x32xf32>
+ %exp2 = linalg.elementwise <exp> ins(%expand : tensor<1x1800x8x32xf32>) outs(%empty2 : tensor<1x1800x8x32xf32>) -> tensor<1x1800x8x32xf32>
return %exp2 : tensor<1x1800x8x32xf32>
}
}
@@ -602,11 +602,11 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for %[[Y:[A-Za-z0-9]+]] = {{.*}}
// CHECK: scf.for %[[Z:[A-Za-z0-9]+]] = {{.*}}
// CHECK: %[[SLICE:.+]] = tensor.extract_slice %[[EXPAND]]{{.*}} [1, 1, 5] [1, 1, 1] : tensor<2x3x10xf32> to tensor<1x1x5xf32>
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[SLICE]]
+// CHECK: linalg.elementwise <exp> ins(%[[SLICE]]
func.func @no_bubble_up_extract_slice_through_expand_shape_on_cleanup_false(%0: tensor<60xf32>) -> tensor<2x3x10xf32> {
%expand = tensor.expand_shape %0 [[0, 1, 2]] output_shape [2, 3, 10] : tensor<60xf32> into tensor<2x3x10xf32>
%empty = tensor.empty() : tensor<2x3x10xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<2x3x10xf32>) outs(%empty : tensor<2x3x10xf32>) -> tensor<2x3x10xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<2x3x10xf32>) outs(%empty : tensor<2x3x10xf32>) -> tensor<2x3x10xf32>
return %exp : tensor<2x3x10xf32>
}
@@ -625,11 +625,11 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for %[[X:[A-Za-z0-9]+]] = {{.*}} -> (tensor<8x1800x32xf32>) {
// CHECK: %[[EXTRACT:.*]] = tensor.extract_slice
// CHECK: %[[COLLAPSE:.*]] = tensor.collapse_shape %[[EXTRACT]]
-// CHECK: %[[EXP1:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[COLLAPSE]]
+// CHECK: %[[EXP1:.*]] = linalg.elementwise <exp> ins(%[[COLLAPSE]]
func.func @bubble_up_extract_slice_through_collapse_shape(%0: tensor<1x8x1800x32xf32>) -> tensor<8x1800x32xf32> {
%expand = tensor.collapse_shape %0 [[0, 1], [2], [3]] : tensor<1x8x1800x32xf32> into tensor<8x1800x32xf32>
%empty = tensor.empty() : tensor<8x1800x32xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<8x1800x32xf32>) outs(%empty : tensor<8x1800x32xf32>) -> tensor<8x1800x32xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<8x1800x32xf32>) outs(%empty : tensor<8x1800x32xf32>) -> tensor<8x1800x32xf32>
return %exp : tensor<8x1800x32xf32>
}
@@ -647,15 +647,15 @@ module attributes {transform.with_named_sequence} {
// CHECK-LABEL: func.func @bubble_up_extract_slice_through_collapse_shape_with_collapse_producer(
// CHECK: scf.for %[[X:[A-Za-z0-9]+]] = {{.*}}
// CHECK: %[[EXTRACT:.*]] = tensor.extract_slice
-// CHECK: %[[ABS:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<abs> ins(%[[EXTRACT]]
+// CHECK: %[[ABS:.*]] = linalg.elementwise <abs> ins(%[[EXTRACT]]
// CHECK: %[[COLLAPSE:.*]] = tensor.collapse_shape %[[ABS]]
-// CHECK: %[[EXP:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[COLLAPSE]]
+// CHECK: %[[EXP:.*]] = linalg.elementwise <exp> ins(%[[COLLAPSE]]
func.func @bubble_up_extract_slice_through_collapse_shape_with_collapse_producer(%0: tensor<1x8x1800x32xf32>) -> tensor<8x1800x32xf32> {
%empty1 = tensor.empty() : tensor<1x8x1800x32xf32>
- %abs = linalg.elementwise kind=#linalg.elementwise_kind<abs> ins(%0 : tensor<1x8x1800x32xf32>) outs(%empty1 : tensor<1x8x1800x32xf32>) -> tensor<1x8x1800x32xf32>
+ %abs = linalg.elementwise <abs> ins(%0 : tensor<1x8x1800x32xf32>) outs(%empty1 : tensor<1x8x1800x32xf32>) -> tensor<1x8x1800x32xf32>
%expand = tensor.collapse_shape %abs [[0, 1], [2], [3]] : tensor<1x8x1800x32xf32> into tensor<8x1800x32xf32>
%empty2 = tensor.empty() : tensor<8x1800x32xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%expand : tensor<8x1800x32xf32>) outs(%empty2 : tensor<8x1800x32xf32>) -> tensor<8x1800x32xf32>
+ %exp = linalg.elementwise <exp> ins(%expand : tensor<8x1800x32xf32>) outs(%empty2 : tensor<8x1800x32xf32>) -> tensor<8x1800x32xf32>
return %exp : tensor<8x1800x32xf32>
}
@@ -677,7 +677,7 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for
// CHECK: tensor.extract_slice %{{.*}} [2] [1] : tensor<4xf32> to tensor<2xf32>
// CHECK: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: linalg.elementwise <exp>
func.func @fuse_producer_semi_affine_aligned(%arg0: tensor<12xf32>, %scale: tensor<4xf32>, %init: tensor<12xf32>, %out: tensor<12xf32>) -> tensor<12xf32> {
%0 = linalg.generic {indexing_maps = [#id, #floordiv3, #id], iterator_types = ["parallel"]}
ins(%arg0, %scale : tensor<12xf32>, tensor<4xf32>) outs(%init : tensor<12xf32>) {
@@ -685,7 +685,7 @@ func.func @fuse_producer_semi_affine_aligned(%arg0: tensor<12xf32>, %scale: tens
%m = arith.addf %a, %s : f32
linalg.yield %m : f32
} -> tensor<12xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%0 : tensor<12xf32>) outs(%out : tensor<12xf32>) -> tensor<12xf32>
+ %1 = linalg.elementwise <exp> ins(%0 : tensor<12xf32>) outs(%out : tensor<12xf32>) -> tensor<12xf32>
return %1 : tensor<12xf32>
}
@@ -713,7 +713,7 @@ func.func @negative_fuse_producer_semi_affine_misaligned(%arg0: tensor<12xf32>,
%m = arith.addf %a, %s : f32
linalg.yield %m : f32
} -> tensor<12xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%0 : tensor<12xf32>) outs(%out : tensor<12xf32>) -> tensor<12xf32>
+ %1 = linalg.elementwise <exp> ins(%0 : tensor<12xf32>) outs(%out : tensor<12xf32>) -> tensor<12xf32>
return %1 : tensor<12xf32>
}
diff --git a/mlir/test/Dialect/Linalg/transform-op-generalize.mlir b/mlir/test/Dialect/Linalg/transform-op-generalize.mlir
index 957212d050837..2a59c066008b3 100644
--- a/mlir/test/Dialect/Linalg/transform-op-generalize.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-generalize.mlir
@@ -3,9 +3,9 @@
// CHECK-LABEL: func.func @generalize_unary
func.func @generalize_unary(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>) -> tensor<?x?xf32> {
- // CHECK-NOT: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ // CHECK-NOT: linalg.elementwise <exp>
// CHECK: linalg.generic
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<?x?xf32>)
+ %0 = linalg.elementwise <exp> ins(%arg0 : tensor<?x?xf32>)
outs(%arg1: tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
diff --git a/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir b/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir
index cd3756b40fd7f..befc8e259e8e7 100644
--- a/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir
@@ -257,11 +257,11 @@ module attributes {transform.with_named_sequence} {
// CHECK-LABEL: func @already_destination_passing_style(
// CHECK-SAME: %[[ARG0:.*]]: tensor<134217728xf32>, %[[ARG1:.*]]: tensor<134217728xf32>) -> tensor<134217728xf32>
-// CHECK: %[[RESULT:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%[[ARG0]], %[[ARG1]] : tensor<134217728xf32>, tensor<134217728xf32>)
+// CHECK: %[[RESULT:.*]] = linalg.elementwise <add> ins(%[[ARG0]], %[[ARG1]] : tensor<134217728xf32>, tensor<134217728xf32>)
// CHECK-SAME: outs(%[[ARG0]] : tensor<134217728xf32>) -> tensor<134217728xf32>
// CHECK: return %[[RESULT]] : tensor<134217728xf32>
func.func @already_destination_passing_style(%arg0: tensor<134217728xf32>, %arg1: tensor<134217728xf32>) -> tensor<134217728xf32> {
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1 : tensor<134217728xf32>, tensor<134217728xf32>) outs(%arg0 : tensor<134217728xf32>) -> tensor<134217728xf32>
+ %0 = linalg.elementwise <add> ins(%arg0, %arg1 : tensor<134217728xf32>, tensor<134217728xf32>) outs(%arg0 : tensor<134217728xf32>) -> tensor<134217728xf32>
return %0 : tensor<134217728xf32>
}
diff --git a/mlir/test/Dialect/Linalg/transform-op-specialize-elemwise-binary.mlir b/mlir/test/Dialect/Linalg/transform-op-specialize-elemwise-binary.mlir
index 4c5694b2d5da3..8bb5c0aca4474 100644
--- a/mlir/test/Dialect/Linalg/transform-op-specialize-elemwise-binary.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-specialize-elemwise-binary.mlir
@@ -12,7 +12,7 @@ func.func @specialize_sub_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %a
// CHECK-LABEL: specialize_sub_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_mul_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %arg2: tensor<?x?xi32>) -> tensor<?x?xi32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi32>, tensor<?x?xi32>) outs(%arg2 : tensor<?x?xi32>) {
@@ -25,7 +25,7 @@ func.func @specialize_mul_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %a
// CHECK-LABEL: specialize_mul_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_div_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %arg2: tensor<?x?xi32>) -> tensor<?x?xi32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi32>, tensor<?x?xi32>) outs(%arg2 : tensor<?x?xi32>) {
@@ -38,7 +38,7 @@ func.func @specialize_div_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %a
// CHECK-LABEL: specialize_div_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_div_unsigned_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %arg2: tensor<?x?xi32>) -> tensor<?x?xi32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi32>, tensor<?x?xi32>) outs(%arg2 : tensor<?x?xi32>) {
@@ -51,7 +51,7 @@ func.func @specialize_div_unsigned_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?
// CHECK-LABEL: specialize_div_unsigned_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div_unsigned> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <div_unsigned> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_max_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %arg2: tensor<?x?xi32>) -> tensor<?x?xi32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi32>, tensor<?x?xi32>) outs(%arg2 : tensor<?x?xi32>) {
@@ -64,7 +64,7 @@ func.func @specialize_max_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %a
// CHECK-LABEL: specialize_max_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <max_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_min_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %arg2: tensor<?x?xi32>) -> tensor<?x?xi32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi32>, tensor<?x?xi32>) outs(%arg2 : tensor<?x?xi32>) {
@@ -77,7 +77,7 @@ func.func @specialize_min_int(%arg0: tensor<?x?xi32>, %arg1: tensor<?x?xi32>, %a
// CHECK-LABEL: specialize_min_int
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi32>, %[[ARG1:.+]]: tensor<?x?xi32>, %[[ARG2:.+]]: tensor<?x?xi32>) -> tensor<?x?xi32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
+// CHECK: linalg.elementwise <min_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi32>, tensor<?x?xi32>) outs(%[[ARG2]] : tensor<?x?xi32>) -> tensor<?x?xi32>
func.func @specialize_sub_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -90,7 +90,7 @@ func.func @specialize_sub_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_sub_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_mul_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -103,7 +103,7 @@ func.func @specialize_mul_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_mul_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_div_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -116,7 +116,7 @@ func.func @specialize_div_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_div_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_max_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -129,7 +129,7 @@ func.func @specialize_max_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_max_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <max_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_min_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -142,7 +142,7 @@ func.func @specialize_min_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_min_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<min_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <min_signed> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_powf_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -155,7 +155,7 @@ func.func @specialize_powf_float(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>,
// CHECK-LABEL: specialize_powf_float
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<powf> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <powf> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
func.func @specialize_sub_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor<?x?xcomplex<f32>>, %arg2: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%arg2 : tensor<?x?xcomplex<f32>>) {
@@ -168,7 +168,7 @@ func.func @specialize_sub_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor
// CHECK-LABEL: specialize_sub_complex
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG1:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG2:.+]]: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
+// CHECK: linalg.elementwise <sub> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
func.func @specialize_mul_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor<?x?xcomplex<f32>>, %arg2: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%arg2 : tensor<?x?xcomplex<f32>>) {
@@ -181,7 +181,7 @@ func.func @specialize_mul_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor
// CHECK-LABEL: specialize_mul_complex
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG1:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG2:.+]]: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
+// CHECK: linalg.elementwise <mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
func.func @specialize_div_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor<?x?xcomplex<f32>>, %arg2: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%arg2 : tensor<?x?xcomplex<f32>>) {
@@ -194,7 +194,7 @@ func.func @specialize_div_complex(%arg0: tensor<?x?xcomplex<f32>>, %arg1: tensor
// CHECK-LABEL: specialize_div_complex
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG1:.+]]: tensor<?x?xcomplex<f32>>, %[[ARG2:.+]]: tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
+// CHECK: linalg.elementwise <div> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xcomplex<f32>>, tensor<?x?xcomplex<f32>>) outs(%[[ARG2]] : tensor<?x?xcomplex<f32>>) -> tensor<?x?xcomplex<f32>>
func.func @specialize_mul_bool(%arg0: tensor<?x?xi1>, %arg1: tensor<?x?xi1>, %arg2: tensor<?x?xi1>) -> tensor<?x?xi1> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xi1>, tensor<?x?xi1>) outs(%arg2 : tensor<?x?xi1>) {
@@ -207,7 +207,7 @@ func.func @specialize_mul_bool(%arg0: tensor<?x?xi1>, %arg1: tensor<?x?xi1>, %ar
// CHECK-LABEL: specialize_mul_bool
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xi1>, %[[ARG1:.+]]: tensor<?x?xi1>, %[[ARG2:.+]]: tensor<?x?xi1>) -> tensor<?x?xi1>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi1>, tensor<?x?xi1>) outs(%[[ARG2]] : tensor<?x?xi1>) -> tensor<?x?xi1>
+// CHECK: linalg.elementwise <mul> ins(%[[ARG0]], %[[ARG1]] : tensor<?x?xi1>, tensor<?x?xi1>) outs(%[[ARG2]] : tensor<?x?xi1>) -> tensor<?x?xi1>
func.func @specialize_sub_swapped_operands(%arg0: tensor<?x?xf32>, %arg1: tensor<?x?xf32>, %arg2: tensor<?x?xf32>) -> tensor<?x?xf32> {
%0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) {
@@ -220,7 +220,7 @@ func.func @specialize_sub_swapped_operands(%arg0: tensor<?x?xf32>, %arg1: tensor
// CHECK-LABEL: specialize_sub_swapped_operands
// CHECK-SAME: %[[ARG0:.+]]: tensor<?x?xf32>, %[[ARG1:.+]]: tensor<?x?xf32>, %[[ARG2:.+]]: tensor<?x?xf32>) -> tensor<?x?xf32>
// CHECK-NOT: linalg.generic
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<sub> ins(%[[ARG1]], %[[ARG0]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
+// CHECK: linalg.elementwise <sub> ins(%[[ARG1]], %[[ARG0]] : tensor<?x?xf32>, tensor<?x?xf32>) outs(%[[ARG2]] : tensor<?x?xf32>) -> tensor<?x?xf32>
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir
index a7f11aae3461f..6467359d2fa55 100644
--- a/mlir/test/Dialect/SCF/canonicalize.mlir
+++ b/mlir/test/Dialect/SCF/canonicalize.mlir
@@ -2170,7 +2170,7 @@ module {
%4 = affine.min #map2(%arg3)[%dim, %arg0]
%extracted_slice0 = tensor.extract_slice %arg4[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
%extracted_slice1 = tensor.extract_slice %arg5[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%extracted_slice0 : tensor<?xf32>) outs(%extracted_slice1 : tensor<?xf32>) -> tensor<?xf32>
+ %5 = linalg.elementwise <exp> ins(%extracted_slice0 : tensor<?xf32>) outs(%extracted_slice1 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %5 into %arg5[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
}
@@ -2184,7 +2184,7 @@ module {
// CHECK-SAME: shared_outs(%[[ITER_ARG_5:.*]] = %[[ARG2]]) -> (tensor<?xf32>) {
// CHECK: %[[OPERAND0:.*]] = tensor.extract_slice %[[ARG1]]
// CHECK: %[[OPERAND1:.*]] = tensor.extract_slice %[[ITER_ARG_5]]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[OPERAND0]] : tensor<?xf32>) outs(%[[OPERAND1]] : tensor<?xf32>) -> tensor<?xf32>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp> ins(%[[OPERAND0]] : tensor<?xf32>) outs(%[[OPERAND1]] : tensor<?xf32>) -> tensor<?xf32>
// CHECK: scf.forall.in_parallel {
// CHECK-NEXT: tensor.parallel_insert_slice %[[ELEM]] into %[[ITER_ARG_5]]
// CHECK-NEXT: }
@@ -2210,7 +2210,7 @@ module {
%extracted_slice_0 = tensor.extract_slice %arg6[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
%extracted_slice_1 = tensor.extract_slice %arg7[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
%extracted_slice_2 = tensor.extract_slice %0[%3] [%4] [1] : tensor<?xf32> to tensor<?xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%extracted_slice : tensor<?xf32>) outs(%extracted_slice_1 : tensor<?xf32>) -> tensor<?xf32>
+ %5 = linalg.elementwise <exp> ins(%extracted_slice : tensor<?xf32>) outs(%extracted_slice_1 : tensor<?xf32>) -> tensor<?xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %5 into %arg6[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
tensor.parallel_insert_slice %extracted_slice into %arg5[%3] [%4] [1] : tensor<?xf32> into tensor<?xf32>
@@ -2227,7 +2227,7 @@ module {
// CHECK-SAME: shared_outs(%[[ITER_ARG_6:.*]] = %[[ARG2]]) -> (tensor<?xf32>) {
// CHECK: %[[OPERAND0:.*]] = tensor.extract_slice %[[ARG1]]
// CHECK: %[[OPERAND1:.*]] = tensor.extract_slice %[[ARG3]]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%[[OPERAND0]] : tensor<?xf32>) outs(%[[OPERAND1]] : tensor<?xf32>) -> tensor<?xf32>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp> ins(%[[OPERAND0]] : tensor<?xf32>) outs(%[[OPERAND1]] : tensor<?xf32>) -> tensor<?xf32>
// CHECK: scf.forall.in_parallel {
// CHECK-NEXT: tensor.parallel_insert_slice %[[ELEM]] into %[[ITER_ARG_6]]
// CHECK-NEXT: }
diff --git a/mlir/test/Dialect/SCF/parallel-loop-unroll.mlir b/mlir/test/Dialect/SCF/parallel-loop-unroll.mlir
index 6e02074d18475..591a94b00a674 100644
--- a/mlir/test/Dialect/SCF/parallel-loop-unroll.mlir
+++ b/mlir/test/Dialect/SCF/parallel-loop-unroll.mlir
@@ -69,7 +69,7 @@ func.func @unroll_outer_nested_parallel_loop(%src: memref<5x16x12x4x4xf32>, %dst
%1 = affine.apply affine_map<(d0, d1) -> (d0 + (d1 floordiv 4) * 4)>(%arg5, %arg7)
%subv_in = memref.subview %src[%arg3, %0, %1, 0, 0] [1, 1, 1, 4, 4] [1, 1, 1, 1, 1] : memref<5x16x12x4x4xf32> to memref<4x4xf32, strided<[4, 1], offset: ?>>
%subv_out = memref.subview %dst[%arg3, %0, %1, 0, 0] [1, 1, 1, 4, 4] [1, 1, 1, 1, 1] : memref<5x16x12x4x4xf32> to memref<4x4xf32, strided<[4, 1], offset: ?>>
- linalg.elementwise kind=#linalg.elementwise_kind<erf> ins(%subv_in : memref<4x4xf32, strided<[4, 1], offset: ?>>) outs(%subv_out : memref<4x4xf32, strided<[4, 1], offset: ?>>)
+ linalg.elementwise <erf> ins(%subv_in : memref<4x4xf32, strided<[4, 1], offset: ?>>) outs(%subv_out : memref<4x4xf32, strided<[4, 1], offset: ?>>)
scf.reduce
}
scf.reduce
@@ -91,13 +91,13 @@ func.func @unroll_outer_nested_parallel_loop(%src: memref<5x16x12x4x4xf32>, %dst
// CHECK: scf.parallel ([[INV0:%.*]], [[INV1:%.*]]) = ([[C0]], [[C0]]) to ([[C4]], [[C4]]) step ([[C1]], [[C1]])
// CHECK: affine.apply {{.*}}([[OUTV1]], [[INV0]])
// CHECK: affine.apply {{.*}}([[OUTV2]], [[INV1]])
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CHECK: linalg.elementwise <erf>
// CHECK: [[UNR_OUTV2:%.*]] = affine.apply {{.*}}([[OUTV2]])
// CHECK: scf.parallel ([[INV0B:%.*]], [[INV1B:%.*]]) = ([[C0]], [[C0]]) to ([[C4]], [[C4]]) step ([[C1]], [[C1]])
// CHECK: affine.apply {{.*}}([[OUTV1]], [[INV0B]])
// CHECK: affine.apply {{.*}}([[UNR_OUTV2]], [[INV1B]])
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CHECK: linalg.elementwise <erf>
// -----
@@ -141,7 +141,7 @@ func.func @unroll_inner_nested_parallel_loop(%src: memref<5x16x12x4x4xf32>, %dst
%1 = affine.apply affine_map<(d0, d1) -> (d0 + (d1 floordiv 4) * 4)>(%arg5, %arg7)
%subv_in = memref.subview %src[%arg3, %0, %1, 0, 0] [1, 1, 1, 4, 4] [1, 1, 1, 1, 1] : memref<5x16x12x4x4xf32> to memref<4x4xf32, strided<[4, 1], offset: ?>>
%subv_out = memref.subview %dst[%arg3, %0, %1, 0, 0] [1, 1, 1, 4, 4] [1, 1, 1, 1, 1] : memref<5x16x12x4x4xf32> to memref<4x4xf32, strided<[4, 1], offset: ?>>
- linalg.elementwise kind=#linalg.elementwise_kind<erf> ins(%subv_in : memref<4x4xf32, strided<[4, 1], offset: ?>>) outs(%subv_out : memref<4x4xf32, strided<[4, 1], offset: ?>>)
+ linalg.elementwise <erf> ins(%subv_in : memref<4x4xf32, strided<[4, 1], offset: ?>>) outs(%subv_out : memref<4x4xf32, strided<[4, 1], offset: ?>>)
scf.reduce
}
scf.reduce
@@ -163,9 +163,9 @@ func.func @unroll_inner_nested_parallel_loop(%src: memref<5x16x12x4x4xf32>, %dst
// CHECK-UNROLL-INNER: scf.parallel ([[INV0:%.*]], [[INV1:%.*]]) = ([[C0]], [[C0]]) to ([[C4]], [[C4]]) step ([[C1]], [[C2]])
// CHECK-UNROLL-INNER: affine.apply {{.*}}([[OUTV1]], [[INV0]])
// CHECK-UNROLL-INNER: affine.apply {{.*}}([[OUTV2]], [[INV1]])
-// CHECK-UNROLL-INNER: linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CHECK-UNROLL-INNER: linalg.elementwise <erf>
// CHECK-UNROLL-INNER: [[UNR_INV1:%.*]] = affine.apply {{.*}}([[INV1]])
// CHECK-UNROLL-INNER: affine.apply {{.*}}([[OUTV1]], [[INV0]])
// CHECK-UNROLL-INNER: affine.apply {{.*}}([[OUTV2]], [[UNR_INV1]])
-// CHECK-UNROLL-INNER: linalg.elementwise kind=#linalg.elementwise_kind<erf>
+// CHECK-UNROLL-INNER: linalg.elementwise <erf>
diff --git a/mlir/test/Dialect/SparseTensor/encoding_with_symbols.mlir b/mlir/test/Dialect/SparseTensor/encoding_with_symbols.mlir
index 83ec42ec80422..415ff8ad183c2 100644
--- a/mlir/test/Dialect/SparseTensor/encoding_with_symbols.mlir
+++ b/mlir/test/Dialect/SparseTensor/encoding_with_symbols.mlir
@@ -17,8 +17,8 @@ func.func @tensor_add(%arg0: tensor<8x8xf32, #Sparse>) -> tensor<8x8xf32> {
%result_out = tensor.empty() : tensor<8x8xf32>
// CHECK: %[[ALLOC:.*]] = memref.alloc() alignment = 64 : memref<8x8xf32>
- // CHECK: %[[RES:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%{{.*}}, %{{.*}} : tensor<8x8xf32, #[[$SPARSE_1]]>, tensor<8x8xf32, #[[$SPARSE_1]]>)
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ // CHECK: %[[RES:.*]] = linalg.elementwise <add> ins(%{{.*}}, %{{.*}} : tensor<8x8xf32, #[[$SPARSE_1]]>, tensor<8x8xf32, #[[$SPARSE_1]]>)
+ %result = linalg.elementwise <add>
ins(%arg0, %arg0 : tensor<8x8xf32, #Sparse>, tensor<8x8xf32, #Sparse>)
outs(%result_out : tensor<8x8xf32>) -> tensor<8x8xf32>
diff --git a/mlir/test/Dialect/SparseTensor/external_after_codegen.mlir b/mlir/test/Dialect/SparseTensor/external_after_codegen.mlir
index f5934ceb84e4f..ff6d306450400 100644
--- a/mlir/test/Dialect/SparseTensor/external_after_codegen.mlir
+++ b/mlir/test/Dialect/SparseTensor/external_after_codegen.mlir
@@ -23,7 +23,7 @@ func.func @storage_specifier_passthrough(%arg0: tensor<32x32xf32, #CSR>,
%init = tensor.empty() : tensor<32x32xf32>
%out = linalg.fill ins(%cst : f32) outs(%init : tensor<32x32xf32>)
-> tensor<32x32xf32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %3 = linalg.elementwise <add>
ins(%arg0, %arg1 : tensor<32x32xf32, #CSR>, tensor<32x32xf32, #CSR>)
outs(%out : tensor<32x32xf32>) -> tensor<32x32xf32>
return %3 : tensor<32x32xf32>
diff --git a/mlir/test/Dialect/Transform/test-promote-tensors.mlir b/mlir/test/Dialect/Transform/test-promote-tensors.mlir
index 60876e49628d3..3fbf9e6effbda 100644
--- a/mlir/test/Dialect/Transform/test-promote-tensors.mlir
+++ b/mlir/test/Dialect/Transform/test-promote-tensors.mlir
@@ -36,7 +36,7 @@ func.func @promote_out(%arg0: tensor<?x42xf32>, %arg1: tensor<?x42xf32>, %arg2:
// CHECK: %[[ALLOC:.+]] = bufferization.alloc_tensor(%[[DIM0]], %[[DIM1]]) <{memory_space = 1 : i64}>
// CHECK-NOT: materialize_in_destination
// CHECK: linalg.elementwise {{.*}} outs(%[[ALLOC]]
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1 : tensor<?x42xf32>, tensor<?x42xf32>)
+ %0 = linalg.elementwise <add> ins(%arg0, %arg1 : tensor<?x42xf32>, tensor<?x42xf32>)
outs(%arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
@@ -72,8 +72,8 @@ func.func @promote_in0_out_bufferize(%arg0: tensor<?x42xf32>, %arg1: tensor<42x?
// CHECK: %{{.+}} = memref.dim %{{.+}}, %{{.+}} : memref<?x42xf32, strided<[?, ?], offset: ?>>
// CHECK: %[[ALLOC_IN:.+]] = memref.alloc(%{{.+}}) alignment = 64 : memref<?x42xf32, 1>
// CHECK: memref.copy %[[IN0]], %[[ALLOC_IN]] : memref<?x42xf32, strided<[?, ?], offset: ?>> to memref<?x42xf32, 1>
- // CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%[[ALLOC_IN]], %[[IN1]] : memref<?x42xf32, 1>, memref<42x?xf32, strided<[?, ?], offset: ?>>) outs(%[[ALLOC_OUT]] : memref<?x?xf32, 1>)
- %0 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1: tensor<?x42xf32>, tensor<42x?xf32>)
+ // CHECK: linalg.elementwise <add> ins(%[[ALLOC_IN]], %[[IN1]] : memref<?x42xf32, 1>, memref<42x?xf32, strided<[?, ?], offset: ?>>) outs(%[[ALLOC_OUT]] : memref<?x?xf32, 1>)
+ %0 = linalg.elementwise <add> ins(%arg0, %arg1: tensor<?x42xf32>, tensor<42x?xf32>)
outs(%arg2: tensor<?x?xf32>) -> tensor<?x?xf32>
return %0 : tensor<?x?xf32>
}
diff --git a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir
index d8b8039631de9..6f2257c360e07 100644
--- a/mlir/test/Examples/transform/Ch1/invalidation-1.mlir
+++ b/mlir/test/Examples/transform/Ch1/invalidation-1.mlir
@@ -39,13 +39,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
@@ -88,13 +88,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
diff --git a/mlir/test/Examples/transform/Ch1/invalidation-2.mlir b/mlir/test/Examples/transform/Ch1/invalidation-2.mlir
index f72131ed02919..0e7238ef4f16a 100644
--- a/mlir/test/Examples/transform/Ch1/invalidation-2.mlir
+++ b/mlir/test/Examples/transform/Ch1/invalidation-2.mlir
@@ -23,13 +23,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// Elementwise addition.
// expected-note @below {{ancestor payload op}}
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
diff --git a/mlir/test/Examples/transform/Ch1/sequence.mlir b/mlir/test/Examples/transform/Ch1/sequence.mlir
index e0aa750e94367..709c32060e69e 100644
--- a/mlir/test/Examples/transform/Ch1/sequence.mlir
+++ b/mlir/test/Examples/transform/Ch1/sequence.mlir
@@ -20,13 +20,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
@@ -34,7 +34,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// CHECK: func @outlined
// CHECK: linalg.matmul
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: linalg.elementwise <add>
// CHECK-LABEL: func @fc_relu
// CHECK: scf.forall
@@ -48,7 +48,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// CHECK-NOT: linalg.matmul
// CHECK-NOT: linalg.elementwise
// CHECK: scf.forall.in_parallel
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: linalg.elementwise <max_signed>
// CHECK: scf.forall.in_parallel
// Declaration of the "microkernel" function that we will be targeting.
diff --git a/mlir/test/Examples/transform/Ch2/sequence.mlir b/mlir/test/Examples/transform/Ch2/sequence.mlir
index 253bdc4d1bbd0..db956f10f5b6b 100644
--- a/mlir/test/Examples/transform/Ch2/sequence.mlir
+++ b/mlir/test/Examples/transform/Ch2/sequence.mlir
@@ -20,13 +20,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
@@ -44,7 +44,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// CHECK-NOT: linalg.matmul
// CHECK-NOT: linalg.elementwise
// CHECK: scf.forall.in_parallel
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: linalg.elementwise <max_signed>
// CHECK: scf.forall.in_parallel
// Declaration of the "microkernel" function that we will be targeting.
diff --git a/mlir/test/Examples/transform/Ch3/sequence.mlir b/mlir/test/Examples/transform/Ch3/sequence.mlir
index 73d0fa81b24d2..28bd94146721d 100644
--- a/mlir/test/Examples/transform/Ch3/sequence.mlir
+++ b/mlir/test/Examples/transform/Ch3/sequence.mlir
@@ -20,13 +20,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise addition.
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
@@ -44,7 +44,7 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// CHECK-NOT: linalg.matmul
// CHECK-NOT: linalg.elementwise
// CHECK: scf.forall.in_parallel
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+// CHECK: linalg.elementwise <max_signed>
// CHECK: scf.forall.in_parallel
// Declaration of the "microkernel" function that we will be targeting.
diff --git a/mlir/test/Examples/transform/Ch4/multiple.mlir b/mlir/test/Examples/transform/Ch4/multiple.mlir
index e6ab5ca65235d..5045d07febf8f 100644
--- a/mlir/test/Examples/transform/Ch4/multiple.mlir
+++ b/mlir/test/Examples/transform/Ch4/multiple.mlir
@@ -12,14 +12,14 @@ func.func @fc_relu_operands_00(
// Elementwise addition.
// expected-remark @below {{add # 0}}
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
// expected-remark @below {{max # 0}}
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
@@ -37,14 +37,14 @@ func.func @fc_relu_operands_01(
// Elementwise addition.
// expected-remark @below {{add # 1}}
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
// expected-remark @below {{max # 1}}
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%c0f, %biased : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
diff --git a/mlir/test/Examples/transform/Ch4/sequence.mlir b/mlir/test/Examples/transform/Ch4/sequence.mlir
index 7dd725dfe6884..c84ae4ff0368a 100644
--- a/mlir/test/Examples/transform/Ch4/sequence.mlir
+++ b/mlir/test/Examples/transform/Ch4/sequence.mlir
@@ -22,14 +22,14 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
// Elementwise addition.
// expected-remark @below {{elementwise binary}}
- %biased = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %biased = linalg.elementwise <add>
ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
// Elementwise max with 0 (ReLU).
%c0f = arith.constant dense<0.0> : tensor<512x512xf32>
// expected-remark @below {{elementwise binary}}
- %relued = linalg.elementwise kind=#linalg.elementwise_kind<max_signed>
+ %relued = linalg.elementwise <max_signed>
ins(%biased, %c0f : tensor<512x512xf32>, tensor<512x512xf32>)
outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
func.return %relued : tensor<512x512xf32>
diff --git a/mlir/test/Interfaces/TilingInterface/query-fusability.mlir b/mlir/test/Interfaces/TilingInterface/query-fusability.mlir
index fbde870807ce8..64520efadfc79 100644
--- a/mlir/test/Interfaces/TilingInterface/query-fusability.mlir
+++ b/mlir/test/Interfaces/TilingInterface/query-fusability.mlir
@@ -9,7 +9,7 @@ func.func @fusable_with_matching_offsets(%arg0: tensor<10x20xf32>, %arg1: tensor
%slice1 = tensor.insert_slice %arg1 into %dest[%c0, %c0] [10, 20] [1, 1] : tensor<10x20xf32> into tensor<100x200xf32>
// expected-remark @+1 {{can be fused with producer tensor.insert_slice ops}}
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%slice0, %slice1 : tensor<100x200xf32>, tensor<100x200xf32>)
+ %result = linalg.elementwise <add> ins(%slice0, %slice1 : tensor<100x200xf32>, tensor<100x200xf32>)
outs(%dest : tensor<100x200xf32>) -> tensor<100x200xf32>
return %result : tensor<100x200xf32>
@@ -34,7 +34,7 @@ func.func @not_fusable_with_different_offsets(%arg0: tensor<10x20xf32>, %arg1: t
%slice1 = tensor.insert_slice %arg1 into %dest[%c10, %c20] [10, 20] [1, 1] : tensor<10x20xf32> into tensor<100x200xf32>
// expected-remark @+1 {{cannot be fused with producer tensor.insert_slice ops}}
- %result = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%slice0, %slice1 : tensor<100x200xf32>, tensor<100x200xf32>)
+ %result = linalg.elementwise <add> ins(%slice0, %slice1 : tensor<100x200xf32>, tensor<100x200xf32>)
outs(%dest : tensor<100x200xf32>) -> tensor<100x200xf32>
return %result : tensor<100x200xf32>
@@ -52,7 +52,7 @@ module attributes {transform.with_named_sequence} {
func.func @fusable_with_consumer_extract_slice(%arg0: tensor<100x200xf32>, %arg1: tensor<100x200xf32>, %dest: tensor<100x200xf32>) -> tensor<10x20xf32> {
// expected-remark @+1 {{can be fused with consumer tensor.extract_slice op}}
- %add = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%arg0, %arg1 : tensor<100x200xf32>, tensor<100x200xf32>)
+ %add = linalg.elementwise <add> ins(%arg0, %arg1 : tensor<100x200xf32>, tensor<100x200xf32>)
outs(%dest : tensor<100x200xf32>) -> tensor<100x200xf32>
%c0 = arith.constant 0 : index
diff --git a/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer-using-slices.mlir b/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer-using-slices.mlir
index 5e733cd4d25eb..e8eabe60802ef 100644
--- a/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer-using-slices.mlir
+++ b/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer-using-slices.mlir
@@ -19,7 +19,7 @@ module {
}
%in_operand_2 = tensor.empty() : tensor<64xf32>
%out_operand_3 = tensor.empty() : tensor<64xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1#1, %in_operand_2 : tensor<64xf32>, tensor<64xf32>) outs(%out_operand_3 : tensor<64xf32>) -> tensor<64xf32>
+ %2 = linalg.elementwise <add> ins(%1#1, %in_operand_2 : tensor<64xf32>, tensor<64xf32>) outs(%out_operand_3 : tensor<64xf32>) -> tensor<64xf32>
return %2 : tensor<64xf32>
}
}
@@ -76,7 +76,7 @@ module {
}
%in_operand_2 = tensor.empty() : tensor<64x64xf32>
%out_operand_3 = tensor.empty() : tensor<64x64xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1#1, %in_operand_2 : tensor<64x64xf32>, tensor<64x64xf32>) outs(%out_operand_3 : tensor<64x64xf32>) -> tensor<64x64xf32>
+ %2 = linalg.elementwise <add> ins(%1#1, %in_operand_2 : tensor<64x64xf32>, tensor<64x64xf32>) outs(%out_operand_3 : tensor<64x64xf32>) -> tensor<64x64xf32>
return %2 : tensor<64x64xf32>
}
}
@@ -459,7 +459,7 @@ func.func @fuse_pack_consumer_if_single_iteration(%arg0: tensor<4x4xf32>) -> ten
%3 = affine.min #map(%arg1)
%extracted_slice = tensor.extract_slice %arg0[%arg1, 0] [%3, 4] [1, 1] : tensor<4x4xf32> to tensor<?x4xf32>
%extracted_slice_0 = tensor.extract_slice %arg2[%arg1, 0] [%3, 4] [1, 1] : tensor<4x4xf32> to tensor<?x4xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%extracted_slice : tensor<?x4xf32>) outs(%extracted_slice_0 : tensor<?x4xf32>) -> tensor<?x4xf32>
+ %4 = linalg.elementwise <exp> ins(%extracted_slice : tensor<?x4xf32>) outs(%extracted_slice_0 : tensor<?x4xf32>) -> tensor<?x4xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %4 into %arg2[%arg1, 0] [%3, 4] [1, 1] : tensor<?x4xf32> into tensor<4x4xf32>
}
@@ -488,7 +488,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-DAG: %[[SIZE:.+]] = affine.min #[[MAP]](%[[IV]])
// CHECK-DAG: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][%[[IV]], 0] [%[[SIZE]], 4] [1, 1]
// CHECK-DAG: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[ELEM_OUT_ARG]][%[[IV]], 0] [%[[SIZE]], 4] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[TILED_PACK_DEST:.*]] = tensor.extract_slice %[[PACK_OUT_ARG]][%[[IV]], 0, 0, 0] [1, 4, 16, 1] [1, 1, 1, 1]
@@ -506,7 +506,7 @@ func.func @fuse_perfect_tiling_pack_consumer_with_outer_dims_perm(%arg0: tensor<
%0 = scf.forall (%arg3) = (0) to (32) step (16) shared_outs(%arg4 = %arg1) -> (tensor<64x32xf32>) {
%src = tensor.extract_slice %arg0[0, %arg3] [64, 16] [1, 1] : tensor<64x32xf32> to tensor<64x16xf32>
%dest = tensor.extract_slice %arg4[0, %arg3] [64, 16] [1, 1] : tensor<64x32xf32> to tensor<64x16xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
+ %1 = linalg.elementwise <exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %1 into %arg4[0, %arg3] [64, 16] [1, 1] : tensor<64x16xf32> into tensor<64x32xf32>
}
@@ -532,7 +532,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: shared_outs(%[[FIRST_OUT_ARG:.*]] = %[[ARG1]], %[[PACK_OUT_ARG:.*]] = %[[ARG2]])
// CHECK: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][0, %[[IV]]] [64, 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[FIRST_OUT_ARG]][0, %[[IV]]] [64, 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[PACK_RESULT_OFFSET:.*]] = affine.apply #[[PACK_RESULT_MAP]](%[[IV]])
@@ -555,7 +555,7 @@ func.func @fuse_pack_consumer_with_no_pad_dynamic_dim(%arg0: tensor<64x?xf32>, %
%0 = scf.forall (%arg2) = (0) to (%d1) step (16) shared_outs(%arg3 = %arg1) -> (tensor<64x?xf32>) {
%src = tensor.extract_slice %arg0[0, %arg2] [64, 16] [1, 1] : tensor<64x?xf32> to tensor<64x16xf32>
%dest = tensor.extract_slice %arg3[0, %arg2] [64, 16] [1, 1] : tensor<64x?xf32> to tensor<64x16xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
+ %2 = linalg.elementwise <exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %2 into %arg3[0, %arg2] [64, 16] [1, 1] : tensor<64x16xf32> into tensor<64x?xf32>
}
@@ -581,7 +581,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: shared_outs(%[[FIRST_OUT_ARG:.*]] = %[[ARG1]], %[[PACK_OUT_ARG:.*]] = %[[ARG2]])
// CHECK: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][0, %[[IV]]] [64, 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[FIRST_OUT_ARG]][0, %[[IV]]] [64, 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[PACK_RESULT_OFFSET:.*]] = affine.apply #[[PACK_RESULT_MAP]](%[[IV]])
@@ -603,7 +603,7 @@ func.func @fuse_pack_consumer_with_padding_semantics(%arg0: tensor<64x32xf32>, %
%size = affine.min affine_map<(d0) -> (-d0 + 64, 15)>(%arg2)
%src = tensor.extract_slice %arg0[%arg2, %arg3] [%size, 16] [1, 1] : tensor<64x32xf32> to tensor<?x16xf32>
%dest = tensor.extract_slice %arg4[%arg2, %arg3] [%size, 16] [1, 1] : tensor<64x32xf32> to tensor<?x16xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<?x16xf32>) outs(%dest : tensor<?x16xf32>) -> tensor<?x16xf32>
+ %2 = linalg.elementwise <exp> ins(%src : tensor<?x16xf32>) outs(%dest : tensor<?x16xf32>) -> tensor<?x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %2 into %arg4[%arg2, %arg3] [%size, 16] [1, 1] : tensor<?x16xf32> into tensor<64x32xf32>
}
@@ -638,7 +638,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: [%[[I]], %[[J]]] [%[[SIZE]], 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[ELEM_OUT]]
// CHECK-SAME: [%[[I]], %[[J]]] [%[[SIZE]], 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[D0_OFFSET:.*]] = affine.apply #[[MAP1]](%[[I]])
@@ -705,12 +705,12 @@ module {
%extracted_slice_1 = tensor.extract_slice %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_2 = tensor.extract_slice %arg0[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_3 = tensor.extract_slice %arg1[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
+ %3 = linalg.elementwise <add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
%insert_slice = tensor.insert_slice %3 into %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<64x256xf32> into tensor<256x256xf32>
scf.yield %insert_slice : tensor<256x256xf32>
}
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1 : tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
+ %4 = linalg.elementwise <mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
+ %5 = linalg.elementwise <exp> ins(%1 : tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
return %4, %5 : tensor<256x256xf32>, tensor<256x256xf32>
}
}
@@ -742,7 +742,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: outs(%[[ADD_OUT_SLICE]] :
// CHECK: %[[INSERT_ADD:.*]] = tensor.insert_slice %[[TILED_ADD_OUT]] into %[[FIRST_OUT_ARG]][%[[IV1]], 0] [64, 256] [1, 1]
// CHECK: %[[EXP_OUT_SLICE:.*]] = tensor.extract_slice %[[SECOND_OUT_ARG]][%[[IV1]], 0] [64, 256] [1, 1]
-// CHECK: %[[TILED_EXP_OUT:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[TILED_EXP_OUT:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[TILED_ADD_OUT]] :
// CHECK-SAME: outs(%[[EXP_OUT_SLICE]] :
// CHECK: %[[MUL_INS2_SLICE:.*]] = tensor.extract_slice %[[ARG2]][%[[IV1]], 0] [64, 256] [1, 1]
@@ -769,13 +769,13 @@ module {
%extracted_slice_1 = tensor.extract_slice %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_2 = tensor.extract_slice %arg0[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_3 = tensor.extract_slice %arg1[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
+ %3 = linalg.elementwise <add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
%insert_slice = tensor.insert_slice %3 into %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<64x256xf32> into tensor<256x256xf32>
scf.yield %insert_slice : tensor<256x256xf32>
}
%dest1 = tensor.empty() : tensor<258x258xf32>
%4 = tensor.insert_slice %1 into %dest1[0, 0] [256, 256] [1, 1] : tensor<256x256xf32> into tensor<258x258xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
+ %5 = linalg.elementwise <mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
return %5, %4 : tensor<256x256xf32>, tensor<258x258xf32>
}
}
@@ -815,7 +815,7 @@ module {
%extracted_slice = tensor.extract_slice %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_0 = tensor.extract_slice %arg0[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_1 = tensor.extract_slice %arg1[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%extracted_slice_0, %extracted_slice_1 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice : tensor<64x256xf32>) -> tensor<64x256xf32>
+ %4 = linalg.elementwise <add> ins(%extracted_slice_0, %extracted_slice_1 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice : tensor<64x256xf32>) -> tensor<64x256xf32>
%inserted_slice = tensor.insert_slice %4 into %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<64x256xf32> into tensor<256x256xf32>
scf.yield %inserted_slice : tensor<256x256xf32>
}
@@ -839,7 +839,7 @@ module {
// CHECK: %[[VAL_12:.*]] = tensor.extract_slice %[[VAL_10]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_13:.*]] = tensor.extract_slice %[[VAL_0]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_14:.*]] = tensor.extract_slice %[[VAL_1]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
-// CHECK: %[[VAL_15:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%[[VAL_13]], %[[VAL_14]] : tensor<64x256xf32>, tensor<64x256xf32>) outs(%[[VAL_12]] : tensor<64x256xf32>) -> tensor<64x256xf32>
+// CHECK: %[[VAL_15:.*]] = linalg.elementwise <add> ins(%[[VAL_13]], %[[VAL_14]] : tensor<64x256xf32>, tensor<64x256xf32>) outs(%[[VAL_12]] : tensor<64x256xf32>) -> tensor<64x256xf32>
// CHECK: %[[VAL_16:.*]] = tensor.insert_slice %[[VAL_15]] into %[[VAL_10]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_17:.*]] = tensor.extract_slice %[[VAL_2]][0] [24] [1] : tensor<24xf32> to tensor<24xf32>
// CHECK: %[[VAL_18:.*]] = tensor.extract_slice %[[VAL_11]]{{\[}}%[[VAL_9]], 0, 0] [64, 256, 24] [1, 1, 1]
diff --git a/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer.mlir b/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer.mlir
index af74ff924524b..36628d97102a1 100644
--- a/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer.mlir
+++ b/mlir/test/Interfaces/TilingInterface/tile-and-fuse-consumer.mlir
@@ -19,7 +19,7 @@ module {
}
%in_operand_2 = tensor.empty() : tensor<64xf32>
%out_operand_3 = tensor.empty() : tensor<64xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1#1, %in_operand_2 : tensor<64xf32>, tensor<64xf32>) outs(%out_operand_3 : tensor<64xf32>) -> tensor<64xf32>
+ %2 = linalg.elementwise <add> ins(%1#1, %in_operand_2 : tensor<64xf32>, tensor<64xf32>) outs(%out_operand_3 : tensor<64xf32>) -> tensor<64xf32>
return %2 : tensor<64xf32>
}
}
@@ -73,7 +73,7 @@ module {
}
scf.yield %1 : tensor<?x?xf32>
}
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
+ %2 = linalg.elementwise <add> ins(%0, %arg1 : tensor<?x?xf32>, tensor<?x?xf32>) outs(%arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
return %2 : tensor<?x?xf32>
}
}
@@ -129,7 +129,7 @@ module {
}
%in_operand_2 = tensor.empty() : tensor<64x64xf32>
%out_operand_3 = tensor.empty() : tensor<64x64xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%1#1, %in_operand_2 : tensor<64x64xf32>, tensor<64x64xf32>) outs(%out_operand_3 : tensor<64x64xf32>) -> tensor<64x64xf32>
+ %2 = linalg.elementwise <add> ins(%1#1, %in_operand_2 : tensor<64x64xf32>, tensor<64x64xf32>) outs(%out_operand_3 : tensor<64x64xf32>) -> tensor<64x64xf32>
return %2 : tensor<64x64xf32>
}
}
@@ -503,7 +503,7 @@ func.func @fuse_pack_consumer_if_single_iteration(%arg0: tensor<4x4xf32>) -> ten
%3 = affine.min #map(%arg1)
%extracted_slice = tensor.extract_slice %arg0[%arg1, 0] [%3, 4] [1, 1] : tensor<4x4xf32> to tensor<?x4xf32>
%extracted_slice_0 = tensor.extract_slice %arg2[%arg1, 0] [%3, 4] [1, 1] : tensor<4x4xf32> to tensor<?x4xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%extracted_slice : tensor<?x4xf32>) outs(%extracted_slice_0 : tensor<?x4xf32>) -> tensor<?x4xf32>
+ %4 = linalg.elementwise <exp> ins(%extracted_slice : tensor<?x4xf32>) outs(%extracted_slice_0 : tensor<?x4xf32>) -> tensor<?x4xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %4 into %arg2[%arg1, 0] [%3, 4] [1, 1] : tensor<?x4xf32> into tensor<4x4xf32>
}
@@ -531,7 +531,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-DAG: %[[SIZE:.+]] = affine.min affine_map<(d0) -> (-d0 + 4, 16)>(%[[IV]])
// CHECK-DAG: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][%[[IV]], 0] [%[[SIZE]], 4] [1, 1]
// CHECK-DAG: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[ELEM_OUT_ARG]][%[[IV]], 0] [%[[SIZE]], 4] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[TILED_PACK_DEST:.*]] = tensor.extract_slice %[[PACK_OUT_ARG]][%[[IV]], 0, 0, 0] [1, 4, 16, 1] [1, 1, 1, 1]
@@ -549,7 +549,7 @@ func.func @fuse_perfect_tiling_pack_consumer_with_outer_dims_perm(%arg0: tensor<
%0 = scf.forall (%arg3) = (0) to (32) step (16) shared_outs(%arg4 = %arg1) -> (tensor<64x32xf32>) {
%src = tensor.extract_slice %arg0[0, %arg3] [64, 16] [1, 1] : tensor<64x32xf32> to tensor<64x16xf32>
%dest = tensor.extract_slice %arg4[0, %arg3] [64, 16] [1, 1] : tensor<64x32xf32> to tensor<64x16xf32>
- %1 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
+ %1 = linalg.elementwise <exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %1 into %arg4[0, %arg3] [64, 16] [1, 1] : tensor<64x16xf32> into tensor<64x32xf32>
}
@@ -574,7 +574,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: shared_outs(%[[FIRST_OUT_ARG:.*]] = %[[ARG1]], %[[PACK_OUT_ARG:.*]] = %[[ARG2]])
// CHECK: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][0, %[[IV]]] [64, 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[FIRST_OUT_ARG]][0, %[[IV]]] [64, 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[PACK_RESULT_OFFSET:.*]] = affine.apply affine_map<(d0) -> (d0 floordiv 16)>(%[[IV]])
@@ -597,7 +597,7 @@ func.func @fuse_pack_consumer_with_no_pad_dynamic_dim(%arg0: tensor<64x?xf32>, %
%0 = scf.forall (%arg2) = (0) to (%d1) step (16) shared_outs(%arg3 = %arg1) -> (tensor<64x?xf32>) {
%src = tensor.extract_slice %arg0[0, %arg2] [64, 16] [1, 1] : tensor<64x?xf32> to tensor<64x16xf32>
%dest = tensor.extract_slice %arg3[0, %arg2] [64, 16] [1, 1] : tensor<64x?xf32> to tensor<64x16xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
+ %2 = linalg.elementwise <exp> ins(%src : tensor<64x16xf32>) outs(%dest : tensor<64x16xf32>) -> tensor<64x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %2 into %arg3[0, %arg2] [64, 16] [1, 1] : tensor<64x16xf32> into tensor<64x?xf32>
}
@@ -622,7 +622,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: shared_outs(%[[FIRST_OUT_ARG:.*]] = %[[ARG1]], %[[PACK_OUT_ARG:.*]] = %[[ARG2]])
// CHECK: %[[ELEM_SRC:.*]] = tensor.extract_slice %[[ARG0]][0, %[[IV]]] [64, 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[FIRST_OUT_ARG]][0, %[[IV]]] [64, 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[PACK_RESULT_OFFSET:.*]] = affine.apply affine_map<(d0) -> (d0 floordiv 16)>(%[[IV]])
@@ -644,7 +644,7 @@ func.func @fuse_pack_consumer_with_padding_semantics(%arg0: tensor<64x32xf32>, %
%size = affine.min affine_map<(d0) -> (-d0 + 64, 15)>(%arg2)
%src = tensor.extract_slice %arg0[%arg2, %arg3] [%size, 16] [1, 1] : tensor<64x32xf32> to tensor<?x16xf32>
%dest = tensor.extract_slice %arg4[%arg2, %arg3] [%size, 16] [1, 1] : tensor<64x32xf32> to tensor<?x16xf32>
- %2 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%src : tensor<?x16xf32>) outs(%dest : tensor<?x16xf32>) -> tensor<?x16xf32>
+ %2 = linalg.elementwise <exp> ins(%src : tensor<?x16xf32>) outs(%dest : tensor<?x16xf32>) -> tensor<?x16xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %2 into %arg4[%arg2, %arg3] [%size, 16] [1, 1] : tensor<?x16xf32> into tensor<64x32xf32>
}
@@ -675,7 +675,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: [%[[I]], %[[J]]] [%[[SIZE]], 16] [1, 1]
// CHECK: %[[ELEM_DEST:.*]] = tensor.extract_slice %[[ELEM_OUT]]
// CHECK-SAME: [%[[I]], %[[J]]] [%[[SIZE]], 16] [1, 1]
-// CHECK: %[[ELEM:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[ELEM:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[ELEM_SRC]]
// CHECK-SAME: outs(%[[ELEM_DEST]]
// CHECK-DAG: %[[D0_OFFSET:.*]] = affine.apply affine_map<(d0) -> (d0 floordiv 3)>(%[[I]])
@@ -743,12 +743,12 @@ module {
%extracted_slice_1 = tensor.extract_slice %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_2 = tensor.extract_slice %arg0[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_3 = tensor.extract_slice %arg1[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
- %3 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
+ %3 = linalg.elementwise <add> ins(%extracted_slice_2, %extracted_slice_3 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice_1 : tensor<64x256xf32>) -> tensor<64x256xf32>
%insert_slice = tensor.insert_slice %3 into %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<64x256xf32> into tensor<256x256xf32>
scf.yield %insert_slice : tensor<256x256xf32>
}
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
- %5 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%1 : tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
+ %4 = linalg.elementwise <mul> ins(%1, %arg2 : tensor<256x256xf32>, tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
+ %5 = linalg.elementwise <exp> ins(%1 : tensor<256x256xf32>) outs(%dest0 : tensor<256x256xf32>) -> tensor<256x256xf32>
return %4, %5 : tensor<256x256xf32>, tensor<256x256xf32>
}
}
@@ -789,7 +789,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: ins(%[[TILED_ADD_OUT]], %[[MUL_INS2_SLICE]] :
// CHECK-SAME: outs(%[[MUL_OUT_SLICE]] :
// CHECK: %[[EXP_OUT_SLICE:.*]] = tensor.extract_slice %[[THIRD_OUT_ARG]][%[[IV1]], 0] [64, 256] [1, 1]
-// CHECK: %[[TILED_EXP_OUT:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[TILED_EXP_OUT:.*]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[TILED_ADD_OUT]] :
// CHECK-SAME: outs(%[[EXP_OUT_SLICE]] :
// CHECK: %[[INSERT_MUL:.*]] = tensor.insert_slice %[[TILED_MUL_OUT]] into %[[SECOND_OUT_ARG]][%[[IV1]], 0] [64, 256] [1, 1]
@@ -813,7 +813,7 @@ module {
%extracted_slice = tensor.extract_slice %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_0 = tensor.extract_slice %arg0[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
%extracted_slice_1 = tensor.extract_slice %arg1[%arg3, 0] [64, 256] [1, 1] : tensor<256x256xf32> to tensor<64x256xf32>
- %4 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%extracted_slice_0, %extracted_slice_1 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice : tensor<64x256xf32>) -> tensor<64x256xf32>
+ %4 = linalg.elementwise <add> ins(%extracted_slice_0, %extracted_slice_1 : tensor<64x256xf32>, tensor<64x256xf32>) outs(%extracted_slice : tensor<64x256xf32>) -> tensor<64x256xf32>
%inserted_slice = tensor.insert_slice %4 into %arg4[%arg3, 0] [64, 256] [1, 1] : tensor<64x256xf32> into tensor<256x256xf32>
scf.yield %inserted_slice : tensor<256x256xf32>
}
@@ -849,7 +849,7 @@ module attributes {transform.with_named_sequence} {
// CHECK: %[[VAL_12:.*]] = tensor.extract_slice %[[VAL_10]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_13:.*]] = tensor.extract_slice %[[VAL_0]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_14:.*]] = tensor.extract_slice %[[VAL_1]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
-// CHECK: %[[VAL_15:.*]] = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%[[VAL_13]], %[[VAL_14]] : tensor<64x256xf32>, tensor<64x256xf32>) outs(%[[VAL_12]] : tensor<64x256xf32>) -> tensor<64x256xf32>
+// CHECK: %[[VAL_15:.*]] = linalg.elementwise <add> ins(%[[VAL_13]], %[[VAL_14]] : tensor<64x256xf32>, tensor<64x256xf32>) outs(%[[VAL_12]] : tensor<64x256xf32>) -> tensor<64x256xf32>
// CHECK: %[[VAL_16:.*]] = tensor.insert_slice %[[VAL_15]] into %[[VAL_10]]{{\[}}%[[VAL_9]], 0] [64, 256] [1, 1]
// CHECK: %[[VAL_17:.*]] = tensor.extract_slice %[[VAL_2]][0] [24] [1] : tensor<24xf32> to tensor<24xf32>
// CHECK: %[[VAL_18:.*]] = tensor.extract_slice %[[VAL_11]]{{\[}}%[[VAL_9]], 0, 0] [64, 256, 24] [1, 1, 1]
diff --git a/mlir/test/Interfaces/TilingInterface/tile-elementwise.mlir b/mlir/test/Interfaces/TilingInterface/tile-elementwise.mlir
index dd574e9be6b91..343839151d50f 100644
--- a/mlir/test/Interfaces/TilingInterface/tile-elementwise.mlir
+++ b/mlir/test/Interfaces/TilingInterface/tile-elementwise.mlir
@@ -4,7 +4,7 @@
func.func @tile_elementwise(%A: tensor<128x256xf32>, %B: tensor<128x256xf32>,
%C: tensor<128x256xf32>) -> tensor<128x256xf32> {
- %r = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %r = linalg.elementwise <add>
ins(%A, %B : tensor<128x256xf32>, tensor<128x256xf32>)
outs(%C : tensor<128x256xf32>) -> tensor<128x256xf32>
return %r : tensor<128x256xf32>
@@ -36,7 +36,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-DAG: %[[AT:.+]] = tensor.extract_slice %[[A]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
// CHECK-DAG: %[[BT:.+]] = tensor.extract_slice %[[B]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
// CHECK-DAG: %[[CT:.+]] = tensor.extract_slice %[[INIT1]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
-// CHECK: %[[TILED:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[TILED:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[AT]], %[[BT]] :
// CHECK-SAME: outs(%[[CT]] :
// CHECK: %[[INS:.+]] = tensor.insert_slice %[[TILED]] into %[[INIT1]]
@@ -50,7 +50,7 @@ module attributes {transform.with_named_sequence} {
func.func @tile_elementwise_dynamic(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>,
%C: tensor<?x?xf32>) -> tensor<?x?xf32> {
- %r = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %r = linalg.elementwise <add>
ins(%A, %B : tensor<?x?xf32>, tensor<?x?xf32>)
outs(%C : tensor<?x?xf32>) -> tensor<?x?xf32>
return %r : tensor<?x?xf32>
@@ -87,7 +87,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-DAG: %[[AT:.+]] = tensor.extract_slice %[[A]][%[[IV0]], %[[IV1]]] [%[[TS0]], %[[TS1]]] [1, 1]
// CHECK-DAG: %[[BT:.+]] = tensor.extract_slice %[[B]][%[[IV0]], %[[IV1]]] [%[[TS0]], %[[TS1]]] [1, 1]
// CHECK-DAG: %[[CT:.+]] = tensor.extract_slice %[[INIT1]][%[[IV0]], %[[IV1]]] [%[[TS0]], %[[TS1]]] [1, 1]
-// CHECK: %[[TILED:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[TILED:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[AT]], %[[BT]] :
// CHECK-SAME: outs(%[[CT]] :
// CHECK: tensor.insert_slice %[[TILED]] into %[[INIT1]]
@@ -99,7 +99,7 @@ module attributes {transform.with_named_sequence} {
func.func @tile_elementwise_memref(%A: memref<128x256xf32>,
%B: memref<128x256xf32>) {
- linalg.elementwise kind=#linalg.elementwise_kind<negf>
+ linalg.elementwise <negf>
ins(%A : memref<128x256xf32>)
outs(%B : memref<128x256xf32>)
return
@@ -128,7 +128,7 @@ module attributes {transform.with_named_sequence} {
// CHECK: scf.for %[[IV1:.+]] = %[[C0]] to %[[C256]] step %[[C64]]
// CHECK-DAG: %[[AT:.+]] = memref.subview %[[A]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
// CHECK-DAG: %[[BT:.+]] = memref.subview %[[B]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
-// CHECK: linalg.elementwise kind=#linalg.elementwise_kind<negf>
+// CHECK: linalg.elementwise <negf>
// CHECK-SAME: ins(%[[AT]] :
// CHECK-SAME: outs(%[[BT]] :
@@ -138,7 +138,7 @@ module attributes {transform.with_named_sequence} {
func.func @tile_elementwise_forall(%A: tensor<128x256xf32>, %B: tensor<128x256xf32>,
%C: tensor<128x256xf32>) -> tensor<128x256xf32> {
- %r = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %r = linalg.elementwise <add>
ins(%A, %B : tensor<128x256xf32>, tensor<128x256xf32>)
outs(%C : tensor<128x256xf32>) -> tensor<128x256xf32>
return %r : tensor<128x256xf32>
@@ -167,7 +167,7 @@ module attributes {transform.with_named_sequence} {
// CHECK-DAG: %[[AT:.+]] = tensor.extract_slice %[[A]][%[[OFF0]], %[[OFF1]]] [32, 64] [1, 1]
// CHECK-DAG: %[[BT:.+]] = tensor.extract_slice %[[B]][%[[OFF0]], %[[OFF1]]] [32, 64] [1, 1]
// CHECK-DAG: %[[CT:.+]] = tensor.extract_slice %[[INIT]][%[[OFF0]], %[[OFF1]]] [32, 64] [1, 1]
-// CHECK: %[[TILED:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[TILED:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[AT]], %[[BT]] :
// CHECK-SAME: outs(%[[CT]] :
// CHECK: scf.forall.in_parallel
@@ -185,7 +185,7 @@ module attributes {transform.with_named_sequence} {
func.func @tile_elementwise_broadcast(%A: tensor<256xf32>,
%B: tensor<128x256xf32>) -> tensor<128x256xf32> {
- %r = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %r = linalg.elementwise <exp>
indexing_maps = [#map_in, #map_out]
ins(%A : tensor<256xf32>)
outs(%B : tensor<128x256xf32>) -> tensor<128x256xf32>
@@ -212,7 +212,7 @@ module attributes {transform.with_named_sequence} {
// Input is 1-D: sliced only along d1, not d0.
// CHECK: %[[AT:.+]] = tensor.extract_slice %[[A]][%[[IV1]]] [64] [1]
// CHECK: %[[BT:.+]] = tensor.extract_slice %[[INIT1]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
-// CHECK: %[[TILED:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[TILED:.+]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[AT]] : tensor<64xf32>)
// CHECK-SAME: outs(%[[BT]] : tensor<32x64xf32>)
// CHECK: tensor.insert_slice %[[TILED]] into %[[INIT1]]
@@ -225,11 +225,11 @@ module attributes {transform.with_named_sequence} {
func.func @tile_and_fuse_elementwise(%A: tensor<128x256xf32>,
%B: tensor<128x256xf32>) -> tensor<128x256xf32> {
%empty0 = tensor.empty() : tensor<128x256xf32>
- %exp = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ %exp = linalg.elementwise <exp>
ins(%A : tensor<128x256xf32>)
outs(%empty0 : tensor<128x256xf32>) -> tensor<128x256xf32>
%empty1 = tensor.empty() : tensor<128x256xf32>
- %r = linalg.elementwise kind=#linalg.elementwise_kind<add>
+ %r = linalg.elementwise <add>
ins(%exp, %B : tensor<128x256xf32>, tensor<128x256xf32>)
outs(%empty1 : tensor<128x256xf32>) -> tensor<128x256xf32>
return %r : tensor<128x256xf32>
@@ -256,10 +256,10 @@ module attributes {transform.with_named_sequence} {
// CHECK-SAME: iter_args(%[[INIT1:[a-zA-Z0-9]+]] = %[[INIT0]])
// exp tile is generated from the original input, not the full exp result.
// CHECK-DAG: %[[AT:.+]] = tensor.extract_slice %[[A]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
-// CHECK: %[[EXP_TILE:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<exp>
+// CHECK: %[[EXP_TILE:.+]] = linalg.elementwise <exp>
// CHECK-SAME: ins(%[[AT]] :
// CHECK-DAG: %[[BT:.+]] = tensor.extract_slice %[[B]][%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
-// CHECK: %[[ADD_TILE:.+]] = linalg.elementwise kind=#linalg.elementwise_kind<add>
+// CHECK: %[[ADD_TILE:.+]] = linalg.elementwise <add>
// CHECK-SAME: ins(%[[EXP_TILE]], %[[BT]] :
// CHECK: tensor.insert_slice %[[ADD_TILE]] into %[[INIT1]]
// CHECK-SAME: [%[[IV0]], %[[IV1]]] [32, 64] [1, 1]
diff --git a/mlir/test/Interfaces/TilingInterface/tile-fuse-and-yield-using-interface.mlir b/mlir/test/Interfaces/TilingInterface/tile-fuse-and-yield-using-interface.mlir
index a4fe08c0cfe32..abe2cb394f550 100644
--- a/mlir/test/Interfaces/TilingInterface/tile-fuse-and-yield-using-interface.mlir
+++ b/mlir/test/Interfaces/TilingInterface/tile-fuse-and-yield-using-interface.mlir
@@ -80,7 +80,7 @@ func.func @multiple_outputs_fusion_yield_all(%lhs0: tensor<32x32xf32>,
linalg.yield %4, %5: f32, f32
} -> (tensor<32x32xf32>, tensor<32x32xf32>)
- %out3 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%out0, %rhs1: tensor<32x32xf32>, tensor<32x32xf32>) outs(%init2: tensor<32x32xf32>) -> tensor<32x32xf32>
+ %out3 = linalg.elementwise <add> ins(%out0, %rhs1: tensor<32x32xf32>, tensor<32x32xf32>) outs(%init2: tensor<32x32xf32>) -> tensor<32x32xf32>
return %out0, %out1, %out3 : tensor<32x32xf32>, tensor<32x32xf32>, tensor<32x32xf32>
}
diff --git a/mlir/test/python/dialects/linalg/ops.py b/mlir/test/python/dialects/linalg/ops.py
index 68b32098b7782..1368e6ac495ab 100644
--- a/mlir/test/python/dialects/linalg/ops.py
+++ b/mlir/test/python/dialects/linalg/ops.py
@@ -752,7 +752,7 @@ def elementwise_op(
if _inferred_affine_maps := True:
# CHECK: linalg.elementwise
- # CHECK-SAME: kind=#linalg.elementwise_kind<exp>
+ # CHECK-SAME: <exp>
# CHECK-SAME: ins(%[[Rect]] : tensor<8x16xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
op1 = linalg.ElementwiseOp(
@@ -764,7 +764,7 @@ def elementwise_op(
linalg.fill_builtin_region(op1.operation)
# CHECK: linalg.elementwise
- # CHECK-SAME: kind=#linalg.elementwise_kind<exp>
+ # CHECK-SAME: <exp>
# CHECK-SAME: ins(%[[Rect]] : tensor<8x16xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
linalg.elementwise(
@@ -774,7 +774,7 @@ def elementwise_op(
)
# CHECK: linalg.elementwise
- # CHECK-SAME: kind=#linalg.elementwise_kind<exp>
+ # CHECK-SAME: <exp>
# CHECK-SAME: ins(%[[RectMem]] : memref<8x16xf32>)
# CHECK-SAME: outs(%[[OutRectMem]] : memref<8x16xf32>)
linalg.elementwise(
@@ -786,7 +786,7 @@ def elementwise_op(
if _explicit_ident_affine_maps := True:
# Same as above but with default identity indexing_maps explicitly provided.
# CHECK: linalg.elementwise
- # CHECK-SAME: kind=#linalg.elementwise_kind<exp>
+ # CHECK-SAME: <exp>
# CHECK-SAME: ins(%[[Rect]] : tensor<8x16xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
op3 = linalg.ElementwiseOp(
@@ -799,7 +799,7 @@ def elementwise_op(
linalg.fill_builtin_region(op3.operation)
# CHECK: linalg.elementwise
- # CHECK-SAME: kind=#linalg.elementwise_kind<exp>
+ # CHECK-SAME: <exp>
# CHECK-SAME: ins(%[[RectMem]] : memref<8x16xf32>)
# CHECK-SAME: outs(%[[OutRectMem]] : memref<8x16xf32>)
linalg.elementwise(
@@ -810,7 +810,8 @@ def elementwise_op(
)
if _ops_with_non_ident_input_maps := True:
- # CHECK: linalg.elementwise kind=#linalg.elementwise_kind<exp>
+ # CHECK: linalg.elementwise
+ # CHECK-SAME: <exp>
# CHECK-SAME: indexing_maps = [#[[$VertLineBCastMap]], #[[$IdentMap2D]]]
# CHECK-SAME: ins(%[[VertLine]] : tensor<8xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
@@ -823,7 +824,8 @@ def elementwise_op(
)
linalg.fill_builtin_region(op4.operation)
- # CHECK: linalg.elementwise kind=#linalg.elementwise_kind<add>
+ # CHECK: linalg.elementwise
+ # CHECK-SAME: <add>
# CHECK-SAME: indexing_maps = [#[[$IdentMap2D]], #[[$VertLineBCastMap]], #[[$IdentMap2D]]]
# CHECK-SAME: ins(%[[Rect]], %[[VertLine]] : tensor<8x16xf32>, tensor<8xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
@@ -836,7 +838,8 @@ def elementwise_op(
)
linalg.fill_builtin_region(op4.operation)
- # CHECK: linalg.elementwise kind=#linalg.elementwise_kind<div>
+ # CHECK: linalg.elementwise
+ # CHECK-SAME: <div>
# CHECK-SAME: indexing_maps = [#[[$VertLineBCastMap]], #[[$HorLineBCastMap]], #[[$IdentMap2D]]]
# CHECK-SAME: ins(%[[VertLine]], %[[HorLine]] : tensor<8xf32>, tensor<16xf32>)
# CHECK-SAME: outs(%[[OutRect]] : tensor<8x16xf32>) -> tensor<8x16xf32>
@@ -859,7 +862,8 @@ def elementwise_op(
[],
[],
)
- # CHECK: linalg.elementwise kind=#linalg.elementwise_kind<select>
+ # CHECK: linalg.elementwise
+ # CHECK-SAME: <select>
# CHECK-SAME: indexing_maps = [#[[$VertLineBCastMap]], #[[$HorLineBCastMap]], #[[$TransMap2D]], #[[$IdentMap2D]]]
# CHECK-SAME: ins(%[[VertLineBoolsMem]], %[[HorLineMem]], %[[TransRectMem]] : memref<8xi1>, memref<16xf32>, memref<16x8xf32>)
# CHECK-SAME: outs(%[[OutRectMem]] : memref<8x16xf32>)
>From 2242897df5c24f49bf527d56405b8acb3c1aec23 Mon Sep 17 00:00:00 2001
From: rengolin <rengolin at systemcall.eu>
Date: Thu, 10 Sep 2026 02:57:07 -0700
Subject: [PATCH 2/3] format
---
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 657e183513e30..0909732728eca 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -5139,7 +5139,8 @@ ElementwiseOp::getDefaultIndexingMaps(unsigned numMaps, unsigned numDims,
}
ParseResult ElementwiseOp::parse(OpAsmParser &parser, OperationState &result) {
- // Expect e.g. `<add>` (also accepts the full `#linalg.elementwise_kind<add>`).
+ // Expect e.g. `<add>` (also accepts the full
+ // `#linalg.elementwise_kind<add>`).
ElementwiseKindAttr kindAttr;
mlir::linalg::ElementwiseKind elemwiseKindVal;
if (parser.parseCustomAttributeWithFallback(kindAttr))
>From 56c24814cc792121dacb1602b78dcf986433003a Mon Sep 17 00:00:00 2001
From: rengolin <rengolin at systemcall.eu>
Date: Thu, 10 Sep 2026 04:44:35 -0700
Subject: [PATCH 3/3] fix integration test
---
mlir/test/Integration/Dialect/Transform/match_matmul.mlir | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/test/Integration/Dialect/Transform/match_matmul.mlir b/mlir/test/Integration/Dialect/Transform/match_matmul.mlir
index e440cbe02dc7e..b0dea72496b0c 100644
--- a/mlir/test/Integration/Dialect/Transform/match_matmul.mlir
+++ b/mlir/test/Integration/Dialect/Transform/match_matmul.mlir
@@ -69,7 +69,7 @@ func.func @matmul_with_extra_ops_in_func(%lhs: tensor<10x20xf32>, %rhs: tensor<2
// expected-remark @below {{fill}}
%fill = linalg.fill ins(%cst : f32) outs(%empty : tensor<10x15xf32>) -> tensor<10x15xf32>
- %real_lhs = linalg.elementwise kind=#linalg.elementwise_kind<mul>
+ %real_lhs = linalg.elementwise <mul>
ins(%lhs, %lhs : tensor<10x20xf32>, tensor<10x20xf32>) outs(%lhs : tensor<10x20xf32>) -> tensor<10x20xf32>
// expected-remark @below {{matmul}}
More information about the Mlir-commits
mailing list