Skip to content

Commit

Permalink
use structs instead of pairs (#719)
Browse files Browse the repository at this point in the history
Use structs instead of pairs so that semantic info is preserved (and code is more readable).
  • Loading branch information
makslevental authored Nov 6, 2023
1 parent dd2bf48 commit 1a49ea1
Show file tree
Hide file tree
Showing 27 changed files with 944 additions and 1,069 deletions.
38 changes: 5 additions & 33 deletions include/aie/Dialect/AIE/AIENetlistAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@

using namespace mlir;

namespace xilinx {
namespace AIE {
namespace xilinx::AIE {

class NetlistAnalysis {
DeviceOp &device;
DenseMap<std::pair<int, int>, Operation *> &tiles;
DenseMap<TileID, Operation *> &tiles;
DenseMap<Operation *, CoreOp> &cores;
DenseMap<Operation *, MemOp> &mems;
DenseMap<std::pair<Operation *, int>, LockOp> &locks;
Expand All @@ -49,8 +48,7 @@ class NetlistAnalysis {
DenseMap<Operation *, SmallVector<Operation *, 4>> bufAcqLocks;

public:
NetlistAnalysis(DeviceOp &d,
DenseMap<std::pair<int, int>, Operation *> &tiles,
NetlistAnalysis(DeviceOp &d, DenseMap<TileID, Operation *> &tiles,
DenseMap<Operation *, CoreOp> &cores,
DenseMap<Operation *, MemOp> &mems,
DenseMap<std::pair<Operation *, int>, LockOp> &locks,
Expand All @@ -59,51 +57,25 @@ class NetlistAnalysis {
: device(d), tiles(tiles), cores(cores), mems(mems), locks(locks),
buffers(buffers), switchboxes(switchboxes) {}

void runAnalysis();

void collectTiles(DenseMap<std::pair<int, int>, Operation *> &tiles);
void collectTiles(DenseMap<TileID, Operation *> &tiles);
void collectCores(DenseMap<Operation *, CoreOp> &cores);
void collectMems(DenseMap<Operation *, MemOp> &mems);
void collectLocks(DenseMap<std::pair<Operation *, int>, LockOp> &locks);
void collectBuffers(DenseMap<Operation *, SmallVector<BufferOp, 4>> &buffers);
void collectSwitchboxes(DenseMap<Operation *, SwitchboxOp> &switchboxes);

auto getBufferUsers() const { return bufferUsers; }

auto getDMA2BufMap() const { return dma2BufMap; }

auto getDMAs() const { return dmas; }

auto getDMAConnections() const { return dmaConnections; }

auto getLockPairs() const { return lockPairs; }

auto getLockChains() const { return lockChains; }

auto getBufAcqLocks() const { return bufAcqLocks; }

auto getDma2ConnectsMap() const { return dma2ConnectsMap; }

std::pair<int, int> getCoord(Operation *Op) const;
bool isLegalAffinity(Operation *src, Operation *user) const;
bool validateCoreOrMemRegion(Operation *CoreOrMemOp);
void collectBufferUsage();
void collectDMAUsage();
uint64_t getMemUsageInBytes(Operation *tileOp) const;
uint64_t getBufferBaseAddress(Operation *bufOp) const;

SmallVector<Operation *, 4> getNextConnectOps(ConnectOp currentConnect) const;
SmallVector<Operation *, 4> findDestConnectOps(ConnectOp source,
WireBundle destBundle) const;
SmallVector<Operation *, 4> findRoutes(Operation *sourceConnectOp,
Operation *destConnectOp) const;
void dmaAnalysis();
void lockAnalysis();

void print(raw_ostream &os);
};

} // namespace AIE
} // namespace xilinx
} // namespace xilinx::AIE

#endif
Loading

0 comments on commit 1a49ea1

Please sign in to comment.