1//===- BufferizationBase.td - Bufferization dialect base ---*- 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 BUFFERIZATION_BASE
10#define BUFFERIZATION_BASE
11
12include "mlir/IR/OpBase.td"
13
14def Bufferization_Dialect : Dialect {
15  let name = "bufferization";
16  let cppNamespace = "::mlir::bufferization";
17  let description = [{
18    Bufferization in MLIR is the process of converting the `tensor` type to the
19    `memref` type.
20    The `bufferization` dialect is intended to collect operations/interfaces
21    specific to the bufferization passes.
22
23    Overview of the bufferization infrastructure and important conceptual
24    details related to using the MLIR dialect conversion infrastructure can be
25    found in [bufferization](/docs/Bufferization/) and [buffer
26    deallocation](/docs/BufferDeallocationInternals/).
27  }];
28  let dependentDialects = [
29    "AffineDialect", "memref::MemRefDialect", "tensor::TensorDialect"
30  ];
31
32  let extraClassDeclaration = [{
33    /// An attribute that can override writability of buffers of tensor function
34    /// arguments during One-Shot Module Bufferize.
35    constexpr const static ::llvm::StringLiteral
36        kWritableAttrName = "bufferization.writable";
37
38    /// Attribute name used to mark the bufferization layout for region
39    /// arguments during One-Shot Module Bufferize.
40    constexpr const static ::llvm::StringLiteral
41        kBufferLayoutAttrName = "bufferization.buffer_layout";
42
43    /// Attribute name used to mark escaping behavior of buffer allocations.
44    /// Escaping allocations cannot be deallocated in the same block and must
45    /// be treated specially: They are currently deallocated with the
46    /// BufferDeallocation pass.
47    ///
48    /// Note: Only ops with at least one OpResult that bufferizes to a buffer
49    /// allocation (as per BufferizableOpInterface) may have this attribute.
50    constexpr const static ::llvm::StringLiteral
51        kEscapeAttrName = "bufferization.escape";
52  }];
53  let hasOperationAttrVerify = 1;
54  let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
55}
56
57#endif // BUFFERIZATION_BASE
58