Skip to content

Commit dc6ee4b

Browse files
[SYCL-MLIR] Fix merge
Signed-off-by: Tsang, Whitney <[email protected]>
1 parent cdab15d commit dc6ee4b

24 files changed

+375
-383
lines changed

mlir-sycl/lib/Dialect/IR/SYCLOpsDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SYCLInlinerInterface : public mlir::DialectInlinerInterface {
4848
/// \p Dest region. All operations in the SYCL dialect are legal to inline.
4949
bool isLegalToInline(mlir::Operation *Op, mlir::Region *Dest,
5050
bool WouldBeCloned,
51-
mlir::BlockAndValueMapping &ValueMapping) const final {
51+
mlir::IRMapping &ValueMapping) const final {
5252
return true;
5353
}
5454

mlir/lib/Dialect/Arith/IR/ArithOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,8 @@ LogicalResult arith::ExtSIOp::verify() {
12291229
//===----------------------------------------------------------------------===//
12301230

12311231
/// Always fold extension of FP constants.
1232-
OpFoldResult arith::ExtFOp::fold(ArrayRef<Attribute> operands) {
1232+
OpFoldResult arith::ExtFOp::fold(FoldAdaptor adaptor) {
1233+
ArrayRef<Attribute> operands = adaptor.getOperands();
12331234
assert(operands.size() == 1 && "unary operation takes one operand");
12341235

12351236
auto constOperand = operands.front().dyn_cast_or_null<FloatAttr>();

mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ struct VectorInlinerInterface : public DialectInlinerInterface {
271271

272272
/// All operations can be inlined.
273273
bool isLegalToInline(Operation *, Region *, bool wouldBeCloned,
274-
BlockAndValueMapping &) const final {
274+
IRMapping &) const final {
275275
return true;
276276
}
277277
};

polygeist/include/polygeist/Passes/Utils.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
#include "mlir/Dialect/Affine/IR/AffineOps.h"
44
#include "mlir/Dialect/SCF/IR/SCF.h"
5-
#include "mlir/IR/BlockAndValueMapping.h"
5+
#include "mlir/IR/IRMapping.h"
66
#include "mlir/IR/IntegerSet.h"
77

8-
static inline mlir::scf::IfOp
9-
cloneWithoutResults(mlir::scf::IfOp op, mlir::OpBuilder &rewriter,
10-
mlir::BlockAndValueMapping mapping = {},
11-
mlir::TypeRange types = {}) {
8+
static inline mlir::scf::IfOp cloneWithoutResults(mlir::scf::IfOp op,
9+
mlir::OpBuilder &rewriter,
10+
mlir::IRMapping mapping = {},
11+
mlir::TypeRange types = {}) {
1212
using namespace mlir;
1313
return rewriter.create<scf::IfOp>(
1414
op.getLoc(), types, mapping.lookupOrDefault(op.getCondition()), true);
1515
}
16-
static inline mlir::AffineIfOp
17-
cloneWithoutResults(mlir::AffineIfOp op, mlir::OpBuilder &rewriter,
18-
mlir::BlockAndValueMapping mapping = {},
19-
mlir::TypeRange types = {}) {
16+
static inline mlir::AffineIfOp cloneWithoutResults(mlir::AffineIfOp op,
17+
mlir::OpBuilder &rewriter,
18+
mlir::IRMapping mapping = {},
19+
mlir::TypeRange types = {}) {
2020
using namespace mlir;
2121
SmallVector<mlir::Value> lower;
2222
for (auto o : op.getOperands())
@@ -27,7 +27,7 @@ cloneWithoutResults(mlir::AffineIfOp op, mlir::OpBuilder &rewriter,
2727

2828
static inline mlir::scf::ForOp
2929
cloneWithoutResults(mlir::scf::ForOp op, mlir::PatternRewriter &rewriter,
30-
mlir::BlockAndValueMapping mapping = {}) {
30+
mlir::IRMapping mapping = {}) {
3131
using namespace mlir;
3232
return rewriter.create<scf::ForOp>(
3333
op.getLoc(), mapping.lookupOrDefault(op.getLowerBound()),
@@ -36,7 +36,7 @@ cloneWithoutResults(mlir::scf::ForOp op, mlir::PatternRewriter &rewriter,
3636
}
3737
static inline mlir::AffineForOp
3838
cloneWithoutResults(mlir::AffineForOp op, mlir::PatternRewriter &rewriter,
39-
mlir::BlockAndValueMapping mapping = {}) {
39+
mlir::IRMapping mapping = {}) {
4040
using namespace mlir;
4141
SmallVector<Value> lower;
4242
for (auto o : op.getLowerBoundOperands())

polygeist/lib/polygeist/Dialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct PolygeistInlinerInterface : public DialectInlinerInterface {
3030

3131
// Operations in the Polygeist dialect are legal to inline.
3232
bool isLegalToInline(Operation *Op, Region *Dest, bool WouldBeCloned,
33-
BlockAndValueMapping &ValueMapping) const final {
33+
IRMapping &ValueMapping) const final {
3434
return true;
3535
}
3636
};

polygeist/lib/polygeist/Ops.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "mlir/Dialect/MemRef/IR/MemRef.h"
2828
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
2929
#include "mlir/Dialect/SCF/IR/SCF.h"
30-
#include "mlir/IR/BlockAndValueMapping.h"
30+
#include "mlir/IR/IRMapping.h"
3131

3232
using namespace mlir;
3333
using namespace polygeist;
@@ -1734,7 +1734,7 @@ struct IfAndLazy : public OpRewritePattern<scf::IfOp> {
17341734

17351735
{
17361736
SmallVector<Value> elseVals = otherYield.getOperands();
1737-
BlockAndValueMapping elseMapping;
1737+
IRMapping elseMapping;
17381738
elseMapping.map(prevIf.getResults(), otherYield.getOperands());
17391739
SmallVector<Value> nextElseVals;
17401740
for (auto v : nextIf.elseYield().getOperands())
@@ -2278,7 +2278,7 @@ struct AlwaysAllocaScopeHoister : public OpRewritePattern<T> {
22782278
if (toHoist.empty())
22792279
return failure();
22802280
rewriter.setInsertionPoint(lastParentWithoutScope);
2281-
BlockAndValueMapping map;
2281+
IRMapping map;
22822282
for (auto *op : toHoist) {
22832283
auto *cloned = rewriter.clone(*op, map);
22842284
rewriter.replaceOp(op, cloned->getResults());

polygeist/lib/polygeist/Passes/AffineCFG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include "mlir/Dialect/Affine/Passes.h"
55
#include "mlir/Dialect/MemRef/IR/MemRef.h"
66
#include "mlir/Dialect/SCF/IR/SCF.h"
7-
#include "mlir/IR/BlockAndValueMapping.h"
87
#include "mlir/IR/Dominance.h"
98
#include "mlir/IR/FunctionInterfaces.h"
9+
#include "mlir/IR/IRMapping.h"
1010
#include "mlir/IR/IntegerSet.h"
1111
#include "mlir/IR/Matchers.h"
1212
#include "mlir/IR/PatternMatch.h"
@@ -540,7 +540,7 @@ bool need(IntegerSet *map, SmallVectorImpl<Value> *operands) {
540540
void fully2ComposeAffineMapAndOperands(PatternRewriter &builder, AffineMap *map,
541541
SmallVectorImpl<Value> *operands,
542542
DominanceInfo &DI) {
543-
BlockAndValueMapping indexMap;
543+
IRMapping indexMap;
544544
for (auto op : *operands) {
545545
SmallVector<IndexCastOp> attempt;
546546
auto idx0 = op.getDefiningOp<IndexCastOp>();
@@ -593,7 +593,7 @@ void fully2ComposeIntegerSetAndOperands(PatternRewriter &builder,
593593
IntegerSet *set,
594594
SmallVectorImpl<Value> *operands,
595595
DominanceInfo &DI) {
596-
BlockAndValueMapping indexMap;
596+
IRMapping indexMap;
597597
for (auto op : *operands) {
598598
SmallVector<IndexCastOp> attempt;
599599
auto idx0 = op.getDefiningOp<IndexCastOp>();

polygeist/lib/polygeist/Passes/BarrierRemovalContinuation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include "mlir/Dialect/MemRef/IR/MemRef.h"
2121
#include "mlir/Dialect/SCF/IR/SCF.h"
2222
#include "mlir/Dialect/SCF/Transforms/Passes.h"
23-
#include "mlir/IR/BlockAndValueMapping.h"
2423
#include "mlir/IR/BuiltinOps.h"
2524
#include "mlir/IR/Dominance.h"
25+
#include "mlir/IR/IRMapping.h"
2626
#include "mlir/IR/ImplicitLocOpBuilder.h"
2727
#include "mlir/IR/PatternMatch.h"
2828
#include "mlir/Pass/Pass.h"
@@ -197,8 +197,8 @@ replicateIntoRegion(Region &region, Value storage, ValueRange ivs,
197197
ValueRange lowerBounds,
198198
const llvm::SetVector<Block *> &blocks,
199199
const llvm::SetVector<Block *> &subgraphEntryPoints,
200-
const BlockAndValueMapping &ivMapping, OpBuilder &builder) {
201-
BlockAndValueMapping mapping(ivMapping);
200+
const IRMapping &ivMapping, OpBuilder &builder) {
201+
IRMapping mapping(ivMapping);
202202

203203
// Create a separate entry block because the subset of blocks might have
204204
// branches to its first block, which would not be possible for the region
@@ -287,7 +287,7 @@ emitContinuationCase(Value condition, Value storage, scf::ParallelOp parallel,
287287
ImplicitLocOpBuilder bn(loc, nested);
288288
auto executeRegion =
289289
bn.create<scf::ExecuteRegionOp>(TypeRange(), ValueRange());
290-
BlockAndValueMapping mapping;
290+
IRMapping mapping;
291291
mapping.map(parallel.getInductionVars(), ivs);
292292
replicateIntoRegion(executeRegion.getRegion(), storage, ivs,
293293
parallel.getLowerBound(), blocks, subgraphEntryPoints,

polygeist/lib/polygeist/Passes/CanonicalizeFor.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "mlir/Dialect/Func/IR/FuncOps.h"
44
#include "mlir/Dialect/SCF/IR/SCF.h"
55
#include "mlir/Dialect/SCF/Transforms/Passes.h"
6-
#include "mlir/IR/BlockAndValueMapping.h"
76
#include "mlir/IR/Dominance.h"
7+
#include "mlir/IR/IRMapping.h"
88
#include "mlir/IR/Matchers.h"
99
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
1010
#include "polygeist/Passes/Passes.h"
@@ -177,7 +177,7 @@ struct ForOpInductionReplacement : public OpRewritePattern<scf::ForOp> {
177177
};
178178

179179
/// Remove unused iterator operands.
180-
// TODO: BlockAndValueMapping for indvar.
180+
// TODO: IRMapping for indvar.
181181
struct RemoveUnusedArgs : public OpRewritePattern<ForOp> {
182182
using OpRewritePattern<ForOp>::OpRewritePattern;
183183

@@ -698,7 +698,7 @@ struct MoveWhileToFor : public OpRewritePattern<WhileOp> {
698698
for (auto oldYieldArg : oldYield.getResults())
699699
yieldOperands.push_back(oldYieldArg);
700700

701-
BlockAndValueMapping outmap;
701+
IRMapping outmap;
702702
outmap.map(loop.getBefore().getArguments(), yieldOperands);
703703
for (auto arg : condOp.getArgs())
704704
yieldOperands.push_back(outmap.lookupOrDefault(arg));
@@ -762,7 +762,7 @@ struct MoveWhileAndDown : public OpRewritePattern<WhileOp> {
762762
SmallVector<BlockArgument, 2> origAfterArgs(
763763
loop.getAfterArguments().begin(), loop.getAfterArguments().end());
764764

765-
BlockAndValueMapping preMap;
765+
IRMapping preMap;
766766
for (auto tup : llvm::zip(origBeforeArgs, loop.getInits()))
767767
preMap.map(std::get<0>(tup), std::get<1>(tup));
768768
for (auto &op : loop.getBefore().front()) {
@@ -813,7 +813,7 @@ struct MoveWhileAndDown : public OpRewritePattern<WhileOp> {
813813
newBeforeYieldArgs.push_back(trueInd);
814814

815815
{
816-
BlockAndValueMapping postMap;
816+
IRMapping postMap;
817817
postMap.map(helper.indVar, trueInd);
818818
auto newCmp = cast<CmpIOp>(rewriter.clone(*helper.cmpIOp, postMap));
819819
rewriter.create<ConditionOp>(condOp.getLoc(), newCmp,
@@ -845,7 +845,7 @@ struct MoveWhileAndDown : public OpRewritePattern<WhileOp> {
845845
rewriter.mergeBlocks(post, guard.thenBlock());
846846

847847
{
848-
BlockAndValueMapping postMap;
848+
IRMapping postMap;
849849
for (auto tup : llvm::zip(origBeforeArgs, oldYield.getOperands())) {
850850
postMap.map(std::get<0>(tup), std::get<1>(tup));
851851
}
@@ -870,7 +870,7 @@ struct MoveWhileAndDown : public OpRewritePattern<WhileOp> {
870870

871871
rewriter.setInsertionPointToEnd(&nop.getAfter().front());
872872
SmallVector<Value> postAfter(guard.getResults());
873-
BlockAndValueMapping postMap;
873+
IRMapping postMap;
874874
postMap.map(helper.indVar, trueInd);
875875
postMap.map(postElseYields[helper.afterArgIdx], trueInd);
876876
assert(helper.addIOp.getLhs() == postElseYields[helper.afterArgIdx] ||

polygeist/lib/polygeist/Passes/ConvertPolygeistToLLVM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
3737
#include "mlir/Dialect/SCF/IR/SCF.h"
3838
#include "mlir/Dialect/SYCL/IR/SYCLOpsTypes.h"
39-
#include "mlir/IR/BlockAndValueMapping.h"
39+
#include "mlir/IR/IRMapping.h"
4040
#include "mlir/IR/ImplicitLocOpBuilder.h"
4141
#include "mlir/IR/SymbolTable.h"
4242
#include "mlir/Transforms/RegionUtils.h"
@@ -949,7 +949,7 @@ struct AsyncOpLowering : public ConvertOpToLLVMPattern<async::ExecuteOp> {
949949
funcType);
950950

951951
rewriter.setInsertionPointToStart(func.addEntryBlock());
952-
BlockAndValueMapping valueMapping;
952+
IRMapping valueMapping;
953953
for (Value capture : toErase) {
954954
Operation *op = capture.getDefiningOp();
955955
for (auto r :

polygeist/lib/polygeist/Passes/InnerSerialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
66
#include "mlir/Dialect/SCF/IR/SCF.h"
77
#include "mlir/Dialect/SCF/Transforms/Passes.h"
8-
#include "mlir/IR/BlockAndValueMapping.h"
98
#include "mlir/IR/Dominance.h"
9+
#include "mlir/IR/IRMapping.h"
1010
#include "mlir/IR/Matchers.h"
1111
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
1212
#include "polygeist/Passes/Passes.h"

polygeist/lib/polygeist/Passes/LICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "mlir/Dialect/Arith/IR/Arith.h"
1313
#include "mlir/Dialect/Func/IR/FuncOps.h"
1414
#include "mlir/Dialect/MemRef/IR/MemRef.h"
15-
#include "mlir/IR/BlockAndValueMapping.h"
1615
#include "mlir/IR/Dominance.h"
16+
#include "mlir/IR/IRMapping.h"
1717
#include "mlir/IR/IntegerSet.h"
1818
#include "mlir/IR/Matchers.h"
1919
#include "mlir/IR/Verifier.h"

polygeist/lib/polygeist/Passes/OpenMPOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
1414
#include "mlir/Dialect/SCF/IR/SCF.h"
1515
#include "mlir/Dialect/SCF/Transforms/Passes.h"
16-
#include "mlir/IR/BlockAndValueMapping.h"
1716
#include "mlir/IR/Dominance.h"
17+
#include "mlir/IR/IRMapping.h"
1818
#include "mlir/IR/Matchers.h"
1919
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
2020
#include "polygeist/Ops.h"

polygeist/lib/polygeist/Passes/ParallelLoopDistribute.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
1515
#include "mlir/Dialect/SCF/IR/SCF.h"
1616
#include "mlir/Dialect/SCF/Transforms/Passes.h"
17-
#include "mlir/IR/BlockAndValueMapping.h"
1817
#include "mlir/IR/Dominance.h"
18+
#include "mlir/IR/IRMapping.h"
1919
#include "mlir/IR/ImplicitLocOpBuilder.h"
2020
#include "mlir/IR/IntegerSet.h"
2121
#include "mlir/IR/Matchers.h"
@@ -698,7 +698,7 @@ static LogicalResult distributeAroundBarrier(T op, BarrierOp barrier,
698698
<< "usedBelow: " << usedBelow.size() << ", "
699699
<< "crossingCache: " << crossingCache.size() << "\n");
700700

701-
BlockAndValueMapping mapping;
701+
IRMapping mapping;
702702
for (auto v : crossingCache)
703703
mapping.map(v, v);
704704

@@ -922,7 +922,7 @@ static LogicalResult distributeAroundBarrier(T op, BarrierOp barrier,
922922

923923
// Recreate the operations in the new loop with new values.
924924
rewriter.setInsertionPointToStart(postLoop.getBody());
925-
BlockAndValueMapping mapping;
925+
IRMapping mapping;
926926
mapping.map(preLoop.getBody()->getArguments(),
927927
postLoop.getBody()->getArguments());
928928
SmallVector<Operation *> toDelete;
@@ -1175,7 +1175,7 @@ template <typename T, typename T2>
11751175
static void insertRecomputables(PatternRewriter &rewriter, T oldParallel,
11761176
T newParallel, T2 until) {
11771177
rewriter.setInsertionPointToStart(newParallel.getBody());
1178-
BlockAndValueMapping mapping;
1178+
IRMapping mapping;
11791179
mapping.map(oldParallel.getBody()->getArguments(),
11801180
newParallel.getBody()->getArguments());
11811181
rewriter.setInsertionPointToStart(newParallel.getBody());
@@ -1282,7 +1282,7 @@ static void moveBodiesFor(PatternRewriter &rewriter, T op, ForType forLoop,
12821282

12831283
// Keep recomputable values in the parallel op (explicitly excluding loads
12841284
// that provide for bounds as those are handles in the caller)
1285-
BlockAndValueMapping mapping;
1285+
IRMapping mapping;
12861286
mapping.map(op.getBody()->getArguments(),
12871287
newParallel.getBody()->getArguments());
12881288
rewriter.setInsertionPointToEnd(newParallel.getBody());
@@ -1389,7 +1389,7 @@ struct InterchangeForIfPFor : public OpRewritePattern<ParallelOpType> {
13891389

13901390
// Replicate the recomputable ops in case the condition or bound of lastOp
13911391
// is getting "recomputed"
1392-
BlockAndValueMapping mapping;
1392+
IRMapping mapping;
13931393
rewriter.setInsertionPoint(op);
13941394
mapping.map(op.getBody()->getArguments(), getLowerBounds(op, rewriter));
13951395
rewriter.setInsertionPoint(op);
@@ -1823,7 +1823,7 @@ struct Reg2MemIf : public OpRewritePattern<T> {
18231823
assert(storeOp);
18241824
if (equivThenStores.count(storeOp))
18251825
continue;
1826-
BlockAndValueMapping map;
1826+
IRMapping map;
18271827
SetVector<Operation *> seen;
18281828
SmallVector<Value> todo = {storeOp.getMemref()};
18291829
for (auto ind : storeOp.getIndices())
@@ -1882,7 +1882,7 @@ struct Reg2MemIf : public OpRewritePattern<T> {
18821882
rewriter.eraseOp(storeOp);
18831883
continue;
18841884
}
1885-
BlockAndValueMapping map;
1885+
IRMapping map;
18861886
SetVector<Operation *> seen;
18871887
SmallVector<Value> todo = {storeOp.getMemref()};
18881888
for (auto ind : storeOp.getIndices())

polygeist/lib/polygeist/Passes/ParallelLower.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,12 @@ struct AlwaysInlinerInterface : public InlinerInterface {
106106
}
107107

108108
/// All operations within standard ops can be inlined.
109-
bool isLegalToInline(Region *, Region *, bool,
110-
BlockAndValueMapping &) const final {
109+
bool isLegalToInline(Region *, Region *, bool, IRMapping &) const final {
111110
return true;
112111
}
113112

114113
/// All operations within standard ops can be inlined.
115-
bool isLegalToInline(Operation *, Region *, bool,
116-
BlockAndValueMapping &) const final {
114+
bool isLegalToInline(Operation *, Region *, bool, IRMapping &) const final {
117115
return true;
118116
}
119117

polygeist/lib/polygeist/Passes/RaiseToAffine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
77
#include "mlir/Dialect/SCF/IR/SCF.h"
88
#include "mlir/Dialect/SCF/Transforms/Passes.h"
9-
#include "mlir/IR/BlockAndValueMapping.h"
109
#include "mlir/IR/Dominance.h"
10+
#include "mlir/IR/IRMapping.h"
1111
#include "mlir/Transforms/DialectConversion.h"
1212
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
1313
#include "polygeist/Passes/Passes.h"

0 commit comments

Comments
 (0)