Skip to content

Commit

Permalink
[ObjectFifo] Add a pass to combine logical objFifos for connection reuse
Browse files Browse the repository at this point in the history
-- This commit adds a new pass
   `--iree-amdaie-logical-objectfifos-for-connection-reuse`.
-- Essentially follows the narrative after splitting of logical objectFifos
   and is aimed to address point 4 of #644.

Signed-off-by: Abhishek Varma <[email protected]>
  • Loading branch information
Abhishek-Varma committed Sep 10, 2024
1 parent 80b81a1 commit 9b288f9
Show file tree
Hide file tree
Showing 9 changed files with 670 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2024 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "iree-amd-aie/IR/AMDAIEOps.h"
#include "iree-amd-aie/Transforms/AMDAIELogicalObjFifoSplittingUtils.h"
#include "iree-amd-aie/Transforms/Passes.h"
#include "mlir/IR/Iterators.h"
#include "mlir/Pass/Pass.h"

#define DEBUG_TYPE \
"iree-amdaie-combine-logical-objectfifos-for-connection-reuse"

namespace mlir::iree_compiler::AMDAIE {

namespace {

class AMDAIECombineLogicalObjFifosForConnectionReusePass
: public impl::AMDAIECombineLogicalObjFifosForConnectionReuseBase<
AMDAIECombineLogicalObjFifosForConnectionReusePass> {
public:
using AMDAIECombineLogicalObjFifosForConnectionReuseBase::
AMDAIECombineLogicalObjFifosForConnectionReuseBase;

void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<AMDAIEDialect>();
}
void runOnOperation() override;
};

void AMDAIECombineLogicalObjFifosForConnectionReusePass::runOnOperation() {
ModuleOp moduleOp = getOperation();
MLIRContext *context = &getContext();
IRRewriter rewriter(context);

SmallVector<AMDAIE::DmaCpyNdOp> l2ToL1DmaOps =
fetchDmaCpyNdOpsToSplitOrCombine(moduleOp);

if (failed(combineLogicalObjectFifos(rewriter, l2ToL1DmaOps, context))) {
return signalPassFailure();
}
}

} // namespace

std::unique_ptr<Pass>
createAMDAIECombineLogicalObjFifosForConnectionReusePass() {
return std::make_unique<AMDAIECombineLogicalObjFifosForConnectionReusePass>();
}

} // namespace mlir::iree_compiler::AMDAIE
Loading

0 comments on commit 9b288f9

Please sign in to comment.