@@ -18,31 +18,35 @@ def Tensor_Dialect : Dialect {
1818 let description = [{
1919 The `tensor` dialect is intended to hold core tensor creation and
2020 manipulation ops, which are not strongly associated with any particular
21- other dialect or domain abstraction. The primary smoke test of this is ops
22- that make sense for any tensor element type.
23-
24- We leave it to other dialects to hold the vast swath of possible
25- computations one might want to do on a tensor.
26-
27- The `tensor` type is (for better or for worse) used to represent all kinds
28- of things, and supports an open-ended set of element types. Examples:
21+ other dialect or domain abstraction. The aim for ops in this dialect is
22+ that they make sense for any tensor element type. When this is not the
23+ case, the op is left to live in other dialects. Examples of element types
24+ that could be supported by the `tensor` dialect include:
2925
3026 - representing large, dense aggregations of primitive types, suitable for
3127 high-performance numerical computing.
32- - representing shapes in the `shape` dialect, which consist of small
33- 1D tensors of `index` data type.
28+ - representing shapes in the `shape` dialect, which consist of small 1D
29+ tensors of `index` data type.
3430 - representing aggregations of strings or “variant” types.
35- - representing large, sparse aggregations of primitive types, suitable
36- for high-performance numerical computing.
37-
38- Thus, for the `tensor` dialect, we prefer for now to constrain the
39- scope as much as possible. The expectation is that at some point
40- in the future, the `tensor` dialect’s scope may be broadened through a
41- careful discussion of the tradeoffs.
42-
43- The `tensor` type is actually a builtin type (it lives in the builtin
44- dialect), and does not live in this dialect.
31+ - representing large, sparse aggregations of primitive types, suitable for
32+ high-performance numerical computing.
4533
34+ Because of this broad element type support and because of the existence of
35+ more dedicated dialects, such as the `sparse_tensor` and `linalg` dialects,
36+ we prefer for now to keep the `tensor` dialect as small as possible. The
37+ expectation is that at some point in the future, the `tensor` dialect’s
38+ scope may be broadened through a careful discussion of the tradeoffs.
39+
40+ On the `tensor` type itself, note that it is actually a builtin type (it
41+ lives in the builtin dialect), and does not live in this dialect.
42+ Furthermore, a `tensor` is an immutable object. For example, this means
43+ that a copy will always be made of the `tensor` object when it is passed to
44+ the `dest` operand used by some ops in this dialect. As an optimization,
45+ an implementation can eliminate these copies during lowering when they
46+ are redundant and perform in-place mutation, see the [Destination-Passing
47+ Style](
48+ https://mlir.llvm.org/docs/Bufferization/#destination-passing-style)
49+ documentation for more information.
4650 }];
4751
4852 let hasCanonicalizer = 1;
0 commit comments