Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LowerToAIE] Handle linalg ops like other ops in switch statement #693

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "iree-amd-aie/IR/AMDAIEOps.h"
#include "iree-amd-aie/Transforms/AMDAIEUtils.h"
#include "iree-amd-aie/Transforms/Passes.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Iterators.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
Expand Down Expand Up @@ -61,7 +60,6 @@ void eraseOp(IRRewriter &rewriter, IRMapping &mapper, Operation *op) {

namespace {


/// Utility to convert vectors of `size` and `stride` into an
/// `AIE::BDDimLayoutArrayAttr`.
AIE::BDDimLayoutArrayAttr convertSizeStrideToBDDimLayoutArrayAttr(
Expand Down Expand Up @@ -265,17 +263,6 @@ LogicalResult acquireOpToAIE(IRRewriter &rewriter,
return success();
}

LogicalResult coreLinalgOpToAIE(IRRewriter &rewriter, linalg::LinalgOp linalgOp,
IRMapping &mapper,
SmallVector<Operation *> &toBeErased) {
LLVM_DEBUG(llvm::dbgs() << "Convert [linalg.LinalgOp]\n");
OpBuilder::InsertionGuard guard(rewriter);
rewriter.setInsertionPoint(linalgOp);
rewriter.clone(*(linalgOp.getOperation()), mapper);
eraseOp(rewriter, mapper, linalgOp);
return success();
}

LogicalResult coreMemrefExtractStridedMetadataToAIE(
IRRewriter &rewriter,
memref::ExtractStridedMetadataOp extractStridedMetadataOp,
Expand Down Expand Up @@ -409,9 +396,6 @@ LogicalResult coreToAIE(IRRewriter &rewriter, AMDAIE::CoreOp coreOp,
return coreReleaseOpToAIE(rewriter, releaseOp, mapper,
toBeErased);
})
.Case<linalg::LinalgOp>([&](auto linalgOp) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reading the description and PR, this seems like it is dropping general handling of LinalgOp. Is that to mean that we dont expect LinalgOps to survive till here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of handling them as a special case:

They are now handled like other not-special ops:

We (I) do expect LinalgOps to survive til here.

return coreLinalgOpToAIE(rewriter, linalgOp, mapper, toBeErased);
})
.Case<memref::ExtractStridedMetadataOp>(
[&](auto extractStridedMetadataOp) {
return coreMemrefExtractStridedMetadataToAIE(
Expand Down Expand Up @@ -1008,7 +992,7 @@ class AMDAIELowerToAIEPass
}

AMDAIELowerToAIEPass() = default;
AMDAIELowerToAIEPass(const AMDAIELowerToAIEPass &pass) {};
AMDAIELowerToAIEPass(const AMDAIELowerToAIEPass &pass){};
void runOnOperation() override;
};

Expand Down
Loading