11#ifndef MLIR_AIE_DIALECT_H
12#define MLIR_AIE_DIALECT_H
18#include "mlir/Dialect/Func/IR/FuncOps.h"
19#include "mlir/Dialect/MemRef/IR/MemRef.h"
20#include "mlir/IR/BuiltinAttributes.h"
21#include "mlir/IR/OpDefinition.h"
22#include "mlir/IR/OpImplementation.h"
28template <
typename ConcreteType>
30 static mlir::LogicalResult
verifyTrait(mlir::Operation *op);
35template <
typename ConcreteType>
38 static mlir::LogicalResult
verifyTrait(mlir::Operation *op);
41template <
typename ConcreteType>
48 uint32_t burstLength);
50 uint32_t burstLength);
58#include "aie/Dialect/AIE/IR/AIEInterfaces.h.inc"
63template <
typename ConcreteOp>
66 static ::mlir::LogicalResult
verifyTrait(::mlir::Operation *op) {
68 ::mlir::cast<::mlir::OffsetSizeAndStrideOpInterface>(op));
66 static ::mlir::LogicalResult
verifyTrait(::mlir::Operation *op) {
…}
73 : ::mlir::OffsetSizeAndStrideOpInterface {
74 template <
typename ConcreteOp>
80#include "aie/Dialect/AIE/IR/AIEDialect.h.inc"
92#define GET_TYPEDEF_CLASSES
93#include "aie/Dialect/AIE/IR/AIETypes.h.inc"
99#define GET_ATTRDEF_CLASSES
100#include "aie/Dialect/AIE/IR/AIEAttrs.h.inc"
110#define GENERATE_TO_STRING(TYPE_WITH_INSERTION_OP) \
111 friend std::string to_string(const TYPE_WITH_INSERTION_OP &s) { \
112 std::ostringstream ss; \
110#define GENERATE_TO_STRING(TYPE_WITH_INSERTION_OP) \ …
122 return std::tie(bundle,
channel) == std::tie(rhs.bundle, rhs.channel);
128 return std::tie(bundle,
channel) < std::tie(rhs.bundle, rhs.channel);
133 switch (
port.bundle) {
134 case WireBundle::Core:
137 case WireBundle::DMA:
140 case WireBundle::North:
143 case WireBundle::East:
146 case WireBundle::South:
149 case WireBundle::West:
156 os <<
": " << std::to_string(
port.channel) <<
")";
175 return std::tie(
src,
dst) == std::tie(rhs.src, rhs.dst);
180 DMAChannelDir direction;
184 return std::tie(direction,
channel) == std::tie(rhs.direction, rhs.channel);
193 mlir::OpAsmParser::UnresolvedOperand &operand,
194 BDDimLayoutArrayAttr &dimensions);
197 mlir::Operation *op, mlir::Value tile,
198 BDDimLayoutArrayAttr dimensions);
201 mlir::OpAsmParser &parser,
202 llvm::SmallVectorImpl<mlir::OpAsmParser::UnresolvedOperand> &tiles,
203 BDDimLayoutArrayArrayAttr &dimensions);
206 mlir::Operation *op, mlir::OperandRange tiles,
207 BDDimLayoutArrayArrayAttr dimensions);
214#define GET_OP_CLASSES
215#include "aie/Dialect/AIE/IR/AIEOps.h.inc"
219class ShimDMAAllocationOp;
222 std::optional<AIE::ShimDMAAllocationOp>
get(DeviceOp dev,
223 mlir::StringRef sym_name);
226 llvm::DenseMap<std::pair<DeviceOp, mlir::StringRef>,
227 std::optional<AIE::ShimDMAAllocationOp>>
229 std::optional<AIE::ShimDMAAllocationOp>
230 cachelessGet(DeviceOp dev, mlir::StringRef sym_name);
236void collectTiles(DeviceOp &device,
237 llvm::DenseMap<TileID, mlir::Operation *> &tiles);
241 llvm::DenseMap<mlir::Operation *, llvm::SmallVector<BufferOp, 4>> &buffers);
247struct DenseMapInfo<
xilinx::AIE::ObjectFifoAcquireOp> {
248 static xilinx::AIE::ObjectFifoAcquireOp getEmptyKey() {
249 auto *pointer = DenseMapInfo<void *>::getEmptyKey();
250 return xilinx::AIE::ObjectFifoAcquireOp::getFromOpaquePointer(pointer);
253 static xilinx::AIE::ObjectFifoAcquireOp getTombstoneKey() {
254 auto *pointer = DenseMapInfo<void *>::getTombstoneKey();
255 return xilinx::AIE::ObjectFifoAcquireOp::getFromOpaquePointer(pointer);
258 static unsigned getHashValue(xilinx::AIE::ObjectFifoAcquireOp val) {
259 return hash_value(val.getAsOpaquePointer());
262 static bool isEqual(xilinx::AIE::ObjectFifoAcquireOp lhs,
263 xilinx::AIE::ObjectFifoAcquireOp rhs) {
272struct DenseMapInfo<
xilinx::AIE::ObjectFifoCreateOp> {
274 auto *pointer = DenseMapInfo<void *>::getEmptyKey();
275 return xilinx::AIE::ObjectFifoCreateOp::getFromOpaquePointer(pointer);
279 auto *pointer = DenseMapInfo<void *>::getTombstoneKey();
280 return xilinx::AIE::ObjectFifoCreateOp::getFromOpaquePointer(pointer);
284 return hash_value(val.getAsOpaquePointer());
287 static bool isEqual(xilinx::AIE::ObjectFifoCreateOp lhs,
288 xilinx::AIE::ObjectFifoCreateOp rhs) {
287 static bool isEqual(xilinx::AIE::ObjectFifoCreateOp lhs, {
…}
272struct DenseMapInfo<
xilinx::AIE::ObjectFifoCreateOp> {
…};
294struct DenseMapInfo<
xilinx::AIE::DMAChannel> {
295 using FirstInfo = DenseMapInfo<xilinx::AIE::DMAChannelDir>;
299 return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()};
303 return {FirstInfo::getTombstoneKey(), SecondInfo::getTombstoneKey()};
307 return detail::combineHashValue(FirstInfo::getHashValue(d.direction),
308 SecondInfo::getHashValue(d.channel));
294struct DenseMapInfo<
xilinx::AIE::DMAChannel> {
…};
319 using FirstInfo = DenseMapInfo<xilinx::AIE::WireBundle>;
323 return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()};
327 return {FirstInfo::getTombstoneKey(), SecondInfo::getTombstoneKey()};
331 return detail::combineHashValue(FirstInfo::getHashValue(d.bundle),
332 SecondInfo::getHashValue(d.channel));
347 return a.bundle == b.bundle ? a.channel < b.channel : a.bundle < b.bundle;
354 std::size_t h1 = std::hash<xilinx::AIE::WireBundle>{}(p.bundle);
355 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)
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
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 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)
std::optional< AIE::ShimDMAAllocationOp > get(DeviceOp dev, mlir::StringRef sym_name)