9#ifndef AIE_DIALECT_AIE_TRANSFORMS_AIEDMACHANNELANALYSIS_H
10#define AIE_DIALECT_AIE_TRANSFORMS_AIEDMACHANNELANALYSIS_H
14#include "llvm/ADT/DenseMap.h"
23 mlir::DenseMap<std::pair<int, int>, mlir::Value> tilesByCoordinate;
24 mlir::Value getTileKey(mlir::Value tile);
27 mlir::DenseMap<std::tuple<mlir::Value, DMAChannelDir, int>, mlir::Operation *>
31 mlir::DenseMap<std::tuple<mlir::Value, DMAChannelDir, int>, mlir::Operation *>
36 mlir::Operation *owner;
39 mlir::DenseMap<std::tuple<mlir::Value, DMAChannelDir, int>, StreamClaim>
47 bool requiresAdjacentTileAccessChannels);
54 bool requiresAdjacentTileAccessChannels,
55 mlir::Operation *owner =
nullptr);
59 bool isChannelFree(TileLike tile, DMAChannelDir dir,
int channel);
65 mlir::Operation *owner =
nullptr);
75 mlir::Operation *user,
DMAChannelAnalysis(DeviceOp &device)
int getDMAChannelIndex(TileLike tile, DMAChannelDir dir, bool requiresAdjacentTileAccessChannels, mlir::Operation *owner=nullptr)
Next free channel of tile in dir, or -1 when the tile has none left.
mlir::Operation * getDMAChannelOwner(TileLike tile, DMAChannelDir dir, int channel)
Operation reserving this channel, or else the flow routing it; null if neither.
bool isChannelFree(TileLike tile, DMAChannelDir dir, int channel)
Whether first-free assignment could hand out channel: nothing reserves it and no explicit flow routes...
int reservePinnedChannel(TileLike tile, DMAChannelDir dir, int channel, mlir::Operation *owner=nullptr)
Claim channel for (tile, dir) so first-free assignment cannot take it.
static int getDMAChannelLimit(TileLike tile, DMAChannelDir dir, bool requiresAdjacentTileAccessChannels)
Exclusive upper bound on channel indices eligible for this transfer.
mlir::LogicalResult checkAIEStreamIndex(TileLike tile, DMAChannel chan, mlir::Operation *user, bool packet=false)
Claim a raw stream port for user, reporting on it when the port is taken; packet users may share it w...
struct DMAChannel { DMAChannelDir direction; int channel; bool operator==(const DMAChannel &rhs) const { return std::tie(direction, channel)==std::tie(rhs.direction, rhs.channel); } } DMAChannel