8#ifndef MLIR_AIE_DEVICEMODEL_H
9#define MLIR_AIE_DEVICEMODEL_H
14#include "llvm/ADT/ArrayRef.h"
15#include "llvm/ADT/DenseSet.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/SmallVector.h"
18#include "llvm/Support/MathExtras.h"
31 os <<
"TileID(" << s.col <<
", " << s.row <<
")";
35 friend std::string to_string(
const TileID &s) {
36 std::ostringstream ss;
41 friend llvm::raw_ostream &
operator<<(llvm::raw_ostream &os,
const TileID &s) {
47 inline bool operator<(
const TileID &rhs)
const {
48 return std::tie(col, row) < std::tie(rhs.col, rhs.row);
51 bool operator==(
const TileID &rhs)
const {
52 return std::tie(col, row) == std::tie(rhs.col, rhs.row);
55 bool operator!=(
const TileID &rhs)
const {
return !(*
this == rhs); }
67 return width >= 32 ? 0xFFFFFFFFu : (1u <<
width) - 1;
69 uint32_t
place(uint64_t value)
const {
94 llvm::SmallVector<std::pair<DmaBdField, DmaBdField>, 3>
padFields()
const {
95 llvm::SmallVector<std::pair<DmaBdField, DmaBdField>, 3> fields;
96 for (std::pair<DmaBdField, DmaBdField> field :
100 if (!field.first.exists())
102 fields.push_back(field);
163 uint32_t ModelProperties = 0;
167 mutable std::unique_ptr<RegisterDatabase> regDB;
168 mutable std::once_flag regDBInitFlag;
206 std::vector<int> starts;
238 return getTileType(col, row) == AIETileType::CoreTile;
243 return getTileType(col, row) == AIETileType::MemTile;
248 return getTileType(col, row) == AIETileType::ShimNOCTile;
253 return getTileType(col, row) == AIETileType::ShimPLTile;
259 return t == AIETileType::ShimNOCTile || t == AIETileType::ShimPLTile;
264 return src.col >= 0 && src.col <
columns() && src.row >= 0 &&
282 bool isInternal(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const {
283 return srcCol == dstCol && srcRow == dstRow;
287 bool isWest(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const {
288 return srcCol == dstCol + 1 && srcRow == dstRow;
292 bool isEast(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const {
293 return srcCol == dstCol - 1 && srcRow == dstRow;
297 bool isNorth(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const {
298 return srcCol == dstCol && srcRow == dstRow - 1;
302 bool isSouth(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const {
303 return srcCol == dstCol && srcRow == dstRow + 1;
315 std::pair{dstCol - srcCol, dstRow - srcRow});
319 virtual bool isMemWest(
int srcCol,
int srcRow,
int dstCol,
320 int dstRow)
const = 0;
322 virtual bool isMemEast(
int srcCol,
int srcRow,
int dstCol,
323 int dstRow)
const = 0;
326 int dstRow)
const = 0;
329 int dstRow)
const = 0;
333 int memRow)
const = 0;
357 if (aReachesB && bReachesA) {
420 return arch == AIEArch::AIE2p || arch == AIEArch::AIE2ps ? 64 : 32;
474 virtual uint32_t
getNumBDs(AIETileType tileType)
const = 0;
506 virtual std::optional<uint32_t>
508 uint32_t channel,
bool master)
const = 0;
544 DMAChannelDir dir)
const {
566 std::pair<uint32_t, uint32_t>
568 DMAChannelDir dir)
const {
569 uint32_t pool =
getBdPoolId(col, row, channel, dir);
575 DMAChannelDir dir)
const {
581 DMAChannelDir dir)
const {
583 return bd_id >= first && bd_id < last;
587 DMAChannelDir dir)
const {
597 for (DMAChannelDir dir : {DMAChannelDir::MM2S, DMAChannelDir::S2MM}) {
609 for (uint32_t bd = 0; bd <
getNumBDs(col, row); ++bd)
627 DMAChannelDir direction)
const {
634 DMAChannelDir direction)
const {
641 return layout ? layout->
stepBias : 1;
662 int col,
int row, uint32_t bd_id,
int channel = -1,
663 AIE::DMAChannelDir direction = AIE::DMAChannelDir::MM2S)
const = 0;
672 AIE::DMAChannelDir direction)
const = 0;
679 virtual std::optional<uint32_t>
681 AIE::DMAChannelDir )
const {
698 AIE::DMAChannelDir direction)
const {
704 AIE::DMAChannelDir direction)
const {
721 WireBundle bundle)
const = 0;
726 WireBundle bundle)
const = 0;
730 WireBundle bundle)
const = 0;
734 WireBundle bundle)
const = 0;
750 return channel >= 0 &&
static_cast<uint32_t
>(channel) <
786 AIE::DMAChannelDir )
const {
792 int srcChan, WireBundle dstBundle,
793 int dstChan)
const = 0;
819 (
static_cast<uint32_t
>(row & 0xff) <<
getRowShift());
843 virtual std::vector<std::pair<uint32_t, uint32_t>>
864 bool isMem =
false)
const;
871 bool isMem =
false)
const;
876 uint32_t value)
const;
885 llvm::DenseMap<TileID, int>
915 bool isMemWest(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
916 bool isMemEast(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
917 bool isMemNorth(
int srcCol,
int srcRow,
int dstCol,
918 int dstRow)
const override;
919 bool isMemSouth(
int srcCol,
int srcRow,
int dstCol,
920 int dstRow)
const override;
923 int memRow)
const override;
926 if (src.row % 2 == 0)
950 TileID tile)
const override;
951 uint32_t
getNumBDs(AIETileType tileType)
const override {
962 if (tileType == AIETileType::CoreTile)
964 return 0xFFFFFFFFull;
968 return tileType == AIETileType::CoreTile ? 8 : 10;
972 return tileType == AIETileType::CoreTile ? 13 : 20;
978 uint64_t
getDmaBdAddress(
int col,
int row, uint32_t bd_id,
int channel,
979 AIE::DMAChannelDir direction)
const override;
984 AIE::DMAChannelDir direction)
const override;
988 uint32_t
getNumBanks(
int col,
int row)
const override {
return 4; }
995 WireBundle bundle)
const override;
997 WireBundle bundle)
const override;
999 WireBundle bundle)
const override;
1001 WireBundle bundle)
const override;
1003 int srcChan, WireBundle dstBundle,
1004 int dstChan)
const override;
1009 bool master)
const override;
1019 std::vector<std::pair<uint32_t, uint32_t>>
1041 static constexpr std::pair<int, int> steps[] = {{0, -1}, {1, 0}};
1060 bool isMemWest(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
1061 bool isMemEast(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
1062 bool isMemNorth(
int srcCol,
int srcRow,
int dstCol,
1063 int dstRow)
const override;
1064 bool isMemSouth(
int srcCol,
int srcRow,
int dstCol,
1065 int dstRow)
const override;
1068 int memRow)
const override;
1087 return tileType == AIETileType::MemTile ? 64 : 16;
1093 TileID tile)
const override;
1096 return tileType == AIETileType::MemTile ? 48 : 16;
1100 return tileType == AIETileType::MemTile ? 4 : 3;
1106 return layout ? *layout : *
getDmaBdLayout(AIETileType::ShimNOCTile);
1123 DMAChannelDir dir)
const override {
1124 return isMemTile(col, row) ? channel & 1 : 0;
1127 return isMemTile(col, row) && poolId == 1 ? 24 : 0;
1136 uint64_t
getDmaBdAddress(
int col,
int row, uint32_t bd_id,
int channel,
1137 AIE::DMAChannelDir direction)
const override;
1142 AIE::DMAChannelDir direction)
const override;
1143 std::optional<uint32_t>
1145 AIE::DMAChannelDir direction)
const override;
1159 return getTileType(col, row) == AIETileType::MemTile ? 8 : 4;
1167 WireBundle bundle)
const override;
1169 WireBundle bundle)
const override;
1171 WireBundle bundle)
const override;
1173 WireBundle bundle)
const override;
1175 int srcChan, WireBundle dstBundle,
1176 int dstChan)
const override;
1181 bool master)
const override;
1191 std::vector<std::pair<uint32_t, uint32_t>>
1212 std::vector<std::pair<uint32_t, uint32_t>>
1214 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256),
1222 uint64_t
getDmaBdAddress(
int col,
int row, uint32_t bd_id,
int channel,
1223 AIE::DMAChannelDir direction)
const override;
1225 AIE::DMAChannelDir direction)
const override;
1226 std::optional<uint32_t>
1228 AIE::DMAChannelDir direction)
const override;
1231 WireBundle bundle)
const override;
1233 WireBundle bundle)
const override;
1237 bool master)
const override;
1252 int rows()
const override {
return 7; }
1259 return AIETileType::ShimNOCTile;
1261 return AIETileType::MemTile;
1262 return AIETileType::CoreTile;
1273 llvm::SmallDenseSet<unsigned, 16> nocColumns = {
1274 2, 3, 6, 7, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 46, 47};
1283 int rows()
const override {
return 9; }
1287 return nocColumns.contains(col) ? AIETileType::ShimNOCTile
1288 : AIETileType::ShimPLTile;
1290 return AIETileType::CoreTile;
1299 llvm::SmallDenseSet<unsigned, 8> nocColumns = {2, 3, 6, 7, 10, 11};
1312 return nocColumns.contains(col) ? AIETileType::ShimNOCTile
1313 : AIETileType::ShimPLTile;
1316 return AIETileType::MemTile;
1317 return AIETileType::CoreTile;
1328 llvm::SmallDenseSet<unsigned, 16> nocColumns = {2, 3, 6, 7, 14, 15,
1329 22, 23, 30, 31, 34, 35};
1342 return nocColumns.contains(col) ? AIETileType::ShimNOCTile
1343 : AIETileType::ShimPLTile;
1345 if (row == 1 || row == 2)
1346 return AIETileType::MemTile;
1347 return AIETileType::CoreTile;
1398 return AIETileType::ShimNOCTile;
1400 return AIETileType::MemTile;
1401 return AIETileType::CoreTile;
1430 return AIETileType::ShimNOCTile;
1432 return AIETileType::MemTile;
1433 return AIETileType::CoreTile;
1438 std::vector<std::pair<uint32_t, uint32_t>>
1505 static constexpr std::pair<int, int> steps[] = {{0, -1}, {1, 0}};
1525 return std::nullopt;
1529 return std::nullopt;
1532 return std::nullopt;
1535 bool isMemWest(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
1536 bool isMemEast(
int srcCol,
int srcRow,
int dstCol,
int dstRow)
const override;
1537 bool isMemNorth(
int srcCol,
int srcRow,
int dstCol,
1538 int dstRow)
const override;
1539 bool isMemSouth(
int srcCol,
int srcRow,
int dstCol,
1540 int dstRow)
const override;
1543 int memRow)
const override;
1560 if (tileType == AIETileType::MemTile)
1562 if (tileType == AIETileType::ShimNOCTile)
1568 TileID tile)
const override;
1574 int lockRow)
const override;
1577 int memRow)
const override;
1581 return tileType == AIETileType::ShimNOCTile ? 32 : 16;
1586 if (tileType == AIETileType::MemTile)
1587 return 16 * (10 + 8);
1588 if (tileType == AIETileType::ShimNOCTile)
1589 return 32 + 2 * 8 + 4;
1596 uint32_t
getBdPoolId(
int col,
int row,
int channel,
1597 DMAChannelDir dir)
const override;
1598 uint32_t
getBdPoolStartId(
int col,
int row, uint32_t poolId)
const override;
1599 uint32_t
getNumBDsInPool(
int col,
int row, uint32_t poolId)
const override;
1604 return tileType == AIETileType::CoreTile ? 3 : 4;
1611 DMAChannelDir direction)
const override;
1615 return layout ? *layout : *
getDmaBdLayout(AIETileType::ShimNOCTile);
1632 uint64_t
getDmaBdAddress(
int col,
int row, uint32_t bd_id,
int channel,
1633 AIE::DMAChannelDir direction)
const override;
1636 AIE::DMAChannelDir direction)
const override;
1647 WireBundle bundle)
const override;
1649 WireBundle bundle)
const override;
1651 WireBundle bundle)
const override;
1653 WireBundle bundle)
const override;
1654 bool hasShimMux(
int col,
int row)
const override {
return false; }
1656 int srcChan, WireBundle dstBundle,
1657 int dstChan)
const override;
1663 bool master)
const override {
1664 return std::nullopt;
1670 std::vector<std::pair<uint32_t, uint32_t>>
1700 return AIETileType::ShimNOCTile;
1702 return AIETileType::MemTile;
1703 return AIETileType::CoreTile;
1751 if (llvm::isa<AIE4TargetModel>(tm))
1753 return llvm::isa<BaseNPU2TargetModel>(tm) ? 4 : 3;
1765 return detail::combineHashValue(FirstInfo::getHashValue(t.col),
1766 SecondInfo::getHashValue(t.row));
1779 std::size_t h1 = std::hash<int>{}(s.col);
1780 std::size_t h2 = std::hash<int>{}(s.row);
1781 return h1 ^ (h2 << 1);
uint32_t getLocalMemorySize() const override
Return the size (in bytes) of the local data memory of a core.
uint32_t getDmaBdIterBits(AIETileType tileType) const override
Return the bit width of the iteration (repeat) wrap/stride fields in a DMA buffer descriptor for the ...
uint32_t getNumMemTileRows() const override
uint32_t getMaxOutOfOrderId() const override
Return the largest out-of-order BD id (unsupported = 0).
bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is North of dst.
uint32_t getMemWestBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getNumBanks(int col, int row) const override
Return the number of memory banks of a given tile.
uint64_t getDmaBdMaxLen(AIETileType tileType) const override
Return the maximum transfer length, measured in address-generation granules (see getAddressGenGranula...
uint32_t getDmaBdWrapBits(AIETileType tileType) const override
Return the bit width of the wrap (size) field in a DMA buffer descriptor for the given tile type.
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
std::optional< TileID > getMemSouth(TileID src) const override
Return the tile ID of the memory to the south of the given tile, if it exists.
std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const override
uint32_t getCoreDataAddressSpaceSize() const override
Return the size (in bytes) of the address space a core can issue data accesses into.
uint32_t getProgramMemorySize() const override
Return the size (in bytes) of a core's program memory.
static bool classof(const AIETargetModel *model)
std::optional< TileID > getMemNorth(TileID src) const override
Return the tile ID of the memory to the north of the given tile, if it exists.
uint32_t getMemInternalBaseAddress(TileID src) const override
Return the base address in the local address map for a core.
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t port_num, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
uint32_t getDmaTaskQueueDepth() const override
Return how many DMA tasks a single channel's task queue holds (unsupported = 0).
uint32_t getDmaBdStepBits(AIETileType tileType) const override
Return the bit width of the step (stride) field in a DMA buffer descriptor for the given tile type.
bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is South of dst.
uint32_t getMemEastBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getMaxRepeatCount() const override
Return the largest DMA task repeat count (unsupported = 0).
std::optional< TileID > getMemWest(TileID src) const override
Return the tile ID of the memory to the west of the given tile, if it exists.
bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const override
Return true if core can access the memory in mem.
uint32_t getNumMselsPerArbiter() const override
Return the number of master select values per stream-switch arbiter.
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
uint32_t getRowShift() const override
uint32_t getBDMaxDims(AIETileType tileType) const override
Return the maximum number of addressing dimensions (wraps/strides) a single buffer descriptor support...
uint32_t getNumArbiters() const override
Return the number of arbiters per stream switch.
uint32_t getNumSlaveSlots() const override
Return the number of packet-rule slots per stream-switch slave port.
uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a shimmux.
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
uint32_t getColumnShift() const override
bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is East of dst.
uint32_t getComputeTileMaxVectorAlignBits() const override
Return the alignment (in bits) required by the widest vector load/store a compute core can issue.
bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is West of dst.
uint32_t getNumLocks(AIETileType tileType) const override
Return the number of lock objects for a given tile type.
uint32_t getDmaBdAddressOffset(int col, int row) const override
Return the offset of the base address field within the shim dma buffer descriptor.
uint32_t getComputeTileLoadStoreBusWidth() const override
Return the data bus width (in bits) for load/store operations of a compute core.
uint32_t getAccumulatorCascadeSize() const override
Return the size (in bits) of the accumulator/cascade.
AIE1TargetModel(TargetModelKind k)
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
uint32_t getMemTileSize() const override
Return the size (in bytes) of a MemTile.
uint32_t getMemSouthBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getMaxChannelNumForAdjacentMemTile(int col, int row) const override
AIEArch getTargetArch() const override
AIE1 TargetModel.
uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a shimmux.
uint32_t getMemNorthBaseAddress() const override
Return the base address in the local address map for a core.
std::optional< TileID > getMemEast(TileID src) const override
Return the tile ID of the memory to the east of the given tile, if it exists.
uint32_t getNumBDs(AIETileType tileType) const override
Return the size of the BD id space of a tile type (see getTotalNumBDs()).
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
uint32_t getMaxLockValue() const override
Return the maximum value that can be stored in a lock register.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
uint32_t getMaxPacketId() const override
Return the largest packet id the stream switch can route.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
AIEArch getTargetArch() const override
Return the target architecture.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
std::optional< uint32_t > getDmaStatusAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the address of the DMA status register for a channel, or nullopt when this target's layout has...
uint32_t getNumControllersPerColumn() const override
Number of microcontrollers (uC) per column.
uint32_t getComputeTileMaxVectorAlignBits() const override
Return the alignment (in bits) required by the widest vector load/store a compute core can issue.
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t channel, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
AIE2PSTargetModel(TargetModelKind k)
static bool classof(const AIETargetModel *model)
uint32_t getRowShift() const override
uint32_t getMemWestBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getMemSouthBaseAddress() const override
Return the base address in the local address map for a core.
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
uint32_t getBdPoolStartId(int col, int row, uint32_t poolId) const override
llvm::ArrayRef< std::pair< int, int > > getCascadeSteps() const override
The steps (destination column - source column, destination row - source row) from one core's cascade ...
uint32_t getNumMselsPerArbiter() const override
Return the number of master select values per stream-switch arbiter.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
uint32_t getComputeTileMaxVectorAlignBits() const override
Return the alignment (in bits) required by the widest vector load/store a compute core can issue.
uint32_t getCoreDataAddressSpaceSize() const override
Return the size (in bytes) of the address space a core can issue data accesses into.
uint32_t getNumLocks(AIETileType tileType) const override
Return the number of lock objects for a given tile type.
std::optional< uint32_t > getDmaStatusAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the address of the DMA status register for a channel, or nullopt when this target's layout has...
uint32_t getMaxChannelNumForAdjacentMemTile(int col, int row) const override
uint32_t getAddressGenGranularity() const override
Return the data bus width of the device.
std::optional< TileID > getMemWest(TileID src) const override
Return the tile ID of the memory to the west of the given tile, if it exists.
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t port_num, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
uint32_t getAccumulatorCascadeSize() const override
Return the size (in bits) of the accumulator/cascade.
uint32_t getMaxRepeatCount() const override
Return the largest DMA task repeat count (unsupported = 0).
std::unique_ptr< RegisterDatabase > loadRegisterDatabase() const override
AIE2 TargetModel.
uint32_t getNumBDsInPool(int col, int row, uint32_t poolId) const override
uint32_t getDmaBdIterBits(AIETileType tileType) const override
Return the bit width of the iteration (repeat) wrap/stride fields in a DMA buffer descriptor for the ...
AIEArch getTargetArch() const override
Return the target architecture.
bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const override
Return true if core can access the memory in mem.
std::optional< TileID > getMemEast(TileID src) const override
Return the tile ID of the memory to the east of the given tile, if it exists.
uint32_t getDmaChannelIdleMask() const override
Return the bits of the getDmaStatusAddress() register that are all clear exactly when the channel has...
uint32_t getMaxOutOfOrderId() const override
Return the largest out-of-order BD id (unsupported = 0).
uint32_t getMaxLockValue() const override
Return the maximum value that can be stored in a lock register.
uint64_t getDmaBdMaxLen(AIETileType tileType) const override
Return the maximum transfer length, measured in address-generation granules (see getAddressGenGranula...
uint32_t getDmaBdWrapBits(AIETileType tileType) const override
Return the bit width of the wrap (size) field in a DMA buffer descriptor for the given tile type.
uint32_t getBDMaxDims(AIETileType tileType) const override
Return the maximum number of addressing dimensions (wraps/strides) a single buffer descriptor support...
uint32_t getNumArbiters() const override
Return the number of arbiters per stream switch.
bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is North of dst.
uint32_t getMaxPacketId() const override
Return the largest packet id the stream switch can route.
uint32_t getLocalMemorySize() const override
Return the size (in bytes) of the local data memory of a core.
uint32_t getMemNorthBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a shimmux.
const DmaBdLayout & getDmaBdLimits(AIETileType tileType) const
uint32_t getColumnShift() const override
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
uint32_t getDmaBdStepBits(AIETileType tileType) const override
Return the bit width of the step (stride) field in a DMA buffer descriptor for the given tile type.
uint32_t getMemEastBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getMemInternalBaseAddress(TileID src) const override
Return the base address in the local address map for a core.
uint32_t getBdPoolId(int col, int row, int channel, DMAChannelDir dir) const override
Memtile: even channels use BDs 0-23, odd channels 24-47.
uint32_t getNumBanks(int col, int row) const override
Return the number of memory banks of a given tile.
static bool classof(const AIETargetModel *model)
AIE2TargetModel(TargetModelKind k)
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
uint32_t getNumBDs(AIETileType tileType) const override
Return the size of the BD id space of a tile type (see getTotalNumBDs()).
std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const override
uint32_t getComputeTileLoadStoreBusWidth() const override
Return the data bus width (in bits) for load/store operations of a compute core.
std::optional< TileID > getMemSouth(TileID src) const override
Return the tile ID of the memory to the south of the given tile, if it exists.
const DmaBdLayout * getDmaBdLayout(AIETileType tileType) const override
Return the register layout of a buffer descriptor on the given tile type, or null if the target has n...
uint32_t getMemTileSize() const override
Return the size (in bytes) of a MemTile.
uint32_t getProgramMemorySize() const override
Return the size (in bytes) of a core's program memory.
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is West of dst.
uint32_t getDmaTaskQueueSizeMask() const override
Return the mask selecting the live task-queue occupancy field within the getDmaStatusAddress() regist...
bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is South of dst.
uint32_t getDmaTaskQueueDepth() const override
Return how many DMA tasks a single channel's task queue holds (unsupported = 0).
uint32_t getNumSlaveSlots() const override
Return the number of packet-rule slots per stream-switch slave port.
std::optional< TileID > getMemNorth(TileID src) const override
Return the tile ID of the memory to the north of the given tile, if it exists.
bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is East of dst.
uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a shimmux.
uint32_t getDmaBdAddressOffset(int col, int row) const override
Return the offset of the base address field within the shim dma buffer descriptor.
uint32_t getNumLocks(AIETileType tileType) const override
Return the number of lock objects for a given tile type.
uint32_t getRowShift() const override
std::optional< TileID > getMemEast(TileID src) const override
Return the tile ID of the memory to the east of the given tile, if it exists.
uint32_t getBDMaxDims(AIETileType tileType) const override
Return the maximum number of addressing dimensions (wraps/strides) a single buffer descriptor support...
uint32_t getTotalNumBDs(AIETileType tileType) const override
Memtile: 16 BDs per each of 10 MM2S + 8 S2MM channels.
uint32_t getComputeTileLoadStoreBusWidth() const override
Return the data bus width (in bits) for load/store operations of a compute core.
std::optional< TileID > getMemWest(TileID) const override
A core reaches only its own data memory, through the east window.
const DmaBdLayout * getDmaBdLayout(AIETileType tileType) const override
Return the register layout of a buffer descriptor on the given tile type, or null if the target has n...
uint32_t getDmaBdWrapBits(AIETileType tileType) const override
Return the bit width of the wrap (size) field in a DMA buffer descriptor for the given tile type.
uint32_t getNumSlaveSlots() const override
Return the number of packet-rule slots per stream-switch slave port.
static bool classof(const AIETargetModel *model)
AIE4TargetModel(TargetModelKind k)
uint32_t getDefaultAxCache() const override
AxCACHE 0 is the hardware-proven value on AIE4.
std::optional< TileID > getMemNorth(TileID) const override
Return the tile ID of the memory to the north of the given tile, if it exists.
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Shim data BDs need no channel; control, trace and memtile BDs do (fatal error without one).
uint32_t getProgramMemorySize() const override
Return the size (in bytes) of a core's program memory.
uint32_t getNumArbiters() const override
Return the number of arbiters per stream switch.
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
uint32_t getBdPoolStartId(int col, int row, uint32_t poolId) const override
bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is West of dst.
uint32_t getTileAddress(int col, int row) const override
A memtile spans five address rows (registers, then 4 MiB of data), so memtile row m starts at address...
bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const override
Return true if core can access the memory in mem.
uint32_t getMemEastBaseAddress() const override
Return the base address in the local address map for a core.
std::unique_ptr< RegisterDatabase > loadRegisterDatabase() const override
AIE4 TargetModel.
bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is South of dst.
uint32_t getMemSouthBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getNumBDsInPool(int col, int row, uint32_t poolId) const override
uint32_t getMaxPacketId() const override
Return the largest packet id the stream switch can route.
uint32_t getMaxLockValue() const override
Return the maximum value that can be stored in a lock register.
uint32_t getMaxRepeatCount() const override
Return the largest DMA task repeat count (unsupported = 0).
uint32_t getCoreDataAddressSpaceSize() const override
Return the size (in bytes) of the address space a core can issue data accesses into.
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
uint32_t getAccumulatorCascadeSize() const override
Return the size (in bits) of the accumulator/cascade.
bool hasChannelLocalBdIds(int col, int row) const override
True if data BD ids are channel-local, so a BD's address depends on its channel and direction.
uint32_t getDataMemoryOffset(int col, int row) const override
A memtile's data memory starts 1 MiB into its window.
uint32_t getNumMselsPerArbiter() const override
Return the number of master select values per stream-switch arbiter.
bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is North of dst.
uint32_t getDmaBdIterBits(AIETileType tileType) const override
Return the bit width of the iteration (repeat) wrap/stride fields in a DMA buffer descriptor for the ...
uint32_t getMemNorthBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getNumControllersPerColumn() const override
Number of microcontrollers (uC) per column.
AIEArch getTargetArch() const override
Return the target architecture.
uint32_t getMemTileSize() const override
Return the size (in bytes) of a MemTile.
llvm::ArrayRef< std::pair< int, int > > getCascadeSteps() const override
The steps (destination column - source column, destination row - source row) from one core's cascade ...
uint32_t getDmaTaskQueueDepth() const override
Not modelled yet.
uint32_t getMaxChannelNumForAdjacentMemTile(int col, int row) const override
uint32_t getMaxOutOfOrderId() const override
4-bit index into the receiving channel's 16-BD bank.
uint32_t getBdPoolId(int col, int row, int channel, DMAChannelDir dir) const override
Shim: MM2S 0-1 and S2MM 0 use BDs 0-15, MM2S 2-3 and S2MM 1 BDs 16-31; ControlMM2S (8) and TraceS2MM ...
const DmaBdLayout & getDmaBdLimits(AIETileType tileType) const
Field limits from the BD layout; the shim's for tiles without one.
uint32_t getNumBanks(int col, int row) const override
Return the number of memory banks of a given tile.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const override
std::optional< uint32_t > getLockLocalBaseIndex(int localCol, int localRow, int lockCol, int lockRow) const override
A memtile DMA reaches the locks and memory of the 15 memtiles within seven columns,...
bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is East of dst.
uint64_t getDmaBdMaxLen(AIETileType tileType) const override
Return the maximum transfer length, measured in address-generation granules (see getAddressGenGranula...
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t channel, bool master) const override
Not modelled yet.
uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a shimmux.
uint32_t getDmaBdStepBits(AIETileType tileType) const override
Return the bit width of the step (stride) field in a DMA buffer descriptor for the given tile type.
std::optional< TileID > getMemSouth(TileID) const override
Return the tile ID of the memory to the south of the given tile, if it exists.
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
std::optional< uint32_t > getMemLocalBaseAddress(int localCol, int localRow, int memCol, int memRow) const override
Return the memory base address (or offset) in the local tile when accessing a neighbor's memory or an...
uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a shimmux.
uint32_t getNumBDs(AIETileType tileType) const override
16 ids per core tile or memtile channel pool; 32 across two shim banks.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
uint32_t getColumnShift() const override
uint32_t getAddressGenGranularity() const override
Return the data bus width of the device.
uint32_t getRowFromAddress(uint32_t address) const override
Inverse of getTileAddress() for any address in the tile's window.
uint32_t getDmaBdAddressOffset(int col, int row) const override
Return the offset of the base address field within the shim dma buffer descriptor.
bool hasShimMux(int col, int row) const override
True if the tile's DMA/NOC/PLIO ports sit behind an aie.shim_mux; otherwise its DMA is routed in the ...
uint32_t getMemInternalBaseAddress(TileID src) const override
Return the base address in the local address map for a core.
uint32_t getMemWestBaseAddress() const override
Return the base address in the local address map for a core.
uint32_t getLocalMemorySize() const override
Return the size (in bytes) of the local data memory of a core.
virtual uint32_t getCoreDataAddressSpaceSize() const =0
Return the size (in bytes) of the address space a core can issue data accesses into.
std::pair< uint32_t, uint32_t > getBdIdRangeForChannel(int col, int row, int channel, DMAChannelDir dir) const
Return the half-open range of BD ids channel in dir can submit.
std::optional< uint32_t > encodeFieldValue(const BitFieldInfo &field, uint32_t value) const
Encode a field value with proper bit shifting.
uint32_t getDmaBdStepBias(AIETileType tileType) const
DmaBdLayout::stepBias, or 1 without a layout.
std::optional< uint32_t > resolvePortValue(llvm::StringRef value, TileID tile, bool master) const
Resolve stream switch port specification to port index.
llvm::DenseMap< TileID, int > getTileToControllerIdMap(bool columnWiseUniqueIDs=true) const
Return a mapping from tile coordinates to controller IDs.
virtual uint32_t getTileAddress(int col, int row) const
Return the base address of the tile's window.
virtual uint32_t getNumMselsPerArbiter() const =0
Return the number of master select values per stream-switch arbiter.
virtual std::optional< uint32_t > getMemLocalBaseAddress(int localCol, int localRow, int memCol, int memRow) const
Return the memory base address (or offset) in the local tile when accessing a neighbor's memory or an...
bool isNorth(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is North of dst.
bool isSouth(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is South of dst.
uint32_t getDmaBdWrapBits(int col, int row) const
bool isWest(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is West of dst.
virtual llvm::ArrayRef< std::pair< int, int > > getCascadeSteps() const
The steps (destination column - source column, destination row - source row) from one core's cascade ...
uint32_t getLocalDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const
Return the DMA task-queue register address relative to its tile.
TargetModelKind getKind() const
virtual bool isSupportedBlockFormat(std::string const &format) const
bool isBdInChannelPool(int col, int row, uint32_t bd_id, int channel, DMAChannelDir dir) const
True iff bd_id is in the channel's pool, whether or not it exists.
bool isCoreTile(int col, int row) const
Return true if the given tile is a Core tile.
virtual uint64_t getDmaBdMaxLen(AIETileType tileType) const =0
Return the maximum transfer length, measured in address-generation granules (see getAddressGenGranula...
uint32_t getModelProperties() const
virtual const DmaBdLayout * getDmaBdLayout(AIETileType tileType) const
Return the register layout of a buffer descriptor on the given tile type, or null if the target has n...
virtual AIEArch getTargetArch() const =0
Return the target architecture.
virtual bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is North of dst.
virtual uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const =0
Return the number of sources of connections inside a shimmux.
bool isMemTile(int col, int row) const
Return true if the given tile is a Mem tile.
virtual uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const =0
Return the array address of the dma task queue register for the given col, row, channel and direction...
virtual uint32_t getDmaBdWrapBits(AIETileType tileType) const =0
Return the bit width of the wrap (size) field in a DMA buffer descriptor for the given tile type.
virtual uint32_t getMemSouthBaseAddress() const =0
Return the base address in the local address map for a core.
virtual std::optional< uint32_t > getLockLocalBaseIndex(int localCol, int localRow, int lockCol, int lockRow) const
Return the lock base index (or offset) in the local tile when accessing a neighbor's lock or an empty...
virtual uint32_t getDmaChannelIdleMask() const
Return the bits of the getDmaStatusAddress() register that are all clear exactly when the channel has...
void addModelProperty(uint32_t prop)
AIETargetModel(TargetModelKind k)
virtual uint32_t getLocalMemorySize() const =0
Return the size (in bytes) of the local data memory of a core.
std::optional< uint32_t > getFieldMask(const BitFieldInfo &field) const
Compute a 32-bit mask for a register field.
virtual uint32_t getNumLocks(AIETileType tileType) const =0
Return the number of lock objects for a given tile type.
uint32_t getNumBDsForChannel(int col, int row, int channel, DMAChannelDir dir) const
uint32_t getDmaBdIterBits(int col, int row) const
uint32_t getColumnFromAddress(uint32_t address) const
virtual uint32_t getComputeTileLoadStoreBusWidth() const =0
Return the data bus width (in bits) for load/store operations of a compute core.
bool isOrdinaryWriteAddress(TileID tile, uint32_t offset) const
std::vector< int > partitionStartColumns(int numCols) const
Every physical column offset at which a numCols-wide partition still fits.
virtual uint32_t getTotalNumBDs(AIETileType tileType) const
Physical BDs over all pools; exceeds getNumBDs() where pools reuse ids.
std::optional< uint32_t > lookupEvent(llvm::StringRef name, TileID tile, bool isMem=false) const
Lookup event number by name and tile.
virtual std::optional< TileID > getMemNorth(TileID src) const =0
Return the tile ID of the memory to the north of the given tile, if it exists.
virtual int physicalColumns() const
Width of the physical array this (possibly virtualized) device is carved from.
virtual uint32_t getBdPoolId(int col, int row, int channel, DMAChannelDir dir) const
Return the pool channel in direction dir draws its BDs from.
virtual uint32_t getDmaBdIterBits(AIETileType tileType) const =0
Return the bit width of the iteration (repeat) wrap/stride fields in a DMA buffer descriptor for the ...
const RegisterInfo * lookupRegister(llvm::StringRef name, TileID tile, bool isMem=false) const
Register Database API - provides access to register and event information for trace configuration and...
virtual uint32_t getBDMaxDims(AIETileType tileType) const =0
Return the maximum number of addressing dimensions (wraps/strides) a single buffer descriptor support...
virtual std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const =0
const RegisterDatabase * getRegisterDatabase() const
Get the register database, loading it lazily on first access.
virtual bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const =0
virtual uint32_t getNumBanks(int col, int row) const =0
Return the number of memory banks of a given tile.
uint64_t getDmaBdMaxLen(int col, int row) const
virtual bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is East of dst.
virtual uint32_t getDmaTaskQueueDepth() const =0
Return how many DMA tasks a single channel's task queue holds (unsupported = 0).
virtual uint32_t getDmaBdStepBits(AIETileType tileType) const =0
Return the bit width of the step (stride) field in a DMA buffer descriptor for the given tile type.
virtual uint32_t getRowFromAddress(uint32_t address) const
Inverse of getTileAddress() for any address in the tile's window.
bool isShimPLTile(int col, int row) const
Return true if the given tile is a ShimPL tile.
uint32_t getDmaTaskQueueDepth(int, int, int, AIE::DMAChannelDir) const
Return the task-queue depth for one channel.
const DmaBdLayout * getDmaBdLayout(int col, int row, DMAChannelDir direction) const
virtual uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel=-1, AIE::DMAChannelDir direction=AIE::DMAChannelDir::MM2S) const =0
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
int getPacketIdMask() const
virtual ~AIETargetModel()
uint32_t getDmaBdStepBias(int col, int row) const
bool isBdChannelAccessible(int col, int row, uint32_t bd_id, int channel, DMAChannelDir dir) const
virtual uint32_t getDmaBdAddressOffset(int col, int row) const =0
Return the offset of the base address field within the shim dma buffer descriptor.
virtual uint32_t getAccumulatorCascadeSize() const =0
Return the size (in bits) of the accumulator/cascade.
virtual std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const =0
virtual uint32_t getMaxChannelNumForAdjacentMemTile(int col, int row) const =0
virtual AIETileType getTileType(int col, int row) const =0
Return the tile type for the given tile coordinates.
uint32_t getCoreStackAlignment() const
Stack-pointer alignment in bytes, matching Peano's AIE frame lowering: AIE1/AIE2 require 32B; AIE2P/A...
virtual uint32_t getNumArbiters() const =0
Return the number of arbiters per stream switch.
virtual bool isValidTile(TileID src) const
Return true if the given tile ID is valid.
bool isEast(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is East of dst.
virtual uint32_t getDmaTaskQueueSizeMask() const
Return the mask selecting the live task-queue occupancy field within the getDmaStatusAddress() regist...
virtual bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is South of dst.
bool isShimNOCorPLTile(int col, int row) const
Return true if the given tile is either a ShimNOC or ShimPL tile.
virtual uint32_t getMaxRepeatCount() const =0
Return the largest DMA task repeat count (unsupported = 0).
virtual uint32_t getMemWestBaseAddress() const =0
Return the base address in the local address map for a core.
bool isDmaChannelSupported(TileID tile, AIE::DMAChannelDir dir, int channel) const
virtual uint32_t getNumControllersPerColumn() const
Number of microcontrollers (uC) per column.
virtual int rows() const =0
Return the number of rows in the device.
uint32_t getBDMaxDims(int col, int row) const
Return the maximum number of BD addressing dimensions for the tile at (col, row).
uint32_t getTotalNumBDs(int col, int row) const
virtual std::optional< TileID > getMemSouth(TileID src) const =0
Return the tile ID of the memory to the south of the given tile, if it exists.
virtual std::optional< TileID > getMemEast(TileID src) const =0
Return the tile ID of the memory to the east of the given tile, if it exists.
bool isShimNOCTile(int col, int row) const
Return true if the given tile is a ShimNOC tile.
virtual uint32_t getNumBDs(AIETileType tileType) const =0
Return the size of the BD id space of a tile type (see getTotalNumBDs()).
virtual uint32_t getMaxPacketId() const =0
Return the largest packet id the stream switch can route.
virtual bool hasChannelLocalBdIds(int col, int row) const
True if data BD ids are channel-local, so a BD's address depends on its channel and direction.
@ UsesMultiDimensionalBDs
virtual uint32_t getMaxLockValue() const =0
Return the maximum value that can be stored in a lock register.
virtual std::unique_ptr< RegisterDatabase > loadRegisterDatabase() const
Subclasses override to provide architecture-specific database loading.
bool isBdChannelAccessible(int col, int row, uint32_t bd_id, int channel) const
True iff the channel exists and can submit bd_id in every direction it has.
virtual uint32_t getComputeTileMaxVectorAlignBits() const
Return the alignment (in bits) required by the widest vector load/store a compute core can issue.
virtual uint32_t getProgramMemorySize() const =0
Return the size (in bytes) of a core's program memory.
virtual uint32_t getMaxOutOfOrderId() const =0
Return the largest out-of-order BD id (unsupported = 0).
virtual uint32_t getBdPoolStartId(int col, int row, uint32_t poolId) const
virtual std::optional< TileID > getMemWest(TileID src) const =0
Return the tile ID of the memory to the west of the given tile, if it exists.
virtual uint32_t getColumnShift() const =0
virtual uint32_t getMemNorthBaseAddress() const =0
Return the base address in the local address map for a core.
uint32_t getNumLocks(int col, int row) const
Return the number of lock objects for a tile at the given coordinates.
bool hasProperty(ModelProperty Prop) const
uint32_t getDmaQueueAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const
Return the array address of the task queue register a push writes, the word after the channel's contr...
bool usesChannelLocalBdIds(int col, int row, DMAChannelDir direction) const
Control and trace channels always have private, channel-local pools.
uint32_t getNumDMAChannels(int col, int row, AIE::DMAChannelDir dir) const
Return the number of DMA channels a tile has in one direction.
virtual uint32_t getDataMemoryOffset(int, int) const
Offset of data memory in the tile's window; buffer addresses are relative to it.
virtual int columns() const =0
Return the number of columns in the device.
int getPacketIdBits() const
Bits a packet id spans, and the mask a switch's id match uses.
uint32_t getNumBDsForChannel(int col, int row, int channel) const
virtual bool isMemTilePadValueSupported() const
virtual const DmaBdLayout * getDmaBdLayout(AIETileType tileType, DMAChannelDir direction) const
Return the BD layout for direction; control and trace BDs may differ.
bool isLegalCascade(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if a cascade can run from src to dst.
virtual uint32_t getDefaultCoreStackSize() const
Return the default stack reservation (in bytes) for a core that does not state one.
virtual uint32_t getMemEastBaseAddress() const =0
Return the base address in the local address map for a core.
const DmaBdLayout * getDmaBdLayout(int col, int row) const
virtual uint32_t getNumControllers() const
Total number of microcontrollers (uC) in the device.
virtual uint32_t getMemTileLoadStoreBusWidth() const
Return the data bus width (in bits) for load/store operations of a memory tile.
uint32_t getDmaBdStepBits(int col, int row) const
virtual uint32_t getNumMemTileRows() const =0
virtual uint32_t getNumBDsInPool(int col, int row, uint32_t poolId) const
virtual uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const =0
Return the number of destinations of connections inside a shimmux.
virtual bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is West of dst.
virtual uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const =0
Return the number of destinations of connections inside a switchbox.
virtual uint32_t getMemInternalBaseAddress(TileID src) const =0
Return the base address in the local address map for a core.
virtual uint32_t getDefaultAxCache() const
SharedMemory
Which of two tiles' memory modules both of them can address.
@ None
Neither tile can address the other's memory module.
@ First
Only the first tile's module.
@ Second
Only the second tile's module.
virtual std::optional< uint32_t > getDmaStatusAddress(int, int, int, AIE::DMAChannelDir) const
Return the address of the DMA status register for a channel, or nullopt when this target's layout has...
bool isInternal(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is the internal memory of dst.
virtual uint32_t getRowShift() const =0
virtual uint32_t getNumSlaveSlots() const =0
Return the number of packet-rule slots per stream-switch slave port.
uint32_t getRowFieldMask() const
SharedMemory getSharedMemory(TileID a, TileID b) const
Return the memory module a and b can both reach, if any.
virtual int firstPlaceableColumn() const
First physical column at which a partition may be anchored.
virtual bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const =0
Return true if core can access the memory in mem.
virtual bool hasShimMux(int col, int row) const
True if the tile's DMA/NOC/PLIO ports sit behind an aie.shim_mux; otherwise its DMA is routed in the ...
uint32_t getNumBDs(int col, int row) const
Return the number of buffer descriptors supported by the DMA in the given tile.
virtual uint32_t getAddressGenGranularity() const =0
Return the data bus width of the device.
virtual uint32_t getMemTileSize() const =0
Return the size (in bytes) of a MemTile.
virtual std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t channel, bool master) const =0
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
virtual uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const =0
Return the number of sources of connections inside a switchbox.
uint32_t getNumMemTileRows() const override
static bool classof(const AIETargetModel *model)
BaseNPU1TargetModel(TargetModelKind k)
int physicalColumns() const override
Width of the physical array this (possibly virtualized) device is carved from.
uint32_t getNumControllers() const override
Total number of microcontrollers (uC) in the device.
int rows() const override
Return the number of rows in the device.
uint32_t getNumControllers() const override
Total number of microcontrollers (uC) in the device.
static bool classof(const AIETargetModel *model)
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
BaseNPU2TargetModel(TargetModelKind k)
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
uint32_t getNumMemTileRows() const override
AIEArch getTargetArch() const override
Return the target architecture.
uint32_t getComputeTileMaxVectorAlignBits() const override
Return the alignment (in bits) required by the widest vector load/store a compute core can issue.
bool isSupportedBlockFormat(std::string const &format) const override
int rows() const override
Return the number of rows in the device.
int physicalColumns() const override
Width of the physical array this (possibly virtualized) device is carved from.
bool isMemTilePadValueSupported() const override
static bool classof(const AIETargetModel *model)
BaseNPU3TargetModel(TargetModelKind k)
uint32_t getNumMemTileRows() const override
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
int rows() const override
Return the number of rows in the device.
static bool classof(const AIETargetModel *model)
int columns() const override
Return the number of columns in the device.
static bool classof(const AIETargetModel *model)
int columns() const override
Return the number of columns in the device.
Register and event database for a specific architecture.
static bool classof(const AIETargetModel *model)
int columns() const override
Return the number of columns in the device.
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
uint32_t getAddressGenGranularity() const override
Return the data bus width of the device.
int rows() const override
Return the number of rows in the device.
int columns() const override
Return the number of columns in the device.
int rows() const override
Return the number of rows in the device.
uint32_t getNumMemTileRows() const override
static bool classof(const AIETargetModel *model)
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
static bool classof(const AIETargetModel *model)
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
uint32_t getNumMemTileRows() const override
int columns() const override
Return the number of columns in the device.
int rows() const override
Return the number of rows in the device.
static bool classof(const AIETargetModel *model)
int rows() const override
Return the number of rows in the device.
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
uint32_t getNumMemTileRows() const override
int columns() const override
Return the number of columns in the device.
VirtualizedNPU1TargetModel(int _cols)
static bool classof(const AIETargetModel *model)
int columns() const override
Return the number of columns in the device.
AIETileType getTileType(int col, int row) const override
Return the tile type for the given tile coordinates.
static bool classof(const AIETargetModel *model)
VirtualizedNPU2TargetModel(int _cols)
int columns() const override
Return the number of columns in the device.
static bool classof(const AIETargetModel *model)
int columns() const override
Return the number of columns in the device.
VirtualizedNPU3TargetModel(int _cols)
uint8_t txnDeviceGen(const AIETargetModel &tm)
Device generation ID written into the TXN header (aie_runtime::TxnDeviceInfo::devGen).
struct TileID { friend std::ostream &operator<<(std::ostream &os, const TileID &s) { os<< "TileID("<< s.col<< ", "<< s.row<< ")"; return os; } friend std::string to_string(const TileID &s) { std::ostringstream ss; ss<< s; return ss.str(); } friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const TileID &s) { os<< to_string(s); return os; } inline bool operator<(const TileID &rhs) const { return std::tie(col, row)< std::tie(rhs.col, rhs.row); } bool operator==(const TileID &rhs) const { return std::tie(col, row)==std::tie(rhs.col, rhs.row); } bool operator!=(const TileID &rhs) const { return !(*this==rhs);} int col, row;} TileID
llvm::raw_ostream & operator<<(llvm::raw_ostream &os, const SwitchSettings &ss)
WireBundle getDMAChannelBundle(DMAChannelDir dir)
The stream-switch bundle the channels of dir use.
DenseMapInfo< int > SecondInfo
static unsigned getHashValue(const xilinx::AIE::TileID &t)
static bool isEqual(const xilinx::AIE::TileID &lhs, const xilinx::AIE::TileID &rhs)
DenseMapInfo< int > FirstInfo
std::size_t operator()(const xilinx::AIE::TileID &s) const noexcept
Bit field information for a register.
Bits [shift, shift + width) of register word in a buffer descriptor's register block.
uint32_t place(uint64_t value) const
The register layout of one tile type's DMA buffer descriptor.
DmaBdField d2Size
Fourth-dimension fields; not programmed yet (buffer_length carries d2).
uint8_t stepBias
Step fields hold (step in granules - stepBias).
DmaBdField iterationCurrent
DmaBdField iterationStride
llvm::SmallVector< std::pair< DmaBdField, DmaBdField >, 3 > padFields() const
The (before, after) zero-padding fields, innermost dimension first.
DmaBdField d0Size
Without a d0Stride field the innermost dimension is contiguous.