Skip to content

Commit

Permalink
Fix topological sort use (#1945)
Browse files Browse the repository at this point in the history
  • Loading branch information
keryell authored Dec 18, 2024
1 parent 1b0f4e3 commit 67fca08
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/Dialect/AIE/Transforms/AIEObjectFifoStatefulTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@

#include "mlir/Analysis/TopologicalSortUtils.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Index/IR/IndexDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Iterators.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
#include "mlir/Transforms/DialectConversion.h"

#include <numeric>
Expand Down Expand Up @@ -1848,14 +1843,14 @@ struct AIEObjectFifoStatefulTransformPass
ObjectFifoSubviewAccessOp, ObjectFifoReleaseOp>(op))
opsToErase.insert(op);
});
topologicalSort(opsToErase);
IRRewriter rewriter(&getContext());
for (auto it = opsToErase.rbegin(); it != opsToErase.rend(); ++it)
(*it)->erase();
SmallVector<Operation *> sorted{opsToErase.begin(), opsToErase.end()};
computeTopologicalSorting(sorted);
for (auto *op : llvm::reverse(sorted))
op->erase();
}
};

std::unique_ptr<OperationPass<DeviceOp>>
AIE::createAIEObjectFifoStatefulTransformPass() {
return std::make_unique<AIEObjectFifoStatefulTransformPass>();
}
}

0 comments on commit 67fca08

Please sign in to comment.