16#include "mlir/Dialect/Arith/IR/Arith.h"
17#include "mlir/Dialect/MemRef/IR/MemRef.h"
18#include "mlir/IR/IRMapping.h"
19#include "mlir/IR/PatternMatch.h"
20#include "mlir/Pass/Pass.h"
21#include "mlir/Transforms/DialectConversion.h"
22#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
23#include "mlir/Transforms/WalkPatternRewriteDriver.h"
24#include "llvm/ADT/STLExtras.h"
27#define GEN_PASS_DEF_AIEMATERIALIZERUNTIMESEQUENCES
28#include "aie/Dialect/AIEX/Transforms/AIEXPasses.h.inc"
31#define DEBUG_TYPE "aie-materialize-runtime-sequence"
48 AIE::RuntimeSequenceOp runtimeSequenceOp =
49 llvm::dyn_cast<AIE::RuntimeSequenceOp>(op);
50 if (!runtimeSequenceOp) {
51 op->emitError(
"RuntimeCallGraphCyclicityAnalysis can only be called on "
52 "aiex.runtime_sequence operations.");
58 llvm::DenseSet<AIE::RuntimeSequenceOp> callStack;
59 llvm::DenseSet<AIE::RuntimeSequenceOp> visited;
62 std::function<bool(AIE::RuntimeSequenceOp)> hasCycle =
63 [&](AIE::RuntimeSequenceOp seq) ->
bool {
64 if (callStack.contains(seq)) {
67 if (visited.contains(seq)) {
71 callStack.insert(seq);
75 bool foundCycle =
false;
76 seq.walk([&](RunOp runOp) {
77 if (AIE::RuntimeSequenceOp callee =
78 runOp.getCalleeRuntimeSequenceOp(&calleeNames)) {
79 if (hasCycle(callee)) {
81 return WalkResult::interrupt();
84 return WalkResult::advance();
91 if (hasCycle(runtimeSequenceOp)) {
109 PatternBenefit benefit = 1)
110 : RewritePattern(ConfigureOp::getOperationName(), benefit, context) {}
113 PatternRewriter &rewriter)
const override {
114 ConfigureOp configureOp = llvm::dyn_cast<ConfigureOp>(op);
121 if (!llvm::isa<AIE::RuntimeSequenceOp>(configureOp->getParentOp())) {
125 AIE::DeviceOp referencedDevice = configureOp.getReferencedDeviceOp();
126 if (!referencedDevice) {
127 configureOp.emitError(
"Referenced symbol is not a device");
131 Block *configureBlock;
132 if (configureOp.getBody().empty()) {
133 configureBlock = rewriter.createBlock(&configureOp.getBody());
135 configureBlock = &configureOp.getBody().front();
138 rewriter.setInsertionPointToStart(configureBlock);
139 AIEX::NpuLoadPdiOp::create(
140 rewriter, configureOp.getLoc(),
141 FlatSymbolRefAttr::get(referencedDevice.getSymNameAttr()),
142 nullptr,
nullptr,
nullptr,
143 configureOp.getExpandModeAttr());
157collectReferencedSSAValues(Operation *op,
const IRMapping &argMap,
158 llvm::SetVector<Value> &referencedValues) {
160 auto processValue = [&](Value operand) {
161 if (argMap.contains(operand)) {
168 if (!argMap.contains(traceResult->rootArg)) {
169 referencedValues.insert(traceResult->rootArg);
175 referencedValues.insert(operand);
179 for (Value operand : op->getOperands()) {
180 processValue(operand);
184 for (Region ®ion : op->getRegions()) {
185 region.walk([&](Operation *nestedOp) {
186 for (Value operand : nestedOp->getOperands()) {
187 if (argMap.contains(operand)) {
192 if (Operation *defOp = operand.getDefiningOp()) {
193 if (op->isProperAncestor(defOp)) {
196 }
else if (
auto blockArg = llvm::dyn_cast<BlockArgument>(operand)) {
203 Operation *owner = blockArg.getOwner()->getParentOp();
204 if (owner && (owner == op || op->isProperAncestor(owner))) {
209 processValue(operand);
218uniqueSymbolName(MLIRContext *ctx, llvm::StringRef base,
219 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
220 std::string uniqueName = base.str();
221 unsigned uniquingCounter = 0;
222 while (allSymbolNames.count(SymbolRefAttr::get(ctx, uniqueName))) {
223 uniqueName = base.str() +
"_" + std::to_string(uniquingCounter);
226 allSymbolNames.insert(SymbolRefAttr::get(ctx, uniqueName));
234getOrClone(PatternRewriter &rewriter, Operation *op, IRMapping &argMap,
235 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
236 mlir::OpBuilder::InsertPoint &insertPoint,
237 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
238 auto it = clonedDefs.find(op);
239 if (it == clonedDefs.end()) {
240 rewriter.restoreInsertionPoint(insertPoint);
241 Operation *clone = rewriter.clone(*op, argMap);
242 if (
auto name = clone->getAttrOfType<StringAttr>(
243 SymbolTable::getSymbolAttrName())) {
244 clone->setAttr(SymbolTable::getSymbolAttrName(),
245 rewriter.getStringAttr(uniqueSymbolName(
246 op->getContext(), name.getValue(), allSymbolNames)));
248 it = clonedDefs.try_emplace(op, clone).first;
249 insertPoint = rewriter.saveInsertionPoint();
251 argMap.map(op->getResults(), it->second->getResults());
258static LogicalResult copyReferencedSSAValues(
259 PatternRewriter &rewriter,
const llvm::SetVector<Value> &referencedValues,
260 AIE::DeviceOp callerDevice, IRMapping &argMap,
261 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
262 mlir::OpBuilder::InsertPoint &clonedSSAInsertPoint,
263 llvm::SetVector<SymbolRefAttr> &allSymbolNames, Operation *errorReportOp) {
265 llvm::SetVector<Value> referencedValuesToVisit = referencedValues;
266 std::vector<Operation *> referencedOpsToClone = {};
267 while (!referencedValuesToVisit.empty()) {
268 Value referencedValue = referencedValuesToVisit.pop_back_val();
269 Operation *definingOp = referencedValue.getDefiningOp();
271 return errorReportOp->emitError()
272 <<
"Referenced value is not defined by an operation";
274 if (llvm::find(referencedOpsToClone, definingOp) !=
275 referencedOpsToClone.end()) {
279 if (
auto tileOp = llvm::dyn_cast<AIE::TileOp>(definingOp)) {
280 referencedOpsToClone.insert(referencedOpsToClone.begin(), definingOp);
281 }
else if (
auto lockOp = llvm::dyn_cast<AIE::LockOp>(definingOp)) {
282 Value lockTile = lockOp.getTile();
284 referencedValuesToVisit.insert(lockTile);
286 referencedOpsToClone.push_back(definingOp);
287 }
else if (
auto bufferOp = llvm::dyn_cast<AIE::BufferOp>(definingOp)) {
288 referencedValuesToVisit.insert(bufferOp.getTile());
289 referencedOpsToClone.push_back(definingOp);
291 return errorReportOp->emitError()
292 <<
"Referenced SSA value defined by unsupported operation type: "
293 << definingOp->getName().getStringRef()
294 <<
". Currently only aie.tile, aie.lock and aie.buffer "
295 "operations are supported.";
299 for (Operation *definingOp : referencedOpsToClone) {
300 if (
auto tileOp = llvm::dyn_cast<AIE::TileOp>(definingOp)) {
301 int col = tileOp.getCol();
302 int row = tileOp.getRow();
306 AIE::TileOp existingTile =
nullptr;
307 for (AIE::TileOp tile : callerDevice.getOps<AIE::TileOp>()) {
308 if (tile.getCol() == col && tile.getRow() == row) {
316 if (tileOp->getAttrDictionary() != existingTile->getAttrDictionary()) {
319 auto filterAttrs = [](DictionaryAttr dict) -> DictionaryAttr {
320 SmallVector<NamedAttribute> filteredAttrs;
321 for (
auto namedAttr : dict) {
322 StringRef name = namedAttr.getName().getValue();
323 if (name !=
"col" && name !=
"row" &&
325 filteredAttrs.push_back(namedAttr);
328 return DictionaryAttr::get(dict.getContext(), filteredAttrs);
331 DictionaryAttr tileAttrs = filterAttrs(tileOp->getAttrDictionary());
332 DictionaryAttr existingAttrs =
333 filterAttrs(existingTile->getAttrDictionary());
335 if (tileAttrs != existingAttrs) {
336 return errorReportOp->emitError()
337 <<
"aie.tile(" << col <<
", " << row
338 <<
") already exists in the device with different "
343 SmallVector<AIE::ReservedBdId> calleeIds =
345 if (!calleeIds.empty()) {
346 SmallVector<AIE::ReservedBdId> ids =
348 ids.append(calleeIds);
353 Block *block = clonedSSAInsertPoint.getBlock();
354 Block::iterator point = clonedSSAInsertPoint.getPoint();
355 Operation *tile = existingTile.getOperation();
356 if (tile->getBlock() == block && point != block->end()) {
358 clonedSSAInsertPoint = OpBuilder::InsertPoint(block, ++point);
359 else if (!tile->isBeforeInBlock(&*point))
360 tile->moveBefore(&*point);
362 clonedDefs[definingOp] = tile;
366 Operation *clonedOp = getOrClone(rewriter, definingOp, argMap, clonedDefs,
367 clonedSSAInsertPoint, allSymbolNames);
368 rewriter.replaceOpUsesWithIf(
369 definingOp, clonedOp->getResult(0), [&](OpOperand &operand) {
370 return operand.getOwner()->getParentOfType<AIE::DeviceOp>() ==
383static LogicalResult inlineReferencedSymbolDefinitions(
384 PatternRewriter &rewriter, Operation *op, Operation *lookupFrom,
386 llvm::DenseMap<SymbolRefAttr, SymbolRefAttr> &previouslyInlinedSymbolMap,
387 AIE::DeviceOp callerDevice,
388 llvm::DenseMap<Operation *, Operation *> &clonedDefs,
390 mlir::OpBuilder::InsertPoint &clonedDefOpsInsertionPoint,
391 llvm::SetVector<SymbolRefAttr> &allSymbolNames) {
392 for (NamedAttribute namedAttr : op->getAttrs()) {
393 Attribute attr = namedAttr.getValue();
394 auto newAttr = attr.replace([&](SymbolRefAttr oldSymbolRef) {
395 auto inlined = previouslyInlinedSymbolMap.find(oldSymbolRef);
396 if (inlined != previouslyInlinedSymbolMap.end())
397 return std::make_pair(inlined->second, WalkResult::advance());
406 Operation *symbolDefOp =
nullptr;
407 Operation *calleeTable = SymbolTable::getNearestSymbolTable(lookupFrom);
408 if (calleeTable && calleeTable != callerDevice &&
409 oldSymbolRef.getNestedReferences().empty()) {
410 symbolDefOp = calleeNames.
getTable(calleeTable)
411 .
lookup(oldSymbolRef.getRootReference());
414 SymbolTable::lookupNearestSymbolFrom(lookupFrom, oldSymbolRef);
415 if (!symbolDefOp && oldSymbolRef.getNestedReferences().empty()) {
421 if (ModuleOp moduleOp = lookupFrom->getParentOfType<ModuleOp>()) {
422 symbolDefOp = SymbolTable::lookupSymbolIn(moduleOp, oldSymbolRef);
426 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
431 if (llvm::isa<AIE::DeviceOp>(symbolDefOp)) {
432 previouslyInlinedSymbolMap[oldSymbolRef] = oldSymbolRef;
433 return std::make_pair(oldSymbolRef, WalkResult::advance());
437 llvm::SetVector<Value> symbolReferencedValues;
438 collectReferencedSSAValues(symbolDefOp, argMap, symbolReferencedValues);
443 if (failed(copyReferencedSSAValues(
444 rewriter, symbolReferencedValues, callerDevice, argMap,
445 clonedDefs, clonedDefOpsInsertionPoint, allSymbolNames, op))) {
446 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
451 bool cloned = !clonedDefs.contains(symbolDefOp);
452 Operation *clonedSymbolDefOp =
453 getOrClone(rewriter, symbolDefOp, argMap, clonedDefs,
454 clonedDefOpsInsertionPoint, allSymbolNames);
455 SymbolRefAttr newSymbolRef =
456 FlatSymbolRefAttr::get(clonedSymbolDefOp->getAttrOfType<StringAttr>(
457 SymbolTable::getSymbolAttrName()));
458 previouslyInlinedSymbolMap[oldSymbolRef] = newSymbolRef;
462 failed(inlineReferencedSymbolDefinitions(
463 rewriter, clonedSymbolDefOp, symbolDefOp, argMap,
464 previouslyInlinedSymbolMap, callerDevice, clonedDefs, calleeNames,
465 clonedDefOpsInsertionPoint, allSymbolNames)))
466 return std::make_pair(oldSymbolRef, WalkResult::interrupt());
468 auto allocation = dyn_cast<AIE::ShimDMAAllocationOp>(clonedSymbolDefOp);
469 ArrayAttr proofs = allocation ? allocation.getConsumedByAttr() :
nullptr;
470 auto callee = symbolDefOp->getParentOfType<AIE::DeviceOp>();
471 if (cloned && proofs && callee && callee.getSymNameAttr()) {
472 SmallVector<Attribute> stamped;
473 for (
auto proof : proofs.getAsRange<AIE::ConsumedByAttr>())
474 stamped.push_back(AIE::ConsumedByAttr::get(
475 proof.getContext(), proof.getOutput(), proof.getInputBytes(),
476 proof.getOutputBytes(), proof.getGranuleBytes(),
479 : FlatSymbolRefAttr::get(callee.getSymNameAttr())));
480 allocation.setConsumedByAttr(rewriter.getArrayAttr(stamped));
482 return std::make_pair(newSymbolRef, WalkResult::advance());
487 op->setAttr(namedAttr.getName(), newAttr);
504 llvm::DenseMap<Operation *, Operation *> &
clonedDefs,
506 : RewritePattern(RunOp::getOperationName(), PatternBenefit(1), ctx),
513 PatternRewriter &rewriter)
const override {
514 llvm::DenseMap<SymbolRefAttr, SymbolRefAttr> previouslyInlinedSymbolMap;
516 RunOp runOp = llvm::dyn_cast<RunOp>(op);
521 AIE::DeviceOp calleeDevice = runOp.getCalleeDeviceOp();
522 AIE::RuntimeSequenceOp calleeRuntimeSequence =
524 if (!calleeDevice || !calleeRuntimeSequence) {
532 Region &calleeBody = calleeRuntimeSequence.getBody();
533 AIE::DeviceOp callerDevice =
534 runOp.getOperation()->getParentOfType<AIE::DeviceOp>();
536 runOp.emitError() <<
"needs to be in a DeviceOp";
542 ValueRange values = runOp.getArgs();
543 for (
unsigned i = 0, n = calleeBody.getNumArguments(); i < n; i++) {
544 BlockArgument arg = calleeBody.getArgument(i);
545 Value val = values[i];
546 argMap.map(arg, val);
555 llvm::SetVector<Value> referencedValues;
556 for (Operation &op : calleeBody.getOps()) {
557 collectReferencedSSAValues(&op, argMap, referencedValues);
559 llvm::SetVector<Value> filteredValues;
560 for (Value val : referencedValues) {
561 if (val.getParentRegion() != &calleeBody) {
562 filteredValues.insert(val);
565 referencedValues = std::move(filteredValues);
568 if (failed(copyReferencedSSAValues(rewriter, referencedValues, callerDevice,
576 AIE::RuntimeSequenceOp callerRuntimeSequence =
577 runOp.getOperation()->getParentOfType<AIE::RuntimeSequenceOp>();
578 if (!callerRuntimeSequence) {
579 runOp.emitError() <<
"needs to be (transitively) inside a "
580 "aie.runtime_sequence operation";
583 Block &callerBodyBlock = callerRuntimeSequence.getBody().front();
584 mlir::Block::iterator hoistPos = callerBodyBlock.begin();
594 rewriter.setInsertionPoint(runOp);
595 mlir::OpBuilder::InsertPoint clonedOpInsertionPoint =
596 rewriter.saveInsertionPoint();
597 for (Operation &op : calleeBody.getOps()) {
598 bool shouldHoist = llvm::isa<NpuCreateScratchpadOp>(&op);
600 rewriter.setInsertionPoint(&callerBodyBlock, hoistPos);
601 rewriter.clone(op, argMap);
605 rewriter.restoreInsertionPoint(clonedOpInsertionPoint);
606 Operation *clonedOp = rewriter.clone(op, argMap);
607 clonedOpInsertionPoint = rewriter.saveInsertionPoint();
610 WalkResult symbolWalk = clonedOp->walk([&](Operation *nestedOp) {
611 if (failed(inlineReferencedSymbolDefinitions(
612 rewriter, nestedOp, calleeRuntimeSequence.getOperation(),
613 argMap, previouslyInlinedSymbolMap, callerDevice,
clonedDefs,
615 return WalkResult::interrupt();
617 return WalkResult::advance();
619 if (symbolWalk.wasInterrupted()) {
625 rewriter.eraseOp(runOp);
638verifyRunOpsInConfigureOp(ConfigureOp configureOp, AIE::DeviceOp referencedDev,
640 if (configureOp.getBody().empty())
643 for (RunOp runOp : configureOp.getBody().front().getOps<RunOp>()) {
644 auto seqName = runOp.getRuntimeSequenceSymbol();
645 Operation *maybeSeq =
646 devNames.
lookup(runOp.getRuntimeSequenceSymbolAttr().getAttr());
648 auto err = runOp.emitError()
649 <<
"No such runtime sequence for device '"
650 << referencedDev.getSymName() <<
"': '" << seqName <<
"'";
651 err.attachNote(referencedDev.getLoc())
652 <<
"This device does not have a '" << seqName <<
"' runtime sequence";
655 auto runtimeSeq = llvm::dyn_cast<AIE::RuntimeSequenceOp>(maybeSeq);
657 return runOp.emitError()
658 <<
"'" << seqName <<
"' is not a runtime sequence";
663 Region &calleeRegion = runtimeSeq.getBody();
664 unsigned numCalleeArgs =
665 calleeRegion.empty() ? 0 : calleeRegion.getNumArguments();
666 ValueRange
args = runOp.getArgs();
667 if (numCalleeArgs !=
args.size())
668 return runOp.emitOpError() <<
"argument count mismatch: expected "
669 << numCalleeArgs <<
" but got " <<
args.size();
670 for (
unsigned i = 0; i < numCalleeArgs; i++) {
671 Type expected = calleeRegion.front().getArgument(i).getType();
672 Type actual =
args[i].getType();
673 if (expected != actual)
674 return runOp.emitOpError()
675 <<
"argument " << i <<
" type mismatch: expected " << expected
676 <<
" but got " << actual;
684 AIEMaterializeRuntimeSequencesPass> {
694 if (runtimeSeqOp.getBody().empty())
697 Block &body = runtimeSeqOp.getBody().front();
698 NpuCreateScratchpadOp firstScratchpad;
699 SmallVector<NpuCreateScratchpadOp> duplicates;
700 for (NpuCreateScratchpadOp scratchpadOp :
701 body.getOps<NpuCreateScratchpadOp>()) {
702 if (!firstScratchpad) {
703 firstScratchpad = scratchpadOp;
706 if (firstScratchpad.getSize() != scratchpadOp.getSize()) {
707 scratchpadOp.emitError(
708 "create_scratchpad size mismatch after inlining: ")
709 << scratchpadOp.getSize() <<
" != " << firstScratchpad.getSize();
712 duplicates.push_back(scratchpadOp);
714 for (NpuCreateScratchpadOp dup : duplicates)
721 ModuleOp moduleOp = getOperation();
726 for (AIE::DeviceOp deviceOp : moduleOp.getOps<AIE::DeviceOp>()) {
729 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
730 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
731 if (failed(runtimeSequenceOp.verifyBeforeMaterialization())) {
732 return signalPassFailure();
740 for (ConfigureOp configureOp :
741 runtimeSequenceOp.getOps<ConfigureOp>()) {
742 AIE::DeviceOp referencedDev = configureOp.getReferencedDeviceOp();
743 if (!referencedDev) {
747 return signalPassFailure();
749 if (failed(verifyRunOpsInConfigureOp(configureOp, referencedDev,
750 referencedDevNames)))
751 return signalPassFailure();
756 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
757 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
759 getAnalysisManager().nest(deviceOp).nest(runtimeSequenceOp);
763 return signalPassFailure();
766 runtimeSequenceOp.emitError(
767 "Runtime sequence call graph contains a cycle");
768 return signalPassFailure();
776 mlir::Block &deviceBodyFirstBlock = deviceOp.getBodyRegion().front();
777 auto runtimeSequenceOps = deviceOp.getOps<AIE::RuntimeSequenceOp>();
778 if (runtimeSequenceOps.begin() == runtimeSequenceOps.end()) {
782 AIE::RuntimeSequenceOp firstRuntimeSequenceOp =
783 *runtimeSequenceOps.begin();
784 mlir::OpBuilder::InsertPoint ssaDefInsertPoint(
785 &deviceBodyFirstBlock, deviceBodyFirstBlock.begin());
786 mlir::OpBuilder::InsertPoint symbolDefInsertPoint(
787 &deviceBodyFirstBlock, mlir::Block::iterator(firstRuntimeSequenceOp));
788 llvm::SetVector<SymbolRefAttr> allSymbolNames = {};
789 for (Operation &op : deviceBodyFirstBlock) {
790 if (
auto symbolName = op.getAttrOfType<StringAttr>(
791 SymbolTable::getSymbolAttrName())) {
792 allSymbolNames.insert(SymbolRefAttr::get(symbolName));
796 MLIRContext *ctx = &getContext();
797 GreedyRewriteConfig rewriter_config = GreedyRewriteConfig();
798 rewriter_config.setRegionSimplificationLevel(
799 GreedySimplifyRegionLevel::Disabled);
801 RewritePatternSet patterns_0(ctx);
802 llvm::DenseMap<Operation *, Operation *> clonedDefs;
805 ctx, ssaDefInsertPoint, symbolDefInsertPoint, allSymbolNames,
806 clonedDefs, calleeNames);
807 if (failed(applyPatternsGreedily(deviceOp, std::move(patterns_0),
809 return signalPassFailure();
813 for (AIE::RuntimeSequenceOp runtimeSeqOp :
814 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
816 return signalPassFailure();
820 RewritePatternSet patterns_1(ctx);
822 walkAndApplyPatterns(deviceOp, std::move(patterns_1));
826 RewritePatternSet canonicalize_patterns(ctx);
827 AIEX::NpuLoadPdiOp::getCanonicalizationPatterns(canonicalize_patterns,
829 SmallVector<Operation *> loadPdis;
830 deviceOp.walk([&](NpuLoadPdiOp op) { loadPdis.push_back(op); });
831 GreedyRewriteConfig loadPdiConfig = rewriter_config;
832 loadPdiConfig.setStrictness(GreedyRewriteStrictness::ExistingOps);
833 if (failed(applyOpPatternsGreedily(
834 loadPdis, std::move(canonicalize_patterns), loadPdiConfig))) {
835 return signalPassFailure();
840 for (AIE::RuntimeSequenceOp runtimeSequenceOp :
841 deviceOp.getOps<AIE::RuntimeSequenceOp>()) {
842 SmallVector<ConfigureOp> configureOps;
844 for (ConfigureOp configureOp :
845 runtimeSequenceOp.getOps<ConfigureOp>()) {
846 configureOps.push_back(configureOp);
849 IRRewriter rewriter(ctx);
850 for (ConfigureOp configureOp : configureOps) {
851 Block &configureBlock = configureOp.getBody().front();
854 SmallVector<Operation *> opsToHoist;
855 for (Operation &op : configureBlock) {
856 opsToHoist.push_back(&op);
860 rewriter.setInsertionPoint(configureOp);
861 for (Operation *op : opsToHoist) {
862 op->moveBefore(configureOp);
866 rewriter.eraseOp(configureOp);
874std::unique_ptr<OperationPass<ModuleOp>>
876 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()
void setReservedBdIds(TileOp tile, llvm::ArrayRef< ReservedBdId > ids)
bool isReservedBdIdsAttr(llvm::StringRef name)
mlir::Operation * lookupNamedOp(mlir::Operation *from, mlir::StringAttr name)
llvm::SmallVector< ReservedBdId > getReservedBdIds(TileOp tile)
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