Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-Zhewen committed Dec 2, 2024
1 parent d57f854 commit ba4413d
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ FailureOr<AMDAIE::TileOp> getGeneratorTileOp(
}
}
Value tile = tiles[0];
if (!shimTileToGeneratorMap.contains(tile)) {
if (!shimTileToGeneratorMap.contains(tile))
return npuDmaOp.emitOpError()
<< "no channel BD ID generator found for tile: " << tile;
}

auto tileOp = dyn_cast_if_present<AMDAIE::TileOp>(tile.getDefiningOp());
if (!tileOp) return npuDmaOp.emitOpError() << "no tile op found";
return tileOp;
Expand All @@ -62,14 +62,11 @@ FailureOr<AMDAIE::TileOp> getGeneratorTileOp(
// Check if the DMA operation is in the innermost loop of controlcode.
bool isInMostInnerLoop(AMDAIE::NpuDmaCpyNdOp op) {
auto parentLoop = op->getParentOfType<scf::ForOp>();
if (!parentLoop) {
return false;
}
if (!parentLoop) return false;

bool hasNestedLoop = false;
parentLoop.walk([&](scf::ForOp nestedLoop) {
if (nestedLoop != parentLoop) {
hasNestedLoop = true;
}
if (nestedLoop != parentLoop) hasNestedLoop = true;
});
return !hasNestedLoop;
}
Expand All @@ -84,9 +81,7 @@ uint32_t countBdIdPerLoopIteration(
if (dmaOp.getSource() || dmaOp.getTarget()) {
FailureOr<AMDAIE::TileOp> tile =
getGeneratorTileOp(dmaOp, shimTileToGeneratorMap);
if (succeeded(tile) && *tile == tileOp) {
count++;
}
if (succeeded(tile) && *tile == tileOp) count++;
}
});
return count;
Expand Down

0 comments on commit ba4413d

Please sign in to comment.