1//===- TensorBase.td - Base definitions for tensor dialect -*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef TENSOR_BASE
10#define TENSOR_BASE
11
12include "mlir/IR/OpBase.td"
13
14def Tensor_Dialect : Dialect {
15  let name = "tensor";
16  let cppNamespace = "::mlir::tensor";
17
18  let description = [{
19    The `tensor` dialect is intended to hold core tensor creation and
20    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:
29
30    - representing large, dense aggregations of primitive types, suitable for
31      high-performance numerical computing.
32    - representing shapes in the `shape` dialect, which consist of small
33      1D tensors of `index` data type.
34    - 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.
45
46  }];
47
48  let hasConstantMaterializer = 1;
49  let dependentDialects = [
50    "arith::ArithmeticDialect",
51    "complex::ComplexDialect",
52  ];
53
54  // TODO: flip post changing ViewLike interface.
55  let emitAccessorPrefix = kEmitAccessorPrefix_Both;
56}
57
58#endif // TENSOR_BASE
59