11#ifndef MLIR_AIE_DIALECT_H
12#define MLIR_AIE_DIALECT_H
18#include "mlir/Dialect/DLTI/Traits.h"
19#include "mlir/Dialect/Func/IR/FuncOps.h"
20#include "mlir/Dialect/MemRef/IR/MemRef.h"
21#include "mlir/IR/BuiltinAttributes.h"
22#include "mlir/IR/OpDefinition.h"
23#include "mlir/IR/OpImplementation.h"
24#include "mlir/Interfaces/DataLayoutInterfaces.h"
26#include "llvm/ADT/StringRef.h"
32template <
typename ConcreteType>
34 static mlir::LogicalResult
verifyTrait(mlir::Operation *op);
39template <
typename ConcreteType>
42 static mlir::LogicalResult
verifyTrait(mlir::Operation *op);
45template <
typename ConcreteType>
51template <
typename ConcreteType>
58 uint32_t burstLength);
60 uint32_t burstLength);
68#include "aie/Dialect/AIE/IR/AIEInterfaces.h.inc"
73template <
typename ConcreteOp>
76 static ::mlir::LogicalResult
verifyTrait(::mlir::Operation *op) {
78 ::mlir::cast<::mlir::OffsetSizeAndStrideOpInterface>(op));
83 : ::mlir::OffsetSizeAndStrideOpInterface {
84 template <
typename ConcreteOp>
90#include "aie/Dialect/AIE/IR/AIEDialect.h.inc"
102#define GET_TYPEDEF_CLASSES
103#include "aie/Dialect/AIE/IR/AIETypes.h.inc"
109#define GET_ATTRDEF_CLASSES
110#include "aie/Dialect/AIE/IR/AIEAttrs.h.inc"
120#define GENERATE_TO_STRING(TYPE_WITH_INSERTION_OP) \
121 friend std::string to_string(const TYPE_WITH_INSERTION_OP &s) { \
122 std::ostringstream ss; \
132 return std::tie(bundle,
channel) == std::tie(rhs.bundle, rhs.channel);
138 return std::tie(bundle,
channel) < std::tie(rhs.bundle, rhs.channel);
143 os << stringifyWireBundle(
port.bundle).str();
144 os <<
": " << std::to_string(
port.channel) <<
")";
162 return std::tie(
src,
dst) == std::tie(rhs.src, rhs.dst);
168 return std::tie(
src,
dst) < std::tie(rhs.src, rhs.dst);
173 DMAChannelDir direction;
177 return std::tie(direction,
channel) == std::tie(rhs.direction, rhs.channel);
186 mlir::OpAsmParser::UnresolvedOperand &operand,
187 BDDimLayoutArrayAttr &dimensions);
190 mlir::Operation *op, mlir::Value tile,
191 BDDimLayoutArrayAttr dimensions);
194 mlir::OpAsmParser &parser,
195 llvm::SmallVectorImpl<mlir::OpAsmParser::UnresolvedOperand> &tiles,
196 BDDimLayoutArrayArrayAttr &dimensions);
199 mlir::Operation *op, mlir::OperandRange tiles,
200 BDDimLayoutArrayArrayAttr dimensions);
206 mlir::Attribute &result);
212#define GET_OP_CLASSES
213#include "aie/Dialect/AIE/IR/AIEOps.h.inc"
218 llvm::DenseMap<TileID, mlir::Operation *> &tiles);
222 llvm::DenseMap<mlir::Operation *, llvm::SmallVector<BufferOp, 4>> &buffers);
228struct DenseMapInfo<
xilinx::AIE::ObjectFifoAcquireOp> {
230 auto *pointer = DenseMapInfo<void *>::getEmptyKey();
231 return xilinx::AIE::ObjectFifoAcquireOp::getFromOpaquePointer(pointer);
235 auto *pointer = DenseMapInfo<void *>::getTombstoneKey();
236 return xilinx::AIE::ObjectFifoAcquireOp::getFromOpaquePointer(pointer);
240 return hash_value(val.getAsOpaquePointer());
243 static bool isEqual(xilinx::AIE::ObjectFifoAcquireOp lhs,
244 xilinx::AIE::ObjectFifoAcquireOp rhs) {
253struct DenseMapInfo<
xilinx::AIE::ObjectFifoCreateOp> {
255 auto *pointer = DenseMapInfo<void *>::getEmptyKey();
256 return xilinx::AIE::ObjectFifoCreateOp::getFromOpaquePointer(pointer);
260 auto *pointer = DenseMapInfo<void *>::getTombstoneKey();
261 return xilinx::AIE::ObjectFifoCreateOp::getFromOpaquePointer(pointer);
265 return hash_value(val.getAsOpaquePointer());
268 static bool isEqual(xilinx::AIE::ObjectFifoCreateOp lhs,
269 xilinx::AIE::ObjectFifoCreateOp rhs) {
275struct DenseMapInfo<
xilinx::AIE::DMAChannel> {
276 using FirstInfo = DenseMapInfo<xilinx::AIE::DMAChannelDir>;
280 return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()};
284 return {FirstInfo::getTombstoneKey(), SecondInfo::getTombstoneKey()};
288 return detail::combineHashValue(FirstInfo::getHashValue(d.direction),
289 SecondInfo::getHashValue(d.channel));
300 using FirstInfo = DenseMapInfo<xilinx::AIE::WireBundle>;
304 return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()};
308 return {FirstInfo::getTombstoneKey(), SecondInfo::getTombstoneKey()};
312 return detail::combineHashValue(FirstInfo::getHashValue(d.bundle),
313 SecondInfo::getHashValue(d.channel));
328 return a.bundle == b.bundle ? a.channel < b.channel : a.bundle < b.bundle;
335 std::size_t h1 = std::hash<xilinx::AIE::WireBundle>{}(p.bundle);
336 std::size_t h2 = std::hash<int>{}(p.channel);
#define GENERATE_TO_STRING(TYPE_WITH_INSERTION_OP)
Include the generated interface declarations.
void printObjectFifoConsumerTiles(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRange tiles, BDDimLayoutArrayArrayAttr dimensions)
Connect { Port src Connect
uint32_t getShimBurstLengthBytes(const AIE::AIETargetModel &tm, uint32_t burstLength)
void collectTiles(DeviceOp &device, llvm::DenseMap< TileID, mlir::Operation * > &tiles)
void collectBuffers(DeviceOp &device, llvm::DenseMap< mlir::Operation *, llvm::SmallVector< BufferOp, 4 > > &buffers)
mlir::ParseResult parseTraceEvent(mlir::AsmParser &parser, mlir::Attribute &result)
mlir::LogicalResult verifyOffsetSizeAndStrideOp(mlir::OffsetSizeAndStrideOpInterface op)
void registerAIETranslations()
friend std::ostream & operator<<(std::ostream &os, const Port &port)
friend std::string to_string(const TileID &s)
DMAChannel { DMAChannelDir direction DMAChannel
uint32_t getShimBurstLengthEncoding(const AIE::AIETargetModel &tm, uint32_t burstLength)
int32_t getBufferBaseAddress(mlir::Operation *bufOp)
bool operator!=(const Port &rhs) const
Port { WireBundle bundle Port
const AIETargetModel & getTargetModel(mlir::Operation *op)
mlir::ParseResult parseObjectFifoProducerTile(mlir::OpAsmParser &parser, mlir::OpAsmParser::UnresolvedOperand &operand, BDDimLayoutArrayAttr &dimensions)
bool operator==(const Port &rhs) const
void printTraceEventEnum(mlir::AsmPrinter &printer, mlir::Attribute attr)
mlir::LogicalResult myVerifyOffsetSizeAndStrideOp(mlir::OffsetSizeAndStrideOpInterface op)
void printObjectFifoProducerTile(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::Value tile, BDDimLayoutArrayAttr dimensions)
bool operator<(const Port &rhs) const
mlir::ParseResult parseObjectFifoConsumerTiles(mlir::OpAsmParser &parser, llvm::SmallVectorImpl< mlir::OpAsmParser::UnresolvedOperand > &tiles, BDDimLayoutArrayArrayAttr &dimensions)
WireBundle getConnectingBundle(WireBundle dir)
static bool isEqual(const xilinx::AIE::DMAChannel &lhs, const xilinx::AIE::DMAChannel &rhs)
DenseMapInfo< int > SecondInfo
DenseMapInfo< xilinx::AIE::DMAChannelDir > FirstInfo
static unsigned getHashValue(const xilinx::AIE::DMAChannel &d)
static xilinx::AIE::DMAChannel getTombstoneKey()
static xilinx::AIE::DMAChannel getEmptyKey()
static xilinx::AIE::ObjectFifoAcquireOp getEmptyKey()
static bool isEqual(xilinx::AIE::ObjectFifoAcquireOp lhs, xilinx::AIE::ObjectFifoAcquireOp rhs)
static xilinx::AIE::ObjectFifoAcquireOp getTombstoneKey()
static unsigned getHashValue(xilinx::AIE::ObjectFifoAcquireOp val)
static bool isEqual(xilinx::AIE::ObjectFifoCreateOp lhs, xilinx::AIE::ObjectFifoCreateOp rhs)
static unsigned getHashValue(xilinx::AIE::ObjectFifoCreateOp val)
static xilinx::AIE::ObjectFifoCreateOp getTombstoneKey()
static xilinx::AIE::ObjectFifoCreateOp getEmptyKey()
static xilinx::AIE::Port getTombstoneKey()
static unsigned getHashValue(const xilinx::AIE::Port &d)
DenseMapInfo< int > SecondInfo
DenseMapInfo< xilinx::AIE::WireBundle > FirstInfo
static xilinx::AIE::Port getEmptyKey()
static bool isEqual(const xilinx::AIE::Port &lhs, const xilinx::AIE::Port &rhs)
std::size_t operator()(const xilinx::AIE::Port &p) const noexcept
bool operator()(const xilinx::AIE::Port &a, const xilinx::AIE::Port &b) const
static mlir::LogicalResult verifyTrait(mlir::Operation *op)
static mlir::LogicalResult verifyTrait(mlir::Operation *op)
::mlir::LogicalResult verifyTrait(::mlir::Operation *op)