15#include "mlir/Dialect/Arith/IR/Arith.h"
16#include "mlir/Dialect/MemRef/IR/MemRef.h"
17#include "mlir/IR/IRMapping.h"
18#include "mlir/IR/PatternMatch.h"
19#include "mlir/Pass/Pass.h"
20#include "mlir/Transforms/DialectConversion.h"
21#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
22#include "mlir/Transforms/WalkPatternRewriteDriver.h"
23#include "llvm/ADT/STLExtras.h"
28#define GEN_PASS_DEF_AIEMATERIALIZERUNTIMESEQUENCES
29#include "aie/Dialect/AIEX/Transforms/AIEXPasses.h.inc"
32#define DEBUG_TYPE "aie-materialize-runtime-sequence"
49 AIE::RuntimeSequenceOp runtimeSequenceOp =
50 llvm::dyn_cast<AIE::RuntimeSequenceOp>(op);
51 if (!runtimeSequenceOp) {
52 op->emitError(
"RuntimeCallGraphCyclicityAnalysis can only be called on "
53 "aiex.runtime_sequence operations.");
59 llvm::DenseSet<AIE::RuntimeSequenceOp> callStack;
60 llvm::DenseSet<AIE::RuntimeSequenceOp> visited;
63 std::function<bool(AIE::RuntimeSequenceOp)> hasCycle =
64 [&](AIE::RuntimeSequenceOp seq) ->
bool {
65 if (callStack.contains(seq)) {
68 if (visited.contains(seq)) {
72 callStack.insert(seq);
76 bool foundCycle =
false;
77 seq.walk([&](RunOp runOp) {
78 if (AIE::RuntimeSequenceOp callee =
79 runOp.getCalleeRuntimeSequenceOp(&calleeNames)) {
80 if (hasCycle(callee)) {
82 return WalkResult::interrupt();
85 return WalkResult::advance();
92 if (hasCycle(runtimeSequenceOp)) {
110 PatternBenefit benefit = 1)
111 : RewritePattern(ConfigureOp::getOperationName(), benefit, context) {}
114 PatternRewriter &rewriter)
const override {
115 ConfigureOp configureOp = llvm::dyn_cast<ConfigureOp>(op);
122 if (!llvm::isa<AIE::RuntimeSequenceOp>(configureOp->getParentOp())) {
126 AIE::DeviceOp referencedDevice = configureOp.getReferencedDeviceOp();
127 if (!referencedDevice) {
128 configureOp.emitError(
"Referenced symbol is not a device");
132 Block *configureBlock;
133 if (configureOp.getBody().empty()) {
134 configureBlock = rewriter.createBlock(&configureOp.getBody());
136 configureBlock = &configureOp.getBody().front();
139 rewriter.setInsertionPointToStart(configureBlock);
140 AIEX::NpuLoadPdiOp::create(
141 rewriter, configureOp.getLoc(),
142 FlatSymbolRefAttr::get(referencedDevice.getSymNameAttr()),
143 nullptr,
nullptr,
nullptr,
144 configureOp.getExpandModeAttr());
158collectReferencedSSAValues(Operation *op,
const IRMapping &argMap,
159 llvm::SetVector<Value> &referencedValues) {
161 auto processValue = [&](Value operand) {
162 if (argMap.contains(operand)) {
169 if (!argMap.contains(traceResult->rootArg)) {
170 referencedValues.insert(traceResult->rootArg);
176 referencedValues.insert(operand);
180 for (Value operand : op->getOperands()) {
181 processValue(operand);
185 for (Region ®ion : op->getRegions()) {
186 region.walk([&](Operation *nestedOp) {
187 for (Value operand : nestedOp->getOperands()) {
188 if (argMap.contains(operand)) {
193 if (Operation *defOp = operand.getDefiningOp()) {
194 if (op->isProperAncestor(defOp)) {
197 }
else if (
auto blockArg = llvm::dyn_cast<BlockArgument>(operand)) {
204 Operation *owner = blockArg.getOwner()->getParentOp();
205 if (owner && (owner == op || op->isProperAncestor(owner))) {
210 processValue(operand);
219uniqueSymbolName(MLIRContext *ctx, llvm::StringRef base,
220 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
221 std::string uniqueName = base.str();
222 unsigned uniquingCounter = 0;
223 while (allSymbolNames.count(SymbolRefAttr::get(ctx, uniqueName))) {
224 uniqueName = base.str() +
"_" + std::to_string(uniquingCounter);
227 allSymbolNames.insert(SymbolRefAttr::get(ctx, uniqueName));
235getOrClone(PatternRewriter &rewriter, Operation *op, IRMapping &argMap,
236 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
237 mlir::OpBuilder::InsertPoint &insertPoint,
238 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
239 auto it = clonedDefs.find(op);
240 if (it == clonedDefs.end()) {
241 rewriter.restoreInsertionPoint(insertPoint);
242 Operation *clone = rewriter.clone(*op, argMap);
243 if (
auto name = clone->getAttrOfType<StringAttr>(
244 SymbolTable::getSymbolAttrName())) {
245 clone->setAttr(SymbolTable::getSymbolAttrName(),
246 rewriter.getStringAttr(uniqueSymbolName(
247 op->getContext(), name.getValue(), allSymbolNames)));
249 it = clonedDefs.try_emplace(op, clone).first;
250 insertPoint = rewriter.saveInsertionPoint();
252 argMap.map(op->getResults(), it->second->getResults());
259static LogicalResult copyReferencedSSAValues(
260 PatternRewriter &rewriter,
const llvm::SetVector<Value> &referencedValues,
261 AIE::DeviceOp callerDevice, IRMapping &argMap,
262 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
263 mlir::OpBuilder::InsertPoint &clonedSSAInsertPoint,
264 llvm::SetVector<SymbolRefAttr> &allSymbolNames, Operation *errorReportOp) {
266 llvm::SetVector<Value> referencedValuesToVisit = referencedValues;
267 std::vector<Operation *> referencedOpsToClone = {};
268 while (!referencedValuesToVisit.empty()) {
269 Value referencedValue = referencedValuesToVisit.pop_back_val();
270 Operation *definingOp = referencedValue.getDefiningOp();
272 return errorReportOp->emitError()
273 <<
"Referenced value is not defined by an operation";
275 if (llvm::find(referencedOpsToClone, definingOp) !=
276 referencedOpsToClone.end()) {
280 if (
auto tileOp = llvm::dyn_cast<AIE::TileOp>(definingOp)) {
281 referencedOpsToClone.insert(referencedOpsToClone.begin(), definingOp);
282 }
else if (
auto lockOp = llvm::dyn_cast<AIE::LockOp>(definingOp)) {
283 Value lockTile = lockOp.getTile();
285 referencedValuesToVisit.insert(lockTile);
287 referencedOpsToClone.push_back(definingOp);
288 }
else if (
auto bufferOp = llvm::dyn_cast<AIE::BufferOp>(definingOp)) {
289 referencedValuesToVisit.insert(bufferOp.getTile());
290 referencedOpsToClone.push_back(definingOp);
292 return errorReportOp->emitError()
293 <<
"Referenced SSA value defined by unsupported operation type: "
294 << definingOp->getName().getStringRef()
295 <<
". Currently only aie.tile, aie.lock and aie.buffer "
296 "operations are supported.";
300 for (Operation *definingOp : referencedOpsToClone) {
301 if (
auto tileOp = llvm::dyn_cast<AIE::TileOp>(definingOp)) {
302 int col = tileOp.getCol();
303 int row = tileOp.getRow();
307 AIE::TileOp existingTile =
nullptr;
308 for (AIE::TileOp tile : callerDevice.getOps<AIE::TileOp>()) {
309 if (tile.getCol() == col && tile.getRow() == row) {
317 if (tileOp->getAttrDictionary() != existingTile->getAttrDictionary()) {
320 auto filterAttrs = [](DictionaryAttr dict) -> DictionaryAttr {
321 SmallVector<NamedAttribute> filteredAttrs;
322 for (
auto namedAttr : dict) {
323 StringRef name = namedAttr.getName().getValue();
324 if (name !=
"col" && name !=
"row" &&
325 name !=
"aiex.reserved_bd_ids") {
326 filteredAttrs.push_back(namedAttr);
329 return DictionaryAttr::get(dict.getContext(), filteredAttrs);
332 DictionaryAttr tileAttrs = filterAttrs(tileOp->getAttrDictionary());
333 DictionaryAttr existingAttrs =
334 filterAttrs(existingTile->getAttrDictionary());
336 if (tileAttrs != existingAttrs) {
337 return errorReportOp->emitError()
338 <<
"aie.tile(" << col <<
", " << row
339 <<
") already exists in the device with different "
344 if (
auto calleeIds = tileOp->getAttrOfType<DenseI32ArrayAttr>(
345 "aiex.reserved_bd_ids")) {
346 std::set<int32_t> ids(calleeIds.asArrayRef().begin(),
347 calleeIds.asArrayRef().end());
348 if (
auto callerIds = existingTile->getAttrOfType<DenseI32ArrayAttr>(
349 "aiex.reserved_bd_ids"))
350 ids.insert(callerIds.asArrayRef().begin(),
351 callerIds.asArrayRef().end());
352 SmallVector<int32_t> sorted(ids.begin(), ids.end());
353 existingTile->setAttr(
354 "aiex.reserved_bd_ids",
355 DenseI32ArrayAttr::get(existingTile->getContext(), sorted));
357 clonedDefs[definingOp] = existingTile.getOperation();
361 Operation *clonedOp = getOrClone(rewriter, definingOp, argMap, clonedDefs,
362 clonedSSAInsertPoint, allSymbolNames);
363 rewriter.replaceOpUsesWithIf(
364 definingOp, clonedOp->getResult(0), [&](OpOperand &operand) {
365 return operand.getOwner()->getParentOfType<AIE::DeviceOp>() ==
378static LogicalResult inlineReferencedSymbolDefinitions(
379 PatternRewriter &rewriter, Operation *op, Operation *lookupFrom,
381 llvm::DenseMap<SymbolRefAttr, SymbolRefAttr> &previouslyInlinedSymbolMap,
382 AIE::DeviceOp callerDevice,
383 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
385 mlir::OpBuilder::InsertPoint &clonedDefOpsInsertionPoint,
386 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
387 for (NamedAttribute namedAttr : op->getAttrs()) {
388 Attribute attr = namedAttr.getValue();
389 auto newAttr = attr.replace([&](SymbolRefAttr oldSymbolRef) {
390 auto inlined = previouslyInlinedSymbolMap.find(oldSymbolRef);
391 if (inlined != previouslyInlinedSymbolMap.end())
392 return std::make_pair(inlined->second, WalkResult::advance());
401 Operation *symbolDefOp =
nullptr;
402 Operation *calleeTable = SymbolTable::getNearestSymbolTable(lookupFrom);
403 if (calleeTable && calleeTable != callerDevice &&
404 oldSymbolRef.getNestedReferences().empty()) {
405 symbolDefOp = calleeNames.
getTable(calleeTable)
406 .
lookup(oldSymbolRef.getRootReference());
409 SymbolTable::lookupNearestSymbolFrom(lookupFrom, oldSymbolRef);
410 if (!symbolDefOp && oldSymbolRef.getNestedReferences().empty()) {
416 if (ModuleOp moduleOp = lookupFrom->getParentOfType<ModuleOp>()) {
417 symbolDefOp = SymbolTable::lookupSymbolIn(moduleOp, oldSymbolRef);
421 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
426 if (llvm::isa<AIE::DeviceOp>(symbolDefOp)) {
427 previouslyInlinedSymbolMap[oldSymbolRef] = oldSymbolRef;
428 return std::make_pair(oldSymbolRef, WalkResult::advance());
432 llvm::SetVector<Value> symbolReferencedValues;
433 collectReferencedSSAValues(symbolDefOp, argMap, symbolReferencedValues);
438 if (failed(copyReferencedSSAValues(
439 rewriter, symbolReferencedValues, callerDevice, argMap,
440 clonedDefs, clonedDefOpsInsertionPoint, allSymbolNames, op))) {
441 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
446 bool cloned = !clonedDefs.contains(symbolDefOp);
447 Operation *clonedSymbolDefOp =
448 getOrClone(rewriter, symbolDefOp, argMap, clonedDefs,
449 clonedDefOpsInsertionPoint, allSymbolNames);
450 SymbolRefAttr newSymbolRef =
451 FlatSymbolRefAttr::get(clonedSymbolDefOp->getAttrOfType<StringAttr>(
452 SymbolTable::getSymbolAttrName()));
453 previouslyInlinedSymbolMap[oldSymbolRef] = newSymbolRef;
457 failed(inlineReferencedSymbolDefinitions(
458 rewriter, clonedSymbolDefOp, symbolDefOp, argMap,
459 previouslyInlinedSymbolMap, callerDevice, clonedDefs, calleeNames,
460 clonedDefOpsInsertionPoint, allSymbolNames)))
461 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
463 auto allocation = dyn_cast<AIE::ShimDMAAllocationOp>(clonedSymbolDefOp);
464 ArrayAttr proofs = allocation ? allocation.getConsumedByAttr() :
nullptr;
465 auto callee = symbolDefOp->getParentOfType<AIE::DeviceOp>();
466 if (cloned && proofs && callee && callee.getSymNameAttr()) {
467 SmallVector<Attribute> stamped;
468 for (
auto proof : proofs.getAsRange<AIE::ConsumedByAttr>())
469 stamped.push_back(AIE::ConsumedByAttr::get(
470 proof.getContext(), proof.getOutput(), proof.getInputBytes(),
471 proof.getOutputBytes(), proof.getGranuleBytes(),
474 : FlatSymbolRefAttr::get(callee.getSymNameAttr())));
475 allocation.setConsumedByAttr(rewriter.getArrayAttr(stamped));
477 return std::make_pair(newSymbolRef, WalkResult::advance());
482 op->setAttr(namedAttr.getName(), newAttr);
499 llvm::DenseMap<Operation *, Operation *> &
clonedDefs,
501 : RewritePattern(RunOp::getOperationName(), PatternBenefit(1), ctx),
508 PatternRewriter &rewriter)
const override {
509 llvm::DenseMap<SymbolRefAttr, SymbolRefAttr> previouslyInlinedSymbolMap;
511 RunOp runOp = llvm::dyn_cast<RunOp>(op);
516 AIE::DeviceOp calleeDevice = runOp.getCalleeDeviceOp();
517 AIE::RuntimeSequenceOp calleeRuntimeSequence =
519 if (!calleeDevice || !calleeRuntimeSequence) {
527 Region &calleeBody = calleeRuntimeSequence.getBody();
528 AIE::DeviceOp callerDevice =
529 runOp.getOperation()->getParentOfType<AIE::DeviceOp>();
531 runOp.emitError() <<
"needs to be in a DeviceOp";
537 ValueRange values = runOp.getArgs();
538 for (
unsigned i = 0, n = calleeBody.getNumArguments(); i < n; i++) {
539 BlockArgument arg = calleeBody.getArgument(i);
540 Value val = values[i];
541 argMap.map(arg, val);
550 llvm::SetVector<Value> referencedValues;
551 for (Operation &op : calleeBody.getOps()) {
552 collectReferencedSSAValues(&op, argMap, referencedValues);
554 llvm::SetVector<Value> filteredValues;
555 for (Value val : referencedValues) {
556 if (val.getParentRegion() != &calleeBody) {
557 filteredValues.insert(val);
560 referencedValues = std::move(filteredValues);
563 if (failed(copyReferencedSSAValues(rewriter, referencedValues, callerDevice,
571 AIE::RuntimeSequenceOp callerRuntimeSequence =
572 runOp.getOperation()->getParentOfType<AIE::RuntimeSequenceOp>();
573 if (!callerRuntimeSequence) {
574 runOp.emitError() <<
"needs to be (transitively) inside a "
575 "aie.runtime_sequence operation";
578 Block &callerBodyBlock = callerRuntimeSequence.getBody().front();
579 mlir::Block::iterator hoistPos = callerBodyBlock.begin();
589 rewriter.setInsertionPoint(runOp);
590 mlir::OpBuilder::InsertPoint clonedOpInsertionPoint =
591 rewriter.saveInsertionPoint();
592 for (Operation &op : calleeBody.getOps()) {
593 bool shouldHoist = llvm::isa<NpuCreateScratchpadOp>(&op);
595 rewriter.setInsertionPoint(&callerBodyBlock, hoistPos);
596 rewriter.clone(op, argMap);
600 rewriter.restoreInsertionPoint(clonedOpInsertionPoint);
601 Operation *clonedOp = rewriter.clone(op, argMap);
602 clonedOpInsertionPoint = rewriter.saveInsertionPoint();
605 WalkResult symbolWalk = clonedOp->walk([&](Operation *nestedOp) {
606 if (failed(inlineReferencedSymbolDefinitions(
607 rewriter, nestedOp, calleeRuntimeSequence.getOperation(),
608 argMap, previouslyInlinedSymbolMap, callerDevice,
clonedDefs,
610 return WalkResult::interrupt();
612 return WalkResult::advance();
614 if (symbolWalk.wasInterrupted()) {
620 rewriter.eraseOp(runOp);
633verifyRunOpsInConfigureOp(ConfigureOp configureOp, AIE::DeviceOp referencedDev,
635 if (configureOp.getBody().empty())
638 for (RunOp runOp : configureOp.getBody().front().getOps<RunOp>()) {
639 auto seqName = runOp.getRuntimeSequenceSymbol();
640 Operation *maybeSeq =
641 devNames.
lookup(runOp.getRuntimeSequenceSymbolAttr().getAttr());
643 auto err = runOp.emitError()
644 <<
"No such runtime sequence for device '"
645 << referencedDev.getSymName() <<
"': '" << seqName <<
"'";
646 err.attachNote(referencedDev.getLoc())
647 <<
"This device does not have a '" << seqName <<
"' runtime sequence";
650 auto runtimeSeq = llvm::dyn_cast<AIE::RuntimeSequenceOp>(maybeSeq);
652 return runOp.emitError()
653 <<
"'" << seqName <<
"' is not a runtime sequence";
658 Region &calleeRegion = runtimeSeq.getBody();
659 unsigned numCalleeArgs =
660 calleeRegion.empty() ? 0 : calleeRegion.getNumArguments();
661 ValueRange
args = runOp.getArgs();
662 if (numCalleeArgs !=
args.size())
663 return runOp.emitOpError() <<
"argument count mismatch: expected "
664 << numCalleeArgs <<
" but got " <<
args.size();
665 for (
unsigned i = 0; i < numCalleeArgs; i++) {
666 Type expected = calleeRegion.front().getArgument(i).getType();
667 Type actual =
args[i].getType();
668 if (expected != actual)
669 return runOp.emitOpError()
670 <<
"argument " << i <<
" type mismatch: expected " << expected
671 <<
" but got " << actual;
679 AIEMaterializeRuntimeSequencesPass> {
689 if (runtimeSeqOp.getBody().empty())
692 Block &body = runtimeSeqOp.getBody().front();
693 NpuCreateScratchpadOp firstScratchpad;
694 SmallVector<NpuCreateScratchpadOp> duplicates;
695 for (NpuCreateScratchpadOp scratchpadOp :
696 body.getOps<NpuCreateScratchpadOp>()) {
697 if (!firstScratchpad) {
698 firstScratchpad = scratchpadOp;
701 if (firstScratchpad.getSize() != scratchpadOp.getSize()) {
702 scratchpadOp.emitError(
703 "create_scratchpad size mismatch after inlining: ")
704 << scratchpadOp.getSize() <<
" != " << firstScratchpad.getSize();
707 duplicates.push_back(scratchpadOp);
709 for (NpuCreateScratchpadOp dup : duplicates)
716 ModuleOp moduleOp = getOperation();
721 for (AIE::DeviceOp deviceOp : moduleOp.getOps<AIE::DeviceOp>()) {
724 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
725 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
726 if (failed(runtimeSequenceOp.verifyBeforeMaterialization())) {
727 return signalPassFailure();
735 for (ConfigureOp configureOp :
736 runtimeSequenceOp.getOps<ConfigureOp>()) {
737 AIE::DeviceOp referencedDev = configureOp.getReferencedDeviceOp();
738 if (!referencedDev) {
742 return signalPassFailure();
744 if (failed(verifyRunOpsInConfigureOp(configureOp, referencedDev,
745 referencedDevNames)))
746 return signalPassFailure();
751 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
752 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
754 getAnalysisManager().nest(deviceOp).nest(runtimeSequenceOp);
758 return signalPassFailure();
761 runtimeSequenceOp.emitError(
762 "Runtime sequence call graph contains a cycle");
763 return signalPassFailure();
771 mlir::Block &deviceBodyFirstBlock = deviceOp.getBodyRegion().front();
772 auto runtimeSequenceOps = deviceOp.getOps<AIE::RuntimeSequenceOp>();
773 if (runtimeSequenceOps.begin() == runtimeSequenceOps.end()) {
777 AIE::RuntimeSequenceOp firstRuntimeSequenceOp =
778 *runtimeSequenceOps.begin();
779 mlir::OpBuilder::InsertPoint ssaDefInsertPoint(
780 &deviceBodyFirstBlock, deviceBodyFirstBlock.begin());
781 mlir::OpBuilder::InsertPoint symbolDefInsertPoint(
782 &deviceBodyFirstBlock, mlir::Block::iterator(firstRuntimeSequenceOp));
783 llvm::SetVector<SymbolRefAttr> allSymbolNames = {};
784 for (Operation &op : deviceBodyFirstBlock) {
785 if (
auto symbolName = op.getAttrOfType<StringAttr>(
786 SymbolTable::getSymbolAttrName())) {
787 allSymbolNames.insert(SymbolRefAttr::get(symbolName));
791 MLIRContext *ctx = &getContext();
792 GreedyRewriteConfig rewriter_config = GreedyRewriteConfig();
793 rewriter_config.setRegionSimplificationLevel(
794 GreedySimplifyRegionLevel::Disabled);
796 RewritePatternSet patterns_0(ctx);
797 llvm::DenseMap<Operation *, Operation *> clonedDefs;
800 ctx, ssaDefInsertPoint, symbolDefInsertPoint, allSymbolNames,
801 clonedDefs, calleeNames);
802 if (failed(applyPatternsGreedily(deviceOp, std::move(patterns_0),
804 return signalPassFailure();
808 for (AIE::RuntimeSequenceOp runtimeSeqOp :
809 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
811 return signalPassFailure();
815 RewritePatternSet patterns_1(ctx);
817 walkAndApplyPatterns(deviceOp, std::move(patterns_1));
821 RewritePatternSet canonicalize_patterns(ctx);
822 AIEX::NpuLoadPdiOp::getCanonicalizationPatterns(canonicalize_patterns,
824 SmallVector<Operation *> loadPdis;
825 deviceOp.walk([&](NpuLoadPdiOp op) { loadPdis.push_back(op); });
826 GreedyRewriteConfig loadPdiConfig = rewriter_config;
827 loadPdiConfig.setStrictness(GreedyRewriteStrictness::ExistingOps);
828 if (failed(applyOpPatternsGreedily(
829 loadPdis, std::move(canonicalize_patterns), loadPdiConfig))) {
830 return signalPassFailure();
835 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
836 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
837 SmallVector<ConfigureOp> configureOps;
839 for (ConfigureOp configureOp :
840 runtimeSequenceOp.getOps<ConfigureOp>()) {
841 configureOps.push_back(configureOp);
844 IRRewriter rewriter(ctx);
845 for (ConfigureOp configureOp : configureOps) {
846 Block &configureBlock = configureOp.getBody().front();
849 SmallVector<Operation *> opsToHoist;
850 for (Operation &op : configureBlock) {
851 opsToHoist.push_back(&op);
855 rewriter.setInsertionPoint(configureOp);
856 for (Operation *op : opsToHoist) {
857 op->moveBefore(configureOp);
861 rewriter.eraseOp(configureOp);
869std::unique_ptr<OperationPass<ModuleOp>>
871 return std::make_unique<AIEMaterializeRuntimeSequencesPass>();
NamedOpTable & getTable(mlir::Operation *symbolTableOp)
mlir::Operation * lookup(mlir::StringAttr name) const
std::optional< SubviewTraceResult > traceSubviewToBlockArgument(Value value)
std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > createAIEMaterializeRuntimeSequencesPass()
mlir::Operation * lookupNamedOp(mlir::Operation *from, mlir::StringAttr name)
void runOnOperation() override
LogicalResult deduplicateCreateScratchpadOps(AIE::RuntimeSequenceOp runtimeSeqOp)
LogicalResult matchAndRewrite(Operation *op, PatternRewriter &rewriter) const override
mlir::OpBuilder::InsertPoint & ssaDefInsertPoint
InlineRuntimeCallsPattern(MLIRContext *ctx, mlir::OpBuilder::InsertPoint &ssaDefInsertPoint, mlir::OpBuilder::InsertPoint &symbolDefInsertPoint, llvm::SetVector< SymbolRefAttr > &allSymbolNames, llvm::DenseMap< Operation *, Operation * > &clonedDefs, AIE::NamedOpTableCollection &calleeNames)
llvm::DenseMap< Operation *, Operation * > & clonedDefs
mlir::OpBuilder::InsertPoint & symbolDefInsertPoint
llvm::SetVector< SymbolRefAttr > & allSymbolNames
AIE::NamedOpTableCollection & calleeNames
RuntimeCallGraphCyclicityAnalysis(Operation *op, AnalysisManager &am)
AnalysisManager & analysisManager