Skip to content

Commit

Permalink
Take into account herds in peeled for loop (Xilinx#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
erwei-xilinx authored Oct 23, 2024
1 parent 9e333ad commit 9160ca7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions mlir/lib/Transform/AIRMiscPasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,9 +1437,23 @@ void AIRSplitL2MemrefForBufferConstraintPass::runOnOperation() {
// none, then memref splitting is not needed, as no routings or channels can
// be saved if only allocating to a single memtile.
auto getTileCountInSegment = [](air::SegmentOp seg) {
DenseMap<StringRef, uint64_t>
herdNumTiles; // Herds with the same name are assumed to be different
// time phases of the same physical herd.
unsigned tileCount = 0;
seg.walk(
[&](air::HerdOp h) { tileCount += h.getNumCols() * h.getNumRows(); });
seg.walk([&](air::HerdOp h) {
if (!h.getSymName()) {
tileCount += h.getNumCols() * h.getNumRows();
return;
}
StringRef herdSym = *h.getSymName();
herdNumTiles[herdSym] =
herdNumTiles.count(herdSym)
? std::max(herdNumTiles[herdSym], h.getNumCols() * h.getNumRows())
: h.getNumCols() * h.getNumRows();
});
for (const auto &[herdSym, count] : herdNumTiles)
tileCount += count;
return tileCount;
};
if (llvm::none_of(allocOps, [&](memref::AllocOp a) {
Expand Down

0 comments on commit 9160ca7

Please sign in to comment.