@@ -165,9 +165,9 @@ def BufferizeToAllocationOp : Op<Transform_Dialect,
165
165
//===----------------------------------------------------------------------===//
166
166
167
167
def DecomposeOp : Op<Transform_Dialect, "structured.decompose",
168
- [FunctionalStyleTransformOpTrait,
168
+ [FunctionalStyleTransformOpTrait,
169
169
MemoryEffectsOpInterface,
170
- TransformOpInterface,
170
+ TransformOpInterface,
171
171
TransformEachOpTrait,
172
172
ReportTrackingListenerFailuresOpTrait]> {
173
173
let description = [{
@@ -414,8 +414,8 @@ def InterchangeOp : Op<Transform_Dialect, "structured.interchange",
414
414
[DenseArrayNonNegative<DenseI64ArrayAttr>]>:$iterator_interchange);
415
415
let results = (outs TransformHandleTypeInterface:$transformed);
416
416
417
- let assemblyFormat = [{
418
- $target
417
+ let assemblyFormat = [{
418
+ $target
419
419
(`iterator_interchange` `=` $iterator_interchange^)? attr-dict
420
420
`:` custom<SemiFunctionType>(type($target), type($transformed))
421
421
}];
@@ -479,7 +479,7 @@ def LowerUnPackOp : Op<Transform_Dialect, "structured.lower_unpack", [
479
479
TransformOpInterface,
480
480
ReportTrackingListenerFailuresOpTrait]> {
481
481
let description = [{
482
- Lower a tensor.unpack into empty + linalg.transpose + tensor.collapse_shape +
482
+ Lower a tensor.unpack into empty + linalg.transpose + tensor.collapse_shape +
483
483
tensor.extract_slice.
484
484
485
485
#### Return modes
@@ -497,7 +497,7 @@ def LowerUnPackOp : Op<Transform_Dialect, "structured.lower_unpack", [
497
497
Transform_ConcreteOpType<"linalg.transpose">:$transpose_op,
498
498
Transform_ConcreteOpType<"tensor.collapse_shape">:$collapse_shape_op,
499
499
Transform_ConcreteOpType<"tensor.extract_slice">:$extract_slice_op);
500
- let assemblyFormat = [{
500
+ let assemblyFormat = [{
501
501
$target attr-dict `:` functional-type(operands, results)
502
502
}];
503
503
@@ -665,7 +665,7 @@ def PackOp : Op<Transform_Dialect, "structured.pack", [
665
665
let description = [{
666
666
Pack a LinalgOp by applying a data tiling transformation on the op and
667
667
packing the operands according to the `packed_sizes` specification.
668
-
668
+
669
669
Iterator dimensions are tiled in their canonical order in the op spec.
670
670
Operands are packed according to the same canonical order of the op iterator
671
671
dimensions.
@@ -700,7 +700,7 @@ def PackOp : Op<Transform_Dialect, "structured.pack", [
700
700
// affine_map<(d0, d1, d2, d3, d4, d5) -> (d2, d1, d4, d5)>
701
701
// M N m n
702
702
// affine_map<(d0, d1, d2, d3, d4, d5) -> (d0, d1, d3, d4)>
703
- %0 = linalg.generic_representing_some_higher_d_matmul
703
+ %0 = linalg.generic_representing_some_higher_d_matmul
704
704
ins(%A, %B: tensor<?x?x2x4xf32>, tensor<?x?x4x3xf32>)
705
705
outs( %C: tensor<?x?x2x3xf32>)
706
706
```
@@ -727,7 +727,7 @@ def PackOp : Op<Transform_Dialect, "structured.pack", [
727
727
DefaultValuedAttr<DenseI64ArrayAttr, "{}">:$static_packed_sizes);
728
728
let results = (outs TransformHandleTypeInterface:$packed_op);
729
729
let assemblyFormat = [{
730
- $target
730
+ $target
731
731
`packed_sizes` `=` custom<DynamicIndexList>($packed_sizes,
732
732
$static_packed_sizes,
733
733
type($packed_sizes))
@@ -756,27 +756,27 @@ def PackGreedilyOp : Op<Transform_Dialect, "structured.pack_greedily", [
756
756
Target a Linalg op and rewrite it into packed LinalgOp form by trying to
757
757
infer whether a known suboperation is embedded
758
758
759
- Different packing strategies are applied in order, when one applies
759
+ Different packing strategies are applied in order, when one applies
760
760
successfully, the transform returns:
761
761
1. Matmul packing: Try to infer a matmul operation embedded in the target op.
762
762
Specifically, this looks for 2 parallel dimensions that participate in
763
763
an outer-product and 1 reduction dimension.
764
764
These dimensions are referred as (m, n, k) to match canonical matmul
765
765
terminology.
766
-
766
+
767
767
The packed sizes for (m, n, k) are specified by `matmul_packed_sizes`
768
768
and the optional `matmul_padded_sizes_next_multiple_of`.
769
- When an entry `matmul_packed_sizes[i]` is non-0, the corresponding
769
+ When an entry `matmul_packed_sizes[i]` is non-0, the corresponding
770
770
dimension is packed by `matmul_packed_sizes[i]`.
771
771
Otherwise, the dimension is merely padded to the next multiple of
772
772
`matmul_padded_sizes_next_multiple_of[i]`.
773
773
774
774
`matmul_padded_sizes_next_multiple_of` is optional and is expected to
775
775
either be empty or of size `3`, matching the size of `matmul_packed_sizes`.
776
- For each individual element of `matmul_packed_sizes` and
776
+ For each individual element of `matmul_packed_sizes` and
777
777
`matmul_padded_sizes_next_multiple_of`, only one of them is allowed to
778
778
be non-zero.
779
-
779
+
780
780
The ordering of the packed dimensions (mm, nn, kk) is specified by the
781
781
`matmul_inner_dims_order` attribute.
782
782
@@ -787,7 +787,7 @@ def PackGreedilyOp : Op<Transform_Dialect, "structured.pack_greedily", [
787
787
the most minor indexing dimensions of the linalg.generic. The most minor
788
788
dimensions are themselves ordered according to `inner_dims_order`.
789
789
4. An elementwise traversal of `matmul_packed_sizes` and
790
- `matmul_padded_sizes_next_multiple_of` is performed and for each
790
+ `matmul_padded_sizes_next_multiple_of` is performed and for each
791
791
dimension `d`, either pack to `matmul_packed_sizes[d]` or pad to the
792
792
`matmul_padded_sizes_next_multiple_of[d]`.
793
793
5. Packing/padding is performed by the amounts determined in step 4. and
@@ -815,7 +815,7 @@ def PackGreedilyOp : Op<Transform_Dialect, "structured.pack_greedily", [
815
815
[DenseArrayCount<3>]>:$static_matmul_packed_sizes,
816
816
ConfinedAttr<DefaultValuedAttr<DenseI64ArrayAttr, "{}">,
817
817
[Attr<
818
- Or<[DenseArrayCount<0>.predicate,
818
+ Or<[DenseArrayCount<0>.predicate,
819
819
DenseArrayCount<3>.predicate]>,
820
820
"with 0 or 3 elements"
821
821
>]>
@@ -837,7 +837,7 @@ def PackGreedilyOp : Op<Transform_Dialect, "structured.pack_greedily", [
837
837
`matmul_packed_sizes` `=` custom<DynamicIndexList>($matmul_packed_sizes,
838
838
$static_matmul_packed_sizes,
839
839
type($matmul_packed_sizes))
840
- (`matmul_padded_sizes_next_multiple_of` `=`
840
+ (`matmul_padded_sizes_next_multiple_of` `=`
841
841
$matmul_padded_sizes_next_multiple_of^)?
842
842
`matmul_inner_dims_order` `=` $matmul_inner_dims_order
843
843
)
@@ -862,7 +862,7 @@ def PackTransposeOp : Op<Transform_Dialect, "structured.pack_transpose", [
862
862
DeclareOpInterfaceMethods<TransformOpInterface>,
863
863
ReportTrackingListenerFailuresOpTrait]> {
864
864
let description = [{
865
- Apply a transposition to a single `tensor.pack` (resp. `tensor.unpack`) and
865
+ Apply a transposition to a single `tensor.pack` (resp. `tensor.unpack`) and
866
866
update the `linalg.generic` op that consumes (resp. produces) the operation.
867
867
868
868
This transform allows composing a simple `structured.pack` with additional
@@ -874,7 +874,7 @@ def PackTransposeOp : Op<Transform_Dialect, "structured.pack_transpose", [
874
874
the specified `tensor.pack` or `tensor.unpack` op.
875
875
876
876
If the `target` of this op is a `tensor.pack` then a new `tensor.empty` will
877
- be created along with transposed versions of the `tensor.pack` and the
877
+ be created along with transposed versions of the `tensor.pack` and the
878
878
consuming `linalg.generic`, which is expected to be the sole consumer.
879
879
880
880
If the `target` of this op is a `tensor.unpack` then the whole pack / compute
@@ -894,7 +894,7 @@ def PackTransposeOp : Op<Transform_Dialect, "structured.pack_transpose", [
894
894
895
895
This operation returns 3 handles, one to the transformed LinalgOp, one to
896
896
the transformed `tensor.pack` and one to the transformed `tensor.unpack`.
897
- The last handle for `tensor.unpack` is empty if `target_pack_or_unpack_op`
897
+ The last handle for `tensor.unpack` is empty if `target_pack_or_unpack_op`
898
898
was not itself a `tensor.unpack`.
899
899
}];
900
900
@@ -971,7 +971,7 @@ def PadOp : Op<Transform_Dialect, "structured.pad",
971
971
let builders = [
972
972
// Builder for a transform::PadOp with automatic inference of padding
973
973
// value. Warning: this will set the value 0 for the inferred elemental
974
- // type without taking the op into account and thus only work for the
974
+ // type without taking the op into account and thus only work for the
975
975
// add/mul ring at the moment.
976
976
// TODO: support other operations (e.g. min, max etc).
977
977
OpBuilder<(ins "Value":$target,
@@ -1048,7 +1048,7 @@ def HoistPadOp : Op<Transform_Dialect, "structured.hoist_pad",
1048
1048
Hoist the tensor.pad target operation by at most the given number of loops.
1049
1049
Optionally apply the transpose attribute to the inner dimensions.
1050
1050
1051
- TODO: In the future, we should consider rewriting as a tensor.pack after
1051
+ TODO: In the future, we should consider rewriting as a tensor.pack after
1052
1052
hoisting since this abstraction is now available.
1053
1053
TODO: Maybe also return the linalg.generic transpose created at some point.
1054
1054
@@ -1060,7 +1060,7 @@ def HoistPadOp : Op<Transform_Dialect, "structured.hoist_pad",
1060
1060
If all the operations referred to by the `target` handle padproperly, the
1061
1061
transform succeeds. Otherwise the transform silently fails.
1062
1062
1063
- The return handle points to only the subset of successfully hoisted
1063
+ The return handle points to only the subset of successfully hoisted
1064
1064
tensor.pad operations, which can be empty.
1065
1065
}];
1066
1066
@@ -1073,9 +1073,9 @@ def HoistPadOp : Op<Transform_Dialect, "structured.hoist_pad",
1073
1073
let results = (outs TransformHandleTypeInterface:$transformed);
1074
1074
1075
1075
let assemblyFormat = [{
1076
- $target
1077
- `by` $num_loops `loops`
1078
- (`,` `transpose` `by` $transpose^)?
1076
+ $target
1077
+ `by` $num_loops `loops`
1078
+ (`,` `transpose` `by` $transpose^)?
1079
1079
attr-dict
1080
1080
`:` functional-type(operands, results)
1081
1081
}];
@@ -1122,6 +1122,7 @@ def PromoteOp : Op<Transform_Dialect, "structured.promote",
1122
1122
DefaultValuedAttr<BoolArrayAttr, "{}">:$use_full_tile_buffers,
1123
1123
UnitAttr:$use_full_tiles_by_default,
1124
1124
UnitAttr:$use_alloca,
1125
+ OptionalAttr<AnyAttr>:$memory_space,
1125
1126
OptionalAttr<DeviceMappingArrayAttr>:$mapping,
1126
1127
OptionalAttr<I64Attr>:$alignment);
1127
1128
let results = (outs TransformHandleTypeInterface:$transformed);
@@ -1202,7 +1203,7 @@ def ScalarizeOp : Op<Transform_Dialect, "structured.scalarize",
1202
1203
let arguments = (ins TransformHandleTypeInterface:$target);
1203
1204
let results = (outs TransformHandleTypeInterface:$result);
1204
1205
1205
- let assemblyFormat =
1206
+ let assemblyFormat =
1206
1207
"$target attr-dict `:`"
1207
1208
"custom<SemiFunctionType>(type($target), type($result))";
1208
1209
@@ -1248,9 +1249,9 @@ def DecomposeInterfaceOp : Op<Transform_Dialect, "structured.decompose_interface
1248
1249
1249
1250
def RewriteInDestinationPassingStyleOp : Op<
1250
1251
Transform_Dialect, "structured.rewrite_in_destination_passing_style",
1251
- [FunctionalStyleTransformOpTrait,
1252
+ [FunctionalStyleTransformOpTrait,
1252
1253
MemoryEffectsOpInterface,
1253
- TransformOpInterface,
1254
+ TransformOpInterface,
1254
1255
TransformEachOpTrait,
1255
1256
ReportTrackingListenerFailuresOpTrait]> {
1256
1257
let description = [{
@@ -1260,7 +1261,7 @@ def RewriteInDestinationPassingStyleOp : Op<
1260
1261
- tensor.pad
1261
1262
- tensor.generate
1262
1263
- tensor.from_elements
1263
- This dichotomy hints at a future interface, for now the implementation just
1264
+ This dichotomy hints at a future interface, for now the implementation just
1264
1265
switches between different implementation.
1265
1266
1266
1267
#### Return modes
@@ -1271,7 +1272,7 @@ def RewriteInDestinationPassingStyleOp : Op<
1271
1272
The return handle points to a subset of successfully produced operations:
1272
1273
- `tensor.pad` case, the returned handle points to the tensor.insert_slice.
1273
1274
- `tensor.generate` case, the returned handle points to the linalg.generic.
1274
- - `tensor.from_elements` case, the returned handle points to the last
1275
+ - `tensor.from_elements` case, the returned handle points to the last
1275
1276
`tensor.insert`.
1276
1277
}];
1277
1278
@@ -1483,7 +1484,7 @@ def SplitReductionOp : Op<Transform_Dialect, "structured.split_reduction",
1483
1484
TransformHandleTypeInterface:$split_linalg_op,
1484
1485
TransformHandleTypeInterface:$combining_linalg_op);
1485
1486
1486
- let assemblyFormat =
1487
+ let assemblyFormat =
1487
1488
"$target attr-dict `:`"
1488
1489
"functional-type(operands, results)";
1489
1490
@@ -1990,7 +1991,7 @@ def TileToScfForOp : Op<Transform_Dialect, "structured.tile_to_scf_for",
1990
1991
DefaultValuedOptionalAttr<DenseI64ArrayAttr, "{}">:$interchange);
1991
1992
let results = (outs TransformHandleTypeInterface:$tiled_linalg_op,
1992
1993
Variadic<TransformHandleTypeInterface>:$loops);
1993
-
1994
+
1994
1995
let builders = [
1995
1996
OpBuilder<(ins "Value":$target,
1996
1997
"ArrayRef<OpFoldResult>":$mixedTileSizes,
@@ -2057,7 +2058,7 @@ def VectorizeOp : Op<Transform_Dialect, "structured.vectorize",
2057
2058
UnitAttr:$disable_transfer_permutation_map_lowering_patterns);
2058
2059
let results = (outs TransformHandleTypeInterface:$transformed);
2059
2060
2060
- let assemblyFormat =
2061
+ let assemblyFormat =
2061
2062
"$target attr-dict `:`"
2062
2063
"functional-type(operands, results)";
2063
2064
@@ -2279,16 +2280,16 @@ def HoistRedundantTensorSubsetsOp :
2279
2280
TransformOpInterface,
2280
2281
ReportTrackingListenerFailuresOpTrait]> {
2281
2282
let description = [{
2282
- Hoists supported tensor subset extract/insert operation pairs out of
2283
+ Hoists supported tensor subset extract/insert operation pairs out of
2283
2284
immediately enclosing loop iteratively, if the following conditions
2284
2285
are true:
2285
2286
1. The 2 ops access the same tensor subset.
2286
2287
2. All operands are invariant under the enclosing loop.
2287
-
2288
+
2288
2289
The supported subset extract/insert operation pairs currently comprise:
2289
2290
- tensor.extract_slice / tensor.insert_slice
2290
2291
- vector.transfer_read / vector.transfer_write on tensors
2291
-
2292
+
2292
2293
Only scf.for loops are currently supported.
2293
2294
2294
2295
When applied to:
@@ -2304,8 +2305,8 @@ def HoistRedundantTensorSubsetsOp :
2304
2305
let results = (outs);
2305
2306
2306
2307
let assemblyFormat = [{
2307
- $target
2308
- attr-dict
2308
+ $target
2309
+ attr-dict
2309
2310
`:` functional-type(operands, results)
2310
2311
}];
2311
2312
@@ -2328,15 +2329,15 @@ def InsertSliceToCopyOp :
2328
2329
TransformEachOpTrait, TransformOpInterface]> {
2329
2330
let description = [{
2330
2331
Targeted rewrite of an tensor.insert_slice to linalg.copy.
2331
- This is useful to materialize copies explicitly before bufferization and
2332
+ This is useful to materialize copies explicitly before bufferization and
2332
2333
transform them, avoiding the need to rediscover them after bufferization.
2333
2334
2334
2335
If the insert_slice source is already a linalg.copy, only return the source
2335
2336
op (i.e. do not create an additional linalg.copy op).
2336
2337
2337
2338
#### Return modes:
2338
2339
2339
- The operation always succeeds and returns a handle to the relevant
2340
+ The operation always succeeds and returns a handle to the relevant
2340
2341
linalg.copy op.
2341
2342
}];
2342
2343
0 commit comments