Skip to content

Commit

Permalink
Upgrade mlir-tv to support the latest MLIR (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hatsunespica authored May 14, 2023
1 parent f65e798 commit a661c37
Show file tree
Hide file tree
Showing 186 changed files with 391 additions and 381 deletions.
2 changes: 1 addition & 1 deletion src/abstractops.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "smt.h"
#include "llvm/ADT/APFloat.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/IR/BuiltinOps.h"
#include <vector>
#include <set>
Expand Down
12 changes: 6 additions & 6 deletions src/analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ void analyzeRegion(mlir::Region &region, AnalysisResult &res) {

template<>
bool analyzeOp(mlir::memref::GetGlobalOp op, AnalysisResult &res) {
llvm::StringRef glbName = op.name();
llvm::StringRef glbName = op.getName();
auto mop = op.getOperation()->getParentOfType<mlir::ModuleOp>();
auto glb = mlir::cast<mlir::memref::GlobalOp>(mop.lookupSymbol(glbName));
res.memref.usedGlobals[glbName.str()] = glb;

if (glb.constant() && glb.initial_value()) {
analyzeElemAttr(*glb.initial_value(), res);
if (glb.getConstant() && glb.getInitialValue()) {
analyzeElemAttr(glb.getInitialValue()->cast<mlir::ElementsAttr>(), res);
}
return true;
}
Expand Down Expand Up @@ -282,13 +282,13 @@ bool analyzeOp(mlir::tosa::ClampOp op, AnalysisResult &res) {
template<>
bool analyzeOp(mlir::linalg::GenericOp op, AnalysisResult &res) {
// If generic loop has reduction loops, then result is not elementwise
auto indexingMaps = op.indexing_maps().getValue();
auto indexingMaps = op.getIndexingMaps().getValue();
auto outputMap = indexingMaps.back().cast<mlir::AffineMapAttr>().getValue();
bool isReudctionLoop = !outputMap.isPermutation();
if (isReudctionLoop)
res.isElementwiseFPOps = false;

analyzeRegion(op.region(), res);
analyzeRegion(op.getRegion(), res);
return true;
}

Expand Down Expand Up @@ -338,7 +338,7 @@ void analyzeBlock(
// and newly created FPs can be stored to output memref.
if (auto op2 = mlir::dyn_cast<mlir::linalg::GenericOp>(op)) {
if (op2.hasBufferSemantics()) {
for (const auto &operand: op2.outputs()) {
for (const auto &operand: op2.getOutputs()) {
analyzeVariable(operand, res, VarAnalysisConfig::operand());
}
}
Expand Down
Loading

0 comments on commit a661c37

Please sign in to comment.