Skip to content

Commit

Permalink
Integrate LLVM @ 7900daaa7ba57b5f9729bbbdb54f4e0599a45cd7 (#18773)
Browse files Browse the repository at this point in the history
- Also bump torch-mlir to
[edd1bbec46fc08318163c9dc0eb45decee63ec5b](https://github.com/llvm/torch-mlir/tree/edd1bbec46fc08318163c9dc0eb45decee63ec5b).
- No local patch is carried.
- Most of the changes are made due to
llvm/llvm-project#110344

---------

Signed-off-by: yzhang93 <[email protected]>
  • Loading branch information
yzhang93 authored Oct 15, 2024
1 parent ab88871 commit 7622770
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
4 changes: 3 additions & 1 deletion compiler/plugins/input/TOSA/InputConversion/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ void buildTOSAInputConversionPassPipeline(OpPassManager &passManager) {

TosaToLinalgNamedOptions tosaToLinalgNamedOptions;
tosaToLinalgNamedOptions.preferConv2DKernelLayoutHWCF = true;
tosa::TosaValidationOptions tosaValidationOptions;
tosaValidationOptions.profile = {"bi", "mi", "mt"};
tosa::addTosaToLinalgPasses(passManager, TosaToLinalgOptions(),
tosaToLinalgNamedOptions);
tosaToLinalgNamedOptions, tosaValidationOptions);
passManager.addNestedPass<func::FuncOp>(
iree_compiler::createConverti48Toi64Pass());

Expand Down
28 changes: 18 additions & 10 deletions compiler/src/iree/compiler/Codegen/Common/VectorLayoutAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class EnforceLayout : public DataFlowAnalysis {

LogicalResult initialize(Operation *root) override;

LogicalResult visit(ProgramPoint point) override;
LogicalResult visit(ProgramPoint *point) override;

void registerNewValue(Value val, const VectorLayoutInterface &layout);

Expand All @@ -147,7 +147,7 @@ class PropagateLayout : public DataFlowAnalysis {

LogicalResult initialize(Operation *root) override;

LogicalResult visit(ProgramPoint point) override;
LogicalResult visit(ProgramPoint *point) override;

/// Register a new value to be part of the dataflow analysis. The value should
/// not be part of the analysis already. This is used for new values that are
Expand Down Expand Up @@ -308,7 +308,7 @@ void DistributionLayout::onUpdate(DataFlowSolver *solver) const {
if (propagation) {
// Make propagation run again on all users of this value.
for (Operation *user : value.getUsers()) {
solver->enqueue({user, propagation});
solver->enqueue({solver->getProgramPointAfter(user), propagation});
}
// TODO: Maybe we need to run it on the parent operation as well to give
// layout to other results? Seems unlikely though as results usually
Expand All @@ -318,17 +318,19 @@ void DistributionLayout::onUpdate(DataFlowSolver *solver) const {
if (enforcement) {
// Make enforcement run on the parent.
if (Operation *definingOp = value.getDefiningOp()) {
solver->enqueue({definingOp, enforcement});
solver->enqueue({solver->getProgramPointAfter(definingOp), enforcement});
} else {
// TODO: This is not always correct. Ideally, we should enqueue all
// predecessors of these block arguements.
solver->enqueue({value.getParentBlock()->getParentOp(), enforcement});
solver->enqueue(
{solver->getProgramPointAfter(value.getParentBlock()->getParentOp()),
enforcement});
}

// Enforce users of this value also, as some other operands may need to
// be updated.
for (Operation *user : value.getUsers()) {
solver->enqueue({user, enforcement});
solver->enqueue({solver->getProgramPointAfter(user), enforcement});
}
}
}
Expand Down Expand Up @@ -849,8 +851,11 @@ LogicalResult PropagateLayout::initialize(Operation *root) {
return success();
}

LogicalResult PropagateLayout::visit(ProgramPoint point) {
if (Operation *op = dyn_cast_or_null<Operation *>(point)) {
LogicalResult PropagateLayout::visit(ProgramPoint *point) {
if (point->isBlockStart())
return success();

if (auto op = point->getPrevOp()) {
visitOperation(op);
return success();
}
Expand Down Expand Up @@ -969,8 +974,11 @@ LogicalResult EnforceLayout::initialize(Operation *root) {
return success();
}

LogicalResult EnforceLayout::visit(ProgramPoint point) {
if (Operation *op = dyn_cast_or_null<Operation *>(point)) {
LogicalResult EnforceLayout::visit(ProgramPoint *point) {
if (point->isBlockStart())
return success();

if (auto op = point->getPrevOp()) {
visitOperation(op);
return success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class DataFlowListener : public RewriterBase::Listener {

protected:
void notifyOperationErased(Operation *op) override {
s.eraseState(op);
s.eraseState(s.getProgramPointAfter(op));
for (Value res : op->getResults())
flushValue(res);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ static bool isaTransposeOpInterface(linalg::LinalgOp linalgOp) {
// single input.
static void specializeGenericTransposeOp(RewriterBase &rewriter,
linalg::GenericOp genericOp) {
if (!isaTransposeOpInterface(genericOp)) {
if (!mlir::iree_compiler::GlobalOptimization::isaTransposeOpInterface(
genericOp)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project
Submodule llvm-project updated 1580 files

0 comments on commit 7622770

Please sign in to comment.