Skip to content

Commit 6283451

Browse files
hanchenyeivanradanov
authored andcommitted
Bump polygeist to 6ba6b7b
1 parent f786ae9 commit 6283451

31 files changed

+158
-147
lines changed

tools/polymer/.github/workflows/buildAndTest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: actions/checkout@v2
3636
with:
3737
repository: "wsmoses/Polygeist"
38-
ref: "e5b8b83312c7a5f6fd94ea1a2cda87e54c4451fd"
38+
ref: "6ba6b7b8ac07c9d60994eb46b46682a9f76ea34e"
3939
path: "polygeist"
4040
submodules: "true"
4141

tools/polymer/include/polymer/Support/ScopStmt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class Operation;
1616
class FlatAffineValueConstraints;
1717
class AffineValueMap;
1818
class FuncOp;
19+
namespace func {
1920
class CallOp;
21+
} // namespace func
2022
class Value;
2123
} // namespace mlir
2224

@@ -44,7 +46,7 @@ class ScopStmt {
4446
/// Get the callee of this scop stmt.
4547
mlir::FuncOp getCallee() const;
4648
/// Get the caller of this scop stmt.
47-
mlir::CallOp getCaller() const;
49+
mlir::func::CallOp getCaller() const;
4850
/// Get the access AffineValueMap of an op in the callee and the memref in the
4951
/// caller scope that this op is using.
5052
void getAccessMapAndMemRef(mlir::Operation *op, mlir::AffineValueMap *vMap,

tools/polymer/include/polymer/Target/OpenScop.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "llvm/ADT/StringMap.h"
1818

1919
namespace mlir {
20-
class OwningModuleRef;
20+
template <typename OpTy> class OwningOpRef;
2121
class MLIRContext;
2222
class ModuleOp;
2323
class FuncOp;
@@ -42,8 +42,9 @@ createFuncOpFromOpenScop(std::unique_ptr<OslScop> scop, mlir::ModuleOp module,
4242
PlutoProg *prog = nullptr,
4343
const char *dumpClastAfterPluto = nullptr);
4444

45-
mlir::OwningModuleRef translateOpenScopToModule(std::unique_ptr<OslScop> scop,
46-
mlir::MLIRContext *context);
45+
mlir::OwningOpRef<mlir::ModuleOp>
46+
translateOpenScopToModule(std::unique_ptr<OslScop> scop,
47+
mlir::MLIRContext *context);
4748

4849
mlir::LogicalResult translateModuleToOpenScop(
4950
mlir::ModuleOp module,

tools/polymer/include/polymer/Transforms/Passes.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
#include "mlir/Pass/Pass.h"
66

7+
namespace mlir {
8+
class Pass;
9+
} // namespace mlir
10+
711
namespace polymer {
812

9-
std::unique_ptr<mlir::OperationPass<mlir::FuncOp>> createAnnotateScopPass();
13+
std::unique_ptr<mlir::Pass> createAnnotateScopPass();
1014

1115
/// Generate the code for registering passes.
1216
#define GEN_PASS_REGISTRATION

tools/polymer/include/polymer/Transforms/Passes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
include "mlir/Pass/PassBase.td"
55
include "mlir/Rewrite/PassUtil.td"
66

7-
def AnnotateScop : FunctionPass<"annotate-scop"> {
7+
def AnnotateScop : Pass<"annotate-scop", "mlir::FuncOp"> {
88
let summary = "Annotate scop.ignore to unselected functions.";
99
let constructor = "polymer::createAnnotateScopPass()";
1010

tools/polymer/lib/Support/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_mlir_library(PolymerSupport
1414

1515
LINK_LIBS PUBLIC
1616
MLIRAnalysis
17-
MLIRLoopAnalysis
17+
MLIRAffineAnalysis
1818

1919
# libosl
2020
# libcloog

tools/polymer/lib/Support/OslScop.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
#include "osl/osl.h"
1212

13-
#include "mlir/Analysis/AffineAnalysis.h"
14-
#include "mlir/Analysis/AffineStructures.h"
13+
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
14+
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
1515
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1616
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
17-
#include "mlir/Dialect/StandardOps/IR/Ops.h"
17+
#include "mlir/Dialect/Func/IR/FuncOps.h"
1818
#include "mlir/IR/Attributes.h"
1919
#include "mlir/IR/BuiltinOps.h"
2020
#include "mlir/IR/Operation.h"
@@ -451,7 +451,7 @@ void OslScop::addBodyExtension(int stmtId, const ScopStmt &stmt) {
451451
for (unsigned i = 0; i < numIVs; i++)
452452
ss << "i" << i << " ";
453453

454-
mlir::CallOp caller = stmt.getCaller();
454+
mlir::func::CallOp caller = stmt.getCaller();
455455
mlir::FuncOp callee = stmt.getCallee();
456456
ss << "\n" << callee.getName() << "(";
457457

tools/polymer/lib/Support/OslScopStmtOpSet.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
#include "polymer/Support/OslScopStmtOpSet.h"
88

9-
#include "mlir/Analysis/AffineAnalysis.h"
10-
#include "mlir/Analysis/AffineStructures.h"
11-
#include "mlir/Analysis/Utils.h"
9+
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
10+
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
11+
#include "mlir/Dialect/Affine/Analysis/Utils.h"
1212
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1313
#include "mlir/IR/Operation.h"
1414
#include "mlir/Support/LogicalResult.h"

tools/polymer/lib/Support/ScopStmt.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
#include "polymer/Support/ScopStmt.h"
88

9-
#include "mlir/Analysis/AffineAnalysis.h"
10-
#include "mlir/Analysis/AffineStructures.h"
11-
#include "mlir/Analysis/Utils.h"
9+
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
10+
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
11+
#include "mlir/Dialect/Affine/Analysis/Utils.h"
1212
#include "mlir/Dialect/Affine/IR/AffineOps.h"
1313
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
1414
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
15-
#include "mlir/Dialect/StandardOps/IR/Ops.h"
15+
#include "mlir/Dialect/Func/IR/FuncOps.h"
1616
#include "mlir/IR/BlockAndValueMapping.h"
1717
#include "mlir/IR/Builders.h"
1818
#include "mlir/IR/BuiltinOps.h"
@@ -34,7 +34,8 @@ class ScopStmtImpl {
3434
public:
3535
using EnclosingOpList = SmallVector<Operation *, 8>;
3636

37-
ScopStmtImpl(llvm::StringRef name, mlir::CallOp caller, mlir::FuncOp callee)
37+
ScopStmtImpl(llvm::StringRef name, mlir::func::CallOp caller,
38+
mlir::FuncOp callee)
3839
: name(name), caller(caller), callee(callee) {}
3940

4041
static std::unique_ptr<ScopStmtImpl> get(mlir::Operation *callerOp,
@@ -50,7 +51,7 @@ class ScopStmtImpl {
5051
/// symbol in the OpenScop representation.
5152
llvm::StringRef name;
5253
/// The caller to the scop.stmt func.
53-
mlir::CallOp caller;
54+
mlir::func::CallOp caller;
5455
/// The scop.stmt callee.
5556
mlir::FuncOp callee;
5657
/// The domain of the caller.
@@ -64,9 +65,9 @@ class ScopStmtImpl {
6465
/// Create ScopStmtImpl from only the caller/callee pair.
6566
std::unique_ptr<ScopStmtImpl> ScopStmtImpl::get(mlir::Operation *callerOp,
6667
mlir::Operation *calleeOp) {
67-
// We assume that the callerOp is of type mlir::CallOp, and the calleeOp is a
68-
// mlir::FuncOp. If not, these two cast lines will raise error.
69-
mlir::CallOp caller = cast<mlir::CallOp>(callerOp);
68+
// We assume that the callerOp is of type mlir::func::CallOp, and the calleeOp
69+
// is a mlir::FuncOp. If not, these two cast lines will raise error.
70+
mlir::func::CallOp caller = cast<mlir::func::CallOp>(callerOp);
7071
mlir::FuncOp callee = cast<mlir::FuncOp>(calleeOp);
7172
llvm::StringRef name = caller.getCallee();
7273

@@ -185,7 +186,7 @@ void ScopStmt::getEnclosingOps(llvm::SmallVectorImpl<mlir::Operation *> &ops,
185186
}
186187

187188
mlir::FuncOp ScopStmt::getCallee() const { return impl->callee; }
188-
mlir::CallOp ScopStmt::getCaller() const { return impl->caller; }
189+
mlir::func::CallOp ScopStmt::getCaller() const { return impl->caller; }
189190

190191
static mlir::Value findBlockArg(mlir::Value v) {
191192
mlir::Value r = v;

tools/polymer/lib/Target/OpenScop/ConvertFromOpenScop.cc

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,24 @@ extern "C" {
2121
#include "polymer/Support/Utils.h"
2222
#include "polymer/Target/OpenScop.h"
2323

24-
#include "mlir/Analysis/AffineAnalysis.h"
25-
#include "mlir/Analysis/AffineStructures.h"
26-
#include "mlir/Analysis/LoopAnalysis.h"
27-
#include "mlir/Analysis/Utils.h"
24+
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
25+
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
26+
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
27+
#include "mlir/Dialect/Affine/Analysis/Utils.h"
2828
#include "mlir/Dialect/Affine/IR/AffineOps.h"
2929
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
30+
#include "mlir/Dialect/Affine/LoopUtils.h"
3031
#include "mlir/Dialect/Affine/Utils.h"
3132
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
33+
#include "mlir/Dialect/Func/IR/FuncOps.h"
3234
#include "mlir/Dialect/MemRef/IR/MemRef.h"
33-
#include "mlir/Dialect/StandardOps/IR/Ops.h"
3435
#include "mlir/IR/BlockAndValueMapping.h"
3536
#include "mlir/IR/Builders.h"
36-
#include "mlir/IR/BuiltinOps.h"
3737
#include "mlir/IR/BuiltinTypes.h"
3838
#include "mlir/IR/Dominance.h"
3939
#include "mlir/IR/Function.h"
4040
#include "mlir/IR/IntegerSet.h"
4141
#include "mlir/IR/MLIRContext.h"
42-
#include "mlir/Transforms/LoopUtils.h"
43-
#include "mlir/Transforms/Utils.h"
4442
#include "mlir/Translation.h"
4543

4644
#include "llvm/Support/Error.h"
@@ -598,7 +596,7 @@ void Importer::initializeFuncOpInterface() {
598596
// Initialize the symbol table for these entryBlock arguments
599597
auto &entryBlock = *func.addEntryBlock();
600598
b.setInsertionPointToStart(&entryBlock);
601-
b.create<mlir::ReturnOp>(UnknownLoc::get(context));
599+
b.create<mlir::func::ReturnOp>(UnknownLoc::get(context));
602600

603601
b.setInsertionPointToStart(&entryBlock);
604602
for (unsigned i = 0; i < entryBlock.getNumArguments(); i++) {
@@ -609,7 +607,7 @@ void Importer::initializeFuncOpInterface() {
609607
if (scop->isParameterSymbol(argSymbol) &&
610608
arg.getType() != b.getIndexType()) {
611609
mlir::Operation *op = b.create<mlir::arith::IndexCastOp>(
612-
sourceFuncOp.getLoc(), arg, b.getIndexType());
610+
sourceFuncOp.getLoc(), b.getIndexType(), arg);
613611
symbolTable[argSymbol] = op->getResult(0);
614612
} else {
615613
symbolTable[argSymbol] = arg;
@@ -820,7 +818,7 @@ void Importer::createCalleeAndCallerArgs(
820818
// TODO: refactorize these two lines into a single API.
821819
Value memref = symTable->getValue(args[i]);
822820
if (!memref) {
823-
memref = entryBlock.addArgument(memType);
821+
memref = entryBlock.addArgument(memType, b.getUnknownLoc());
824822
symTable->setValue(args[i], memref, OslSymbolTable::Memref);
825823
}
826824
callerArgs.push_back(memref);
@@ -990,7 +988,7 @@ LogicalResult Importer::processStmt(clast_user_stmt *userStmt) {
990988

991989
assert(callee.getName() == calleeName && "Callee names should match.");
992990
// Note that caller is in the original function.
993-
mlir::CallOp origCaller = it->second.getCaller();
991+
mlir::func::CallOp origCaller = it->second.getCaller();
994992
loc = origCaller.getLoc();
995993
unsigned currInductionVar = 0;
996994

@@ -1008,7 +1006,7 @@ LogicalResult Importer::processStmt(clast_user_stmt *userStmt) {
10081006
OpBuilder::InsertionGuard guard(b);
10091007
b.setInsertionPointAfterValue(val);
10101008
mlir::Operation *castOp = b.create<mlir::arith::IndexCastOp>(
1011-
b.getUnknownLoc(), val, arg.getType());
1009+
b.getUnknownLoc(), arg.getType(), val);
10121010
callerArgs.push_back(castOp->getResult(0));
10131011
} else {
10141012
callerArgs.push_back(val);
@@ -1065,7 +1063,7 @@ LogicalResult Importer::processStmt(clast_user_stmt *userStmt) {
10651063
}
10661064

10671065
// Finally create the CallOp.
1068-
b.create<mlir::CallOp>(loc, callee, callerArgs);
1066+
b.create<mlir::func::CallOp>(loc, callee, callerArgs);
10691067

10701068
return success();
10711069
}
@@ -1317,11 +1315,12 @@ LogicalResult Importer::processStmt(clast_for *forStmt) {
13171315
vMap.map(args, func.getArguments());
13181316
b.setInsertionPointToStart(newEntry);
13191317
b.clone(*forOp.getOperation(), vMap);
1320-
b.create<mlir::ReturnOp>(func.getLoc(), llvm::None);
1318+
b.create<mlir::func::ReturnOp>(func.getLoc(), llvm::None);
13211319

13221320
// Create function call.
13231321
b.setInsertionPointAfter(forOp);
1324-
b.create<mlir::CallOp>(forOp.getLoc(), func, ValueRange(args.getArrayRef()));
1322+
b.create<mlir::func::CallOp>(forOp.getLoc(), func,
1323+
ValueRange(args.getArrayRef()));
13251324

13261325
// Clean up
13271326
forOp.erase();
@@ -1539,11 +1538,11 @@ mlir::Operation *polymer::createFuncOpFromOpenScop(
15391538
return deserializer.getFunc();
15401539
}
15411540

1542-
OwningModuleRef
1541+
OwningOpRef<ModuleOp>
15431542
polymer::translateOpenScopToModule(std::unique_ptr<OslScop> scop,
15441543
MLIRContext *context) {
15451544
context->loadDialect<AffineDialect>();
1546-
OwningModuleRef module(ModuleOp::create(
1545+
OwningOpRef<ModuleOp> module(ModuleOp::create(
15471546
FileLineColLoc::get(context, "", /*line=*/0, /*column=*/0)));
15481547

15491548
OslSymbolTable symTable;
@@ -1554,8 +1553,8 @@ polymer::translateOpenScopToModule(std::unique_ptr<OslScop> scop,
15541553
return module;
15551554
}
15561555

1557-
static OwningModuleRef translateOpenScopToModule(llvm::SourceMgr &sourceMgr,
1558-
MLIRContext *context) {
1556+
static OwningOpRef<ModuleOp>
1557+
translateOpenScopToModule(llvm::SourceMgr &sourceMgr, MLIRContext *context) {
15591558
llvm::SMDiagnostic err;
15601559
std::unique_ptr<OslScop> scop =
15611560
readOpenScop(*sourceMgr.getMemoryBuffer(sourceMgr.getMainFileID()));

0 commit comments

Comments
 (0)