7 changes: 5 additions & 2 deletions mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
#include <optional>

namespace mlir {
namespace affine {
#define GEN_PASS_DEF_AFFINELOOPUNROLL
#include "mlir/Dialect/Affine/Passes.h.inc"
} // namespace affine
} // namespace mlir

#define DEBUG_TYPE "affine-loop-unroll"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand All @@ -42,7 +45,7 @@ namespace {
/// full unroll threshold was specified, in which case, fully unrolls all loops
/// with trip count less than the specified threshold. The latter is for testing
/// purposes, especially for testing outer loop unrolling.
struct LoopUnroll : public impl::AffineLoopUnrollBase<LoopUnroll> {
struct LoopUnroll : public affine::impl::AffineLoopUnrollBase<LoopUnroll> {
// Callback to obtain unroll factors; if this has a callable target, takes
// precedence over command-line argument or passed argument.
const std::function<unsigned(AffineForOp)> getUnrollFactor;
Expand Down Expand Up @@ -142,7 +145,7 @@ LogicalResult LoopUnroll::runOnAffineForOp(AffineForOp forOp) {
cleanUpUnroll);
}

std::unique_ptr<OperationPass<func::FuncOp>> mlir::createLoopUnrollPass(
std::unique_ptr<OperationPass<func::FuncOp>> mlir::affine::createLoopUnrollPass(
int unrollFactor, bool unrollUpToFactor, bool unrollFull,
const std::function<unsigned(AffineForOp)> &getUnrollFactor) {
return std::make_unique<LoopUnroll>(
Expand Down
7 changes: 5 additions & 2 deletions mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,22 @@
#include <optional>

namespace mlir {
namespace affine {
#define GEN_PASS_DEF_AFFINELOOPUNROLLANDJAM
#include "mlir/Dialect/Affine/Passes.h.inc"
} // namespace affine
} // namespace mlir

#define DEBUG_TYPE "affine-loop-unroll-jam"

using namespace mlir;
using namespace mlir::affine;

namespace {
/// Loop unroll jam pass. Currently, this just unroll jams the first
/// outer loop in a Function.
struct LoopUnrollAndJam
: public impl::AffineLoopUnrollAndJamBase<LoopUnrollAndJam> {
: public affine::impl::AffineLoopUnrollAndJamBase<LoopUnrollAndJam> {
explicit LoopUnrollAndJam(
std::optional<unsigned> unrollJamFactor = std::nullopt) {
if (unrollJamFactor)
Expand All @@ -73,7 +76,7 @@ struct LoopUnrollAndJam
} // namespace

std::unique_ptr<OperationPass<func::FuncOp>>
mlir::createLoopUnrollAndJamPass(int unrollJamFactor) {
mlir::affine::createLoopUnrollAndJamPass(int unrollJamFactor) {
return std::make_unique<LoopUnrollAndJam>(
unrollJamFactor == -1 ? std::nullopt
: std::optional<unsigned>(unrollJamFactor));
Expand Down
10 changes: 7 additions & 3 deletions mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@
#include "llvm/Support/Debug.h"

namespace mlir {
namespace affine {
#define GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFER
#include "mlir/Dialect/Affine/Passes.h.inc"
} // namespace affine
} // namespace mlir

#define DEBUG_TYPE "affine-pipeline-data-transfer"

using namespace mlir;
using namespace mlir::affine;

namespace {
struct PipelineDataTransfer
: public impl::AffinePipelineDataTransferBase<PipelineDataTransfer> {
: public affine::impl::AffinePipelineDataTransferBase<
PipelineDataTransfer> {
void runOnOperation() override;
void runOnAffineForOp(AffineForOp forOp);

Expand All @@ -49,7 +53,7 @@ struct PipelineDataTransfer
/// Creates a pass to pipeline explicit movement of data across levels of the
/// memory hierarchy.
std::unique_ptr<OperationPass<func::FuncOp>>
mlir::createPipelineDataTransferPass() {
mlir::affine::createPipelineDataTransferPass() {
return std::make_unique<PipelineDataTransfer>();
}

Expand Down Expand Up @@ -328,7 +332,7 @@ void PipelineDataTransfer::runOnAffineForOp(AffineForOp forOp) {
instShiftMap[dmaStartOp] = 0;
// Set shifts for DMA start op's affine operand computation slices to 0.
SmallVector<AffineApplyOp, 4> sliceOps;
mlir::createAffineComputationSlice(dmaStartOp, &sliceOps);
affine::createAffineComputationSlice(dmaStartOp, &sliceOps);
if (!sliceOps.empty()) {
for (auto sliceOp : sliceOps) {
instShiftMap[sliceOp.getOperation()] = 0;
Expand Down
9 changes: 5 additions & 4 deletions mlir/lib/Dialect/Affine/Transforms/ReifyValueBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "mlir/Interfaces/ValueBoundsOpInterface.h"

using namespace mlir;
using namespace mlir::affine;

static FailureOr<OpFoldResult>
reifyValueBound(OpBuilder &b, Location loc, presburger::BoundType type,
Expand Down Expand Up @@ -54,7 +55,7 @@ reifyValueBound(OpBuilder &b, Location loc, presburger::BoundType type,
}

// Simplify and return bound.
mlir::canonicalizeMapAndOperands(&boundMap, &operands);
affine::canonicalizeMapAndOperands(&boundMap, &operands);
// Check for special cases where no affine.apply op is needed.
if (boundMap.isSingleConstant()) {
// Bound is a constant: return an IntegerAttr.
Expand All @@ -69,10 +70,10 @@ reifyValueBound(OpBuilder &b, Location loc, presburger::BoundType type,
operands[expr.getPosition() + boundMap.getNumDims()]);
// General case: build affine.apply op.
return static_cast<OpFoldResult>(
b.create<AffineApplyOp>(loc, boundMap, operands).getResult());
b.create<affine::AffineApplyOp>(loc, boundMap, operands).getResult());
}

FailureOr<OpFoldResult> mlir::reifyShapedValueDimBound(
FailureOr<OpFoldResult> mlir::affine::reifyShapedValueDimBound(
OpBuilder &b, Location loc, presburger::BoundType type, Value value,
int64_t dim, ValueBoundsConstraintSet::StopConditionFn stopCondition,
bool closedUB) {
Expand All @@ -89,7 +90,7 @@ FailureOr<OpFoldResult> mlir::reifyShapedValueDimBound(
closedUB);
}

FailureOr<OpFoldResult> mlir::reifyIndexValueBound(
FailureOr<OpFoldResult> mlir::affine::reifyIndexValueBound(
OpBuilder &b, Location loc, presburger::BoundType type, Value value,
ValueBoundsConstraintSet::StopConditionFn stopCondition, bool closedUB) {
auto reifyToOperands = [&](Value v, std::optional<int64_t> d) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

namespace mlir {
namespace affine {
#define GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURES
#include "mlir/Dialect/Affine/Passes.h.inc"
} // namespace affine
} // namespace mlir

#define DEBUG_TYPE "simplify-affine-structure"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand All @@ -35,7 +38,8 @@ namespace {
/// all memrefs with non-trivial layout maps are converted to ones with trivial
/// identity layout ones.
struct SimplifyAffineStructures
: public impl::SimplifyAffineStructuresBase<SimplifyAffineStructures> {
: public affine::impl::SimplifyAffineStructuresBase<
SimplifyAffineStructures> {
void runOnOperation() override;

/// Utility to simplify an affine attribute and update its entry in the parent
Expand Down Expand Up @@ -78,7 +82,7 @@ struct SimplifyAffineStructures
} // namespace

std::unique_ptr<OperationPass<func::FuncOp>>
mlir::createSimplifyAffineStructuresPass() {
mlir::affine::createSimplifyAffineStructuresPass() {
return std::make_unique<SimplifyAffineStructures>();
}

Expand Down
26 changes: 13 additions & 13 deletions mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
#include <optional>

namespace mlir {
namespace affine {
#define GEN_PASS_DEF_AFFINEVECTORIZE
#include "mlir/Dialect/Affine/Passes.h.inc"
} // namespace affine
} // namespace mlir

using namespace mlir;
using namespace affine;
using namespace vector;

///
Expand Down Expand Up @@ -585,7 +588,7 @@ isVectorizableLoopPtrFactory(const DenseSet<Operation *> &parallelLoops,
static std::optional<NestedPattern>
makePattern(const DenseSet<Operation *> &parallelLoops, int vectorRank,
ArrayRef<int64_t> fastestVaryingPattern) {
using matcher::For;
using affine::matcher::For;
int64_t d0 = fastestVaryingPattern.empty() ? -1 : fastestVaryingPattern[0];
int64_t d1 = fastestVaryingPattern.size() < 2 ? -1 : fastestVaryingPattern[1];
int64_t d2 = fastestVaryingPattern.size() < 3 ? -1 : fastestVaryingPattern[2];
Expand All @@ -606,7 +609,7 @@ makePattern(const DenseSet<Operation *> &parallelLoops, int vectorRank,
}

static NestedPattern &vectorTransferPattern() {
static auto pattern = matcher::Op([](Operation &op) {
static auto pattern = affine::matcher::Op([](Operation &op) {
return isa<vector::TransferReadOp, vector::TransferWriteOp>(op);
});
return pattern;
Expand All @@ -616,7 +619,7 @@ namespace {

/// Base state for the vectorize pass.
/// Command line arguments are preempted by non-empty pass arguments.
struct Vectorize : public impl::AffineVectorizeBase<Vectorize> {
struct Vectorize : public affine::impl::AffineVectorizeBase<Vectorize> {
using Base::Base;

void runOnOperation() override;
Expand Down Expand Up @@ -1796,7 +1799,6 @@ verifyLoopNesting(const std::vector<SmallVector<AffineForOp, 2>> &loops) {
return success();
}

namespace mlir {

/// External utility to vectorize affine loops in 'loops' using the n-D
/// vectorization factors in 'vectorSizes'. By default, each vectorization
Expand All @@ -1806,10 +1808,10 @@ namespace mlir {
/// If `reductionLoops` is not empty, the given reduction loops may be
/// vectorized along the reduction dimension.
/// TODO: Vectorizing reductions is supported only for 1-D vectorization.
void vectorizeAffineLoops(Operation *parentOp, DenseSet<Operation *> &loops,
ArrayRef<int64_t> vectorSizes,
ArrayRef<int64_t> fastestVaryingPattern,
const ReductionLoopMap &reductionLoops) {
void mlir::affine::vectorizeAffineLoops(
Operation *parentOp, DenseSet<Operation *> &loops,
ArrayRef<int64_t> vectorSizes, ArrayRef<int64_t> fastestVaryingPattern,
const ReductionLoopMap &reductionLoops) {
// Thread-safe RAII local context, BumpPtrAllocator freed on exit.
NestedPatternContext mlContext;
vectorizeLoops(parentOp, loops, vectorSizes, fastestVaryingPattern,
Expand Down Expand Up @@ -1851,14 +1853,12 @@ void vectorizeAffineLoops(Operation *parentOp, DenseSet<Operation *> &loops,
/// loops = {{%i2}}, to vectorize only the first innermost loop;
/// loops = {{%i3}}, to vectorize only the second innermost loop;
/// loops = {{%i1}}, to vectorize only the middle loop.
LogicalResult
vectorizeAffineLoopNest(std::vector<SmallVector<AffineForOp, 2>> &loops,
const VectorizationStrategy &strategy) {
LogicalResult mlir::affine::vectorizeAffineLoopNest(
std::vector<SmallVector<AffineForOp, 2>> &loops,
const VectorizationStrategy &strategy) {
// Thread-safe RAII local context, BumpPtrAllocator freed on exit.
NestedPatternContext mlContext;
if (failed(verifyLoopNesting(loops)))
return failure();
return vectorizeLoopNest(loops, strategy);
}

} // namespace mlir
45 changes: 25 additions & 20 deletions mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define DEBUG_TYPE "loop-fusion-utils"

using namespace mlir;
using namespace mlir::affine;

// Gathers all load and store memref accesses in 'opA' into 'values', where
// 'values[memref] == true' for each store operation.
Expand Down Expand Up @@ -245,10 +246,11 @@ static unsigned getMaxLoopDepth(ArrayRef<Operation *> srcOps,
// TODO: This pass performs some computation that is the same for all the depths
// (e.g., getMaxLoopDepth). Implement a version of this utility that processes
// all the depths at once or only the legal maximal depth for maximal fusion.
FusionResult mlir::canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
unsigned dstLoopDepth,
ComputationSliceState *srcSlice,
FusionStrategy fusionStrategy) {
FusionResult mlir::affine::canFuseLoops(AffineForOp srcForOp,
AffineForOp dstForOp,
unsigned dstLoopDepth,
ComputationSliceState *srcSlice,
FusionStrategy fusionStrategy) {
// Return 'failure' if 'dstLoopDepth == 0'.
if (dstLoopDepth == 0) {
LLVM_DEBUG(llvm::dbgs() << "Cannot fuse loop nests at depth 0\n");
Expand Down Expand Up @@ -303,7 +305,7 @@ FusionResult mlir::canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,

// Calculate the number of common loops surrounding 'srcForOp' and 'dstForOp'.
unsigned numCommonLoops =
mlir::getNumCommonSurroundingLoops(*srcForOp, *dstForOp);
affine::getNumCommonSurroundingLoops(*srcForOp, *dstForOp);

// Filter out ops in 'opsA' to compute the slice union based on the
// assumptions made by the fusion strategy.
Expand Down Expand Up @@ -335,9 +337,9 @@ FusionResult mlir::canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,

// Compute union of computation slices computed between all pairs of ops
// from 'forOpA' and 'forOpB'.
SliceComputationResult sliceComputationResult =
mlir::computeSliceUnion(strategyOpsA, opsB, dstLoopDepth, numCommonLoops,
isSrcForOpBeforeDstForOp, srcSlice);
SliceComputationResult sliceComputationResult = affine::computeSliceUnion(
strategyOpsA, opsB, dstLoopDepth, numCommonLoops,
isSrcForOpBeforeDstForOp, srcSlice);
if (sliceComputationResult.value == SliceComputationResult::GenericFailure) {
LLVM_DEBUG(llvm::dbgs() << "computeSliceUnion failed\n");
return FusionResult::FailPrecondition;
Expand All @@ -353,8 +355,8 @@ FusionResult mlir::canFuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,

/// Patch the loop body of a forOp that is a single iteration reduction loop
/// into its containing block.
LogicalResult promoteSingleIterReductionLoop(AffineForOp forOp,
bool siblingFusionUser) {
static LogicalResult promoteSingleIterReductionLoop(AffineForOp forOp,
bool siblingFusionUser) {
// Check if the reduction loop is a single iteration loop.
std::optional<uint64_t> tripCount = getConstantTripCount(forOp);
if (!tripCount || *tripCount != 1)
Expand Down Expand Up @@ -416,9 +418,9 @@ LogicalResult promoteSingleIterReductionLoop(AffineForOp forOp,

/// Fuses 'srcForOp' into 'dstForOp' with destination loop block insertion point
/// and source slice loop bounds specified in 'srcSlice'.
void mlir::fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
const ComputationSliceState &srcSlice,
bool isInnermostSiblingInsertion) {
void mlir::affine::fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
const ComputationSliceState &srcSlice,
bool isInnermostSiblingInsertion) {
// Clone 'srcForOp' into 'dstForOp' at 'srcSlice->insertPoint'.
OpBuilder b(srcSlice.insertPoint->getBlock(), srcSlice.insertPoint);
IRMapping mapper;
Expand Down Expand Up @@ -465,7 +467,8 @@ void mlir::fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp,
/// Collect loop nest statistics (eg. loop trip count and operation count)
/// in 'stats' for loop nest rooted at 'forOp'. Returns true on success,
/// returns false otherwise.
bool mlir::getLoopNestStats(AffineForOp forOpRoot, LoopNestStats *stats) {
bool mlir::affine::getLoopNestStats(AffineForOp forOpRoot,
LoopNestStats *stats) {
auto walkResult = forOpRoot.walk([&](AffineForOp forOp) {
auto *childForOp = forOp.getOperation();
auto *parentForOp = forOp->getParentOp();
Expand Down Expand Up @@ -553,7 +556,7 @@ static int64_t getComputeCostHelper(
/// Currently, the total cost is computed by counting the total operation
/// instance count (i.e. total number of operations in the loop body * loop
/// trip count) for the entire loop nest.
int64_t mlir::getComputeCost(AffineForOp forOp, LoopNestStats &stats) {
int64_t mlir::affine::getComputeCost(AffineForOp forOp, LoopNestStats &stats) {
return getComputeCostHelper(forOp, stats,
/*tripCountOverrideMap=*/nullptr,
/*computeCostMap=*/nullptr);
Expand All @@ -564,10 +567,12 @@ int64_t mlir::getComputeCost(AffineForOp forOp, LoopNestStats &stats) {
/// the total cost is computed by counting the total operation instance count
/// (i.e. total number of operations in the loop body * loop trip count) for
/// the entire loop nest.
bool mlir::getFusionComputeCost(AffineForOp srcForOp, LoopNestStats &srcStats,
AffineForOp dstForOp, LoopNestStats &dstStats,
const ComputationSliceState &slice,
int64_t *computeCost) {
bool mlir::affine::getFusionComputeCost(AffineForOp srcForOp,
LoopNestStats &srcStats,
AffineForOp dstForOp,
LoopNestStats &dstStats,
const ComputationSliceState &slice,
int64_t *computeCost) {
llvm::SmallDenseMap<Operation *, uint64_t, 8> sliceTripCountMap;
DenseMap<Operation *, int64_t> computeCostMap;

Expand Down Expand Up @@ -634,7 +639,7 @@ bool mlir::getFusionComputeCost(AffineForOp srcForOp, LoopNestStats &srcStats,
/// Returns in 'producerConsumerMemrefs' the memrefs involved in a
/// producer-consumer dependence between write ops in 'srcOps' and read ops in
/// 'dstOps'.
void mlir::gatherProducerConsumerMemrefs(
void mlir::affine::gatherProducerConsumerMemrefs(
ArrayRef<Operation *> srcOps, ArrayRef<Operation *> dstOps,
DenseSet<Value> &producerConsumerMemrefs) {
// Gather memrefs from stores in 'srcOps'.
Expand Down
123 changes: 62 additions & 61 deletions mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp

Large diffs are not rendered by default.

83 changes: 44 additions & 39 deletions mlir/lib/Dialect/Affine/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define DEBUG_TYPE "affine-utils"

using namespace mlir;
using namespace affine;
using namespace presburger;

namespace {
Expand Down Expand Up @@ -209,17 +210,18 @@ class AffineApplyExpander

/// Create a sequence of operations that implement the `expr` applied to the
/// given dimension and symbol values.
mlir::Value mlir::expandAffineExpr(OpBuilder &builder, Location loc,
AffineExpr expr, ValueRange dimValues,
ValueRange symbolValues) {
mlir::Value mlir::affine::expandAffineExpr(OpBuilder &builder, Location loc,
AffineExpr expr,
ValueRange dimValues,
ValueRange symbolValues) {
return AffineApplyExpander(builder, dimValues, symbolValues, loc).visit(expr);
}

/// Create a sequence of operations that implement the `affineMap` applied to
/// the given `operands` (as it it were an AffineApplyOp).
std::optional<SmallVector<Value, 8>>
mlir::expandAffineMap(OpBuilder &builder, Location loc, AffineMap affineMap,
ValueRange operands) {
mlir::affine::expandAffineMap(OpBuilder &builder, Location loc,
AffineMap affineMap, ValueRange operands) {
auto numDims = affineMap.getNumDims();
auto expanded = llvm::to_vector<8>(
llvm::map_range(affineMap.getResults(),
Expand Down Expand Up @@ -341,8 +343,8 @@ static AffineIfOp hoistAffineIfOp(AffineIfOp ifOp, Operation *hoistOverOp) {
}

LogicalResult
mlir::affineParallelize(AffineForOp forOp,
ArrayRef<LoopReduction> parallelReductions) {
mlir::affine::affineParallelize(AffineForOp forOp,
ArrayRef<LoopReduction> parallelReductions) {
// Fail early if there are iter arguments that are not reductions.
unsigned numReductions = parallelReductions.size();
if (numReductions != forOp.getNumIterOperands())
Expand Down Expand Up @@ -400,7 +402,7 @@ mlir::affineParallelize(AffineForOp forOp,
}

// Returns success if any hoisting happened.
LogicalResult mlir::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) {
LogicalResult mlir::affine::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) {
// Bail out early if the ifOp returns a result. TODO: Consider how to
// properly support this case.
if (ifOp.getNumResults() != 0)
Expand Down Expand Up @@ -454,8 +456,9 @@ LogicalResult mlir::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) {
}

// Return the min expr after replacing the given dim.
AffineExpr mlir::substWithMin(AffineExpr e, AffineExpr dim, AffineExpr min,
AffineExpr max, bool positivePath) {
AffineExpr mlir::affine::substWithMin(AffineExpr e, AffineExpr dim,
AffineExpr min, AffineExpr max,
bool positivePath) {
if (e == dim)
return positivePath ? min : max;
if (auto bin = e.dyn_cast<AffineBinaryOpExpr>()) {
Expand All @@ -480,7 +483,7 @@ AffineExpr mlir::substWithMin(AffineExpr e, AffineExpr dim, AffineExpr min,
return e;
}

void mlir::normalizeAffineParallel(AffineParallelOp op) {
void mlir::affine::normalizeAffineParallel(AffineParallelOp op) {
// Loops with min/max in bounds are not normalized at the moment.
if (op.hasMinMaxBounds())
return;
Expand Down Expand Up @@ -544,7 +547,8 @@ void mlir::normalizeAffineParallel(AffineParallelOp op) {
ubExprs, op.getContext());
op.setUpperBounds(ranges.getOperands(), newUpperMap);
}
LogicalResult mlir::normalizeAffineFor(AffineForOp op, bool promoteSingleIter) {
LogicalResult mlir::affine::normalizeAffineFor(AffineForOp op,
bool promoteSingleIter) {
if (promoteSingleIter && succeeded(promoteIfSingleIteration(op)))
return success();

Expand Down Expand Up @@ -701,7 +705,7 @@ static bool mayHaveEffect(Operation *srcMemOp, Operation *destMemOp,
}

template <typename EffectType, typename T>
bool mlir::hasNoInterveningEffect(Operation *start, T memOp) {
bool mlir::affine::hasNoInterveningEffect(Operation *start, T memOp) {
auto isLocallyAllocated = [](Value memref) {
auto *defOp = memref.getDefiningOp();
return defOp && hasSingleEffect<MemoryEffects::Allocate>(defOp, memref);
Expand Down Expand Up @@ -894,7 +898,7 @@ static LogicalResult forwardStoreToLoad(

// 4. Ensure there is no intermediate operation which could replace the
// value in memory.
if (!mlir::hasNoInterveningEffect<MemoryEffects::Write>(storeOp, loadOp))
if (!affine::hasNoInterveningEffect<MemoryEffects::Write>(storeOp, loadOp))
continue;

// We now have a candidate for forwarding.
Expand All @@ -921,9 +925,10 @@ static LogicalResult forwardStoreToLoad(
return success();
}

template bool mlir::hasNoInterveningEffect<mlir::MemoryEffects::Read,
mlir::AffineReadOpInterface>(
mlir::Operation *, mlir::AffineReadOpInterface);
template bool
mlir::affine::hasNoInterveningEffect<mlir::MemoryEffects::Read,
affine::AffineReadOpInterface>(
mlir::Operation *, affine::AffineReadOpInterface);

// This attempts to find stores which have no impact on the final result.
// A writing op writeA will be eliminated if there exists an op writeB if
Expand Down Expand Up @@ -961,7 +966,7 @@ static void findUnusedStore(AffineWriteOpInterface writeA,

// There cannot be an operation which reads from memory between
// the two writes.
if (!mlir::hasNoInterveningEffect<MemoryEffects::Read>(writeA, writeB))
if (!affine::hasNoInterveningEffect<MemoryEffects::Read>(writeA, writeB))
continue;

opsToErase.push_back(writeA);
Expand Down Expand Up @@ -997,7 +1002,7 @@ static void loadCSE(AffineReadOpInterface loadA,
continue;

// 3. There is no write between loadA and loadB.
if (!mlir::hasNoInterveningEffect<MemoryEffects::Write>(
if (!affine::hasNoInterveningEffect<MemoryEffects::Write>(
loadB.getOperation(), loadA))
continue;

Expand Down Expand Up @@ -1055,8 +1060,8 @@ static void loadCSE(AffineReadOpInterface loadA,
// currently only eliminates the stores only if no other loads/uses (other
// than dealloc) remain.
//
void mlir::affineScalarReplace(func::FuncOp f, DominanceInfo &domInfo,
PostDominanceInfo &postDomInfo) {
void mlir::affine::affineScalarReplace(func::FuncOp f, DominanceInfo &domInfo,
PostDominanceInfo &postDomInfo) {
// Load op's whose results were replaced by those forwarded from stores.
SmallVector<Operation *, 8> opsToErase;

Expand Down Expand Up @@ -1109,13 +1114,11 @@ void mlir::affineScalarReplace(func::FuncOp f, DominanceInfo &domInfo,
}

// Perform the replacement in `op`.
LogicalResult mlir::replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef,
Operation *op,
ArrayRef<Value> extraIndices,
AffineMap indexRemap,
ArrayRef<Value> extraOperands,
ArrayRef<Value> symbolOperands,
bool allowNonDereferencingOps) {
LogicalResult mlir::affine::replaceAllMemRefUsesWith(
Value oldMemRef, Value newMemRef, Operation *op,
ArrayRef<Value> extraIndices, AffineMap indexRemap,
ArrayRef<Value> extraOperands, ArrayRef<Value> symbolOperands,
bool allowNonDereferencingOps) {
unsigned newMemRefRank = newMemRef.getType().cast<MemRefType>().getRank();
(void)newMemRefRank; // unused in opt mode
unsigned oldMemRefRank = oldMemRef.getType().cast<MemRefType>().getRank();
Expand Down Expand Up @@ -1285,7 +1288,7 @@ LogicalResult mlir::replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef,
return success();
}

LogicalResult mlir::replaceAllMemRefUsesWith(
LogicalResult mlir::affine::replaceAllMemRefUsesWith(
Value oldMemRef, Value newMemRef, ArrayRef<Value> extraIndices,
AffineMap indexRemap, ArrayRef<Value> extraOperands,
ArrayRef<Value> symbolOperands, Operation *domOpFilter,
Expand Down Expand Up @@ -1401,7 +1404,7 @@ LogicalResult mlir::replaceAllMemRefUsesWith(
/// all the affine.apply op's supplying operands to this opInst did not have any
/// uses besides this opInst; otherwise returns the list of affine.apply
/// operations created in output argument `sliceOps`.
void mlir::createAffineComputationSlice(
void mlir::affine::createAffineComputationSlice(
Operation *opInst, SmallVectorImpl<AffineApplyOp> *sliceOps) {
// Collect all operands that are results of affine apply ops.
SmallVector<Value, 4> subOperands;
Expand Down Expand Up @@ -1709,7 +1712,7 @@ static void createNewDynamicSizes(MemRefType oldMemRefType,
}

// TODO: Currently works for static memrefs with a single layout map.
LogicalResult mlir::normalizeMemRef(memref::AllocOp *allocOp) {
LogicalResult mlir::affine::normalizeMemRef(memref::AllocOp *allocOp) {
MemRefType memrefType = allocOp->getType();
OpBuilder b(*allocOp);

Expand Down Expand Up @@ -1767,8 +1770,8 @@ LogicalResult mlir::normalizeMemRef(memref::AllocOp *allocOp) {
return success();
}

MemRefType mlir::normalizeMemRefType(MemRefType memrefType,
unsigned numSymbolicOperands) {
MemRefType mlir::affine::normalizeMemRefType(MemRefType memrefType,
unsigned numSymbolicOperands) {
unsigned rank = memrefType.getRank();
if (rank == 0)
return memrefType;
Expand Down Expand Up @@ -1848,13 +1851,15 @@ MemRefType mlir::normalizeMemRefType(MemRefType memrefType,
return newMemRefType;
}

DivModValue mlir::getDivMod(OpBuilder &b, Location loc, Value lhs, Value rhs) {
DivModValue mlir::affine::getDivMod(OpBuilder &b, Location loc, Value lhs,
Value rhs) {
DivModValue result;
AffineExpr d0, d1;
bindDims(b.getContext(), d0, d1);
result.quotient =
makeComposedAffineApply(b, loc, d0.floorDiv(d1), {lhs, rhs});
result.remainder = makeComposedAffineApply(b, loc, d0 % d1, {lhs, rhs});
affine::makeComposedAffineApply(b, loc, d0.floorDiv(d1), {lhs, rhs});
result.remainder =
affine::makeComposedAffineApply(b, loc, d0 % d1, {lhs, rhs});
return result;
}

Expand All @@ -1871,9 +1876,9 @@ static FailureOr<OpFoldResult> getIndexProduct(OpBuilder &b, Location loc,
return result;
}

FailureOr<SmallVector<Value>> mlir::delinearizeIndex(OpBuilder &b, Location loc,
Value linearIndex,
ArrayRef<Value> basis) {
FailureOr<SmallVector<Value>>
mlir::affine::delinearizeIndex(OpBuilder &b, Location loc, Value linearIndex,
ArrayRef<Value> basis) {
unsigned numDims = basis.size();

SmallVector<Value> divisors;
Expand Down
9 changes: 5 additions & 4 deletions mlir/lib/Dialect/Affine/Utils/ViewLikeInterfaceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#include "mlir/IR/PatternMatch.h"

using namespace mlir;
using namespace affine;

LogicalResult mlir::mergeOffsetsSizesAndStrides(
LogicalResult mlir::affine::mergeOffsetsSizesAndStrides(
OpBuilder &builder, Location loc, ArrayRef<OpFoldResult> producerOffsets,
ArrayRef<OpFoldResult> producerSizes,
ArrayRef<OpFoldResult> producerStrides,
Expand Down Expand Up @@ -58,7 +59,7 @@ LogicalResult mlir::mergeOffsetsSizesAndStrides(
return success();
}

LogicalResult mlir::mergeOffsetsSizesAndStrides(
LogicalResult mlir::affine::mergeOffsetsSizesAndStrides(
OpBuilder &builder, Location loc, OffsetSizeAndStrideOpInterface producer,
OffsetSizeAndStrideOpInterface consumer,
const llvm::SmallBitVector &droppedProducerDims,
Expand All @@ -77,7 +78,7 @@ LogicalResult mlir::mergeOffsetsSizesAndStrides(
combinedOffsets, combinedSizes, combinedStrides);
}

void mlir::resolveIndicesIntoOpWithOffsetsAndStrides(
void mlir::affine::resolveIndicesIntoOpWithOffsetsAndStrides(
RewriterBase &rewriter, Location loc,
ArrayRef<OpFoldResult> mixedSourceOffsets,
ArrayRef<OpFoldResult> mixedSourceStrides,
Expand Down Expand Up @@ -109,7 +110,7 @@ void mlir::resolveIndicesIntoOpWithOffsetsAndStrides(
}
}

void mlir::resolveSizesIntoOpWithSizes(
void mlir::affine::resolveSizesIntoOpWithSizes(
ArrayRef<OpFoldResult> sourceSizes, ArrayRef<OpFoldResult> destSizes,
const llvm::SmallBitVector &rankReducedSourceDims,
SmallVectorImpl<OpFoldResult> &resolvedSizes) {
Expand Down
10 changes: 6 additions & 4 deletions mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static Value buildLinearThreadId(RewriterBase &rewriter, Location loc,
rewriter.create<ThreadIdOp>(loc, indexType, Dimension::z).getResult()};
threadsAndWorkGroups.push_back(blockDimsOfr[0]);
threadsAndWorkGroups.push_back(blockDimsOfr[1]);
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, loc, tx + ty * BDX + tz * BDX * BDY, threadsAndWorkGroups);
return getValueOrCreateConstantIndexOp(rewriter, loc, ofr);
}
Expand Down Expand Up @@ -137,7 +137,7 @@ struct GpuWarpIdBuilder : public GpuIdBuilder {
// `forallMappingSizes`.
Value linearId = buildLinearThreadId(rewriter, loc, this->blockDimsOfr);
AffineExpr d0 = getAffineDimExpr(0, rewriter.getContext());
OpFoldResult warpIdOfr = makeComposedFoldedAffineApply(
OpFoldResult warpIdOfr = affine::makeComposedFoldedAffineApply(
rewriter, loc, d0.floorDiv(kWarpSize), {linearId});
Value warpId = getValueOrCreateConstantIndexOp(rewriter, loc, warpIdOfr);
// Sizes in [x, y, z] -> [z, y x] order to properly compute strides in
Expand All @@ -149,7 +149,8 @@ struct GpuWarpIdBuilder : public GpuIdBuilder {
SmallVector<Value> ids;
// Reverse back to be in [x, y, z] order.
for (AffineExpr e : llvm::reverse(delinearizingExprs))
ids.push_back(makeComposedAffineApply(rewriter, loc, e, warpId));
ids.push_back(
affine::makeComposedAffineApply(rewriter, loc, e, warpId));

// clang-format off
LDBG("----linearId: " << linearId);
Expand Down Expand Up @@ -204,7 +205,8 @@ struct GpuLinearIdBuilder : public GpuIdBuilder {
SmallVector<Value> ids;
// Reverse back to be in [x, y, z] order.
for (AffineExpr e : llvm::reverse(delinearizingExprs))
ids.push_back(makeComposedAffineApply(rewriter, loc, e, linearId));
ids.push_back(
affine::makeComposedAffineApply(rewriter, loc, e, linearId));

// clang-format off
LLVM_DEBUG(llvm::interleaveComma(reverseBasisSizes,
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/GPU/Transforms/MemoryPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ static void insertCopyLoops(ImplicitLocOpBuilder &b, Value from, Value to) {
GPUDialect::getNumWorkgroupDimensions())))) {
Value v = en.value();
auto loop = cast<scf::ForOp>(v.getParentRegion()->getParentOp());
mapLoopToProcessorIds(loop, {threadIds[en.index()]},
{blockDims[en.index()]});
affine::mapLoopToProcessorIds(loop, {threadIds[en.index()]},
{blockDims[en.index()]});
}
}

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ LinalgOp::reifyResultShapes(OpBuilder &b,
Location loc = getOperation()->getLoc();
IRRewriter rewriter(b);
SmallVector<OpFoldResult> allResultDimValues =
makeComposedFoldedMultiResultAffineApply(
affine::makeComposedFoldedMultiResultAffineApply(
rewriter, loc, resultShapesFromInputShapesMap,
createFlatListOfOperandDims(b, loc));
int64_t pos = 0;
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ struct FoldInsertPadIntoFill : public OpRewritePattern<tensor::InsertSliceOp> {
// plus low padding sizes.
SmallVector<OpFoldResult, 4> newOffsets;
for (const auto &p : llvm::zip(lowPads, oldOffsets)) {
newOffsets.push_back(makeComposedFoldedAffineApply(
newOffsets.push_back(affine::makeComposedFoldedAffineApply(
rewriter, loc, addMap, {std::get<0>(p), std::get<1>(p)}));
}

Expand Down
12 changes: 6 additions & 6 deletions mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,8 @@ DiagnosedSilenceableFailure transform::MultiTileSizesOp::applyToOne(
AffineExpr s0 = builder.getAffineSymbolExpr(0);
AffineExpr s1 = builder.getAffineSymbolExpr(1);
Operation *splitPoint =
makeComposedAffineApply(builder, target.getLoc(), s0 * s1,
{spec->lowTileSize, spec->lowTripCount});
affine::makeComposedAffineApply(builder, target.getLoc(), s0 * s1,
{spec->lowTileSize, spec->lowTripCount});
Operation *lowTileSize = spec->lowTileSize.getDefiningOp();
Operation *highTileSize = spec->highTileSize.getDefiningOp();
assert(lowTileSize && highTileSize && splitPoint &&
Expand Down Expand Up @@ -1420,7 +1420,7 @@ packMatmulGreedily(RewriterBase &rewriter, LinalgOp linalgOp,
AffineExpr d0, s0;
bindDims(rewriter.getContext(), d0);
bindSymbols(rewriter.getContext(), s0);
adjustedPackedSizes.push_back(makeComposedFoldedAffineApply(
adjustedPackedSizes.push_back(affine::makeComposedFoldedAffineApply(
rewriter, genericOp->getLoc(), d0.ceilDiv(s0) * s0,
{loopRanges[adjustedPackedSizes.size()].size,
rewriter.getIndexAttr(paddedSizesNextMultipleOf[i])}));
Expand Down Expand Up @@ -1983,8 +1983,8 @@ transform::ScalarizeOp::applyToOne(LinalgOp target,
TrackingListener listener(state, *this);
IRRewriter rewriter(getContext(), &listener);
SmallVector<OpFoldResult> shapeSizes =
makeComposedFoldedMultiResultAffineApply(rewriter, loc, map,
allShapeSizes);
affine::makeComposedFoldedMultiResultAffineApply(rewriter, loc, map,
allShapeSizes);
// If the shape size is dynamic, tile by 1.
// Otherwise, do not tile (i.e. tile size 0).
for (OpFoldResult shapeSize : shapeSizes) {
Expand Down Expand Up @@ -3351,7 +3351,7 @@ class LinalgTransformDialectExtension
void init() {
declareDependentDialect<pdl::PDLDialect>();
declareDependentDialect<LinalgDialect>();
declareGeneratedDialect<AffineDialect>();
declareGeneratedDialect<affine::AffineDialect>();
declareGeneratedDialect<arith::ArithDialect>();
declareGeneratedDialect<scf::SCFDialect>();
declareGeneratedDialect<vector::VectorDialect>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct BubbleUpExtractSliceOpPattern
linalgOp, "failed to get loops map from shape sizes");
}
SmallVector<OpFoldResult> sizeBounds =
makeComposedFoldedMultiResultAffineApply(
affine::makeComposedFoldedMultiResultAffineApply(
rewriter, linalgLoc, shapeSizesToLoopsMap, allShapeSizes);

// The offsets and sizes from the slice operation only give you the tile
Expand Down
5 changes: 3 additions & 2 deletions mlir/lib/Dialect/Linalg/Transforms/ConvertConv2DToImg2Col.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static SmallVector<Value> unrollIndex(OpBuilder &b, Location loc, Value index,
for (int64_t f : factors)
basis.push_back(b.create<arith::ConstantOp>(loc, b.getIndexAttr(f)));
FailureOr<SmallVector<Value>> multiIndex =
delinearizeIndex(b, loc, index, basis);
affine::delinearizeIndex(b, loc, index, basis);
assert(!failed(multiIndex) && "Failed to linearize img2col index");
return *multiIndex;
}
Expand All @@ -68,7 +68,8 @@ static Value getConvolvedIndex(OpBuilder &b, Location loc, Value oIndex,
AffineExpr oExpr, fExpr;
bindSymbols(b.getContext(), oExpr, fExpr);
AffineMap convMap = AffineMap::get(0, 2, stride * oExpr + fExpr);
return makeComposedAffineApply(b, loc, convMap, ValueRange{oIndex, fIndex});
return affine::makeComposedAffineApply(b, loc, convMap,
ValueRange{oIndex, fIndex});
}

FailureOr<std::pair<Operation *, Operation *>>
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ static SmallVector<OpFoldResult> getGenericOpLoopRange(OpBuilder &b,
cast<LinalgOp>(op.getOperation()).createFlatListOfOperandDims(b, loc);
AffineMap map = op.getShapesToLoopsMap();
IRRewriter rewriter(b);
return makeComposedFoldedMultiResultAffineApply(rewriter, loc, map,
allShapesSizes);
return affine::makeComposedFoldedMultiResultAffineApply(rewriter, loc, map,
allShapesSizes);
}

/// Helper method to permute the list of `values` based on the `map`.
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void generateFusedElementwiseOpRegion(
});
for (IndexOp indexOp :
llvm::make_early_inc_range(producerBlock.getOps<IndexOp>())) {
Value newIndex = rewriter.create<mlir::AffineApplyOp>(
Value newIndex = rewriter.create<affine::AffineApplyOp>(
producer.getLoc(),
consumerToProducerLoopsMap.getSubMap(indexOp.getDim()), fusedIndices);
mapper.map(indexOp.getResult(), newIndex);
Expand Down Expand Up @@ -719,7 +719,7 @@ static void updateExpandedGenericOpRegion(PatternRewriter &rewriter,
assert(!ShapedType::isDynamic(std::get<0>(it)));
AffineExpr idx, acc;
bindDims(rewriter.getContext(), idx, acc);
newIndex = rewriter.create<AffineApplyOp>(
newIndex = rewriter.create<affine::AffineApplyOp>(
indexOp.getLoc(), idx + acc * std::get<0>(it),
ValueRange{std::get<1>(it), newIndex});
}
Expand Down Expand Up @@ -1871,7 +1871,7 @@ struct LinalgElementwiseOpFusionPass
populateFoldReshapeOpsByExpansionPatterns(patterns, defaultControlFn);

// General canonicalization patterns.
AffineApplyOp::getCanonicalizationPatterns(patterns, context);
affine::AffineApplyOp::getCanonicalizationPatterns(patterns, context);
GenericOp::getCanonicalizationPatterns(patterns, context);
tensor::ExpandShapeOp::getCanonicalizationPatterns(patterns, context);
tensor::CollapseShapeOp::getCanonicalizationPatterns(patterns, context);
Expand Down
9 changes: 5 additions & 4 deletions mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ HoistPaddingAnalysis::getHoistedPackedTensorSizes(RewriterBase &rewriter,
// of the enclosing loops.
for (auto forOp : packingLoops) {
// Compute an upper bound `ubVal` for the upper bound of `forOp`.
FailureOr<OpFoldResult> loopUb = reifyIndexValueBound(
FailureOr<OpFoldResult> loopUb = affine::reifyIndexValueBound(
rewriter, loc, presburger::BoundType::UB, forOp.getUpperBound(),
/*stopCondition=*/
[&](Value v, std::optional<int64_t> d) {
Expand All @@ -472,7 +472,8 @@ HoistPaddingAnalysis::getHoistedPackedTensorSizes(RewriterBase &rewriter,
Operation *op = v.getDefiningOp();
if (!op)
return true;
return !isa<AffineMinOp, AffineMaxOp, AffineApplyOp>(op);
return !isa<affine::AffineMinOp, affine::AffineMaxOp,
affine::AffineApplyOp>(op);
},
/*closedUB=*/true);
assert(succeeded(loopUb) && "could not get upper bound");
Expand All @@ -485,7 +486,7 @@ HoistPaddingAnalysis::getHoistedPackedTensorSizes(RewriterBase &rewriter,
AffineExpr lb, ub, step;
bindDims(rewriter.getContext(), lb, ub);
bindSymbols(rewriter.getContext(), step);
Value res = rewriter.createOrFold<AffineApplyOp>(
Value res = rewriter.createOrFold<affine::AffineApplyOp>(
loc, (ub - lb).ceilDiv(step),
ValueRange{forOp.getLowerBound(), ubVal,
cast<scf::ForOp>(forOp).getStep()});
Expand Down Expand Up @@ -519,7 +520,7 @@ static Value buildLoopIterationCount(RewriterBase &rewriter, scf::ForOp outer,
Value ivVal = forOp.getInductionVar(), lbVal = forOp.getLowerBound(),
stepVal = forOp.getStep();
auto loc = forOp->getLoc();
return rewriter.createOrFold<AffineApplyOp>(
return rewriter.createOrFold<affine::AffineApplyOp>(
loc, (iv - lb).ceilDiv(step), ValueRange{ivVal, lbVal, stepVal});
}

Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void mlir::linalg::hoistRedundantVectorTransfers(func::FuncOp func) {
auto loop = dyn_cast<LoopLikeOpInterface>(transferRead->getParentOp());
LLVM_DEBUG(DBGS() << "Parent op: " << *transferRead->getParentOp()
<< "\n");
if (!isa_and_nonnull<scf::ForOp, AffineForOp>(loop))
if (!isa_and_nonnull<scf::ForOp, affine::AffineForOp>(loop))
return WalkResult::advance();

LLVM_DEBUG(DBGS() << "Candidate read: " << *transferRead.getOperation()
Expand Down Expand Up @@ -200,7 +200,7 @@ void mlir::linalg::hoistRedundantVectorTransfers(func::FuncOp func) {
// the walk.
return WalkResult::interrupt();
})
.Case<AffineForOp>([&](AffineForOp affineForOp) {
.Case<affine::AffineForOp>([&](affine::AffineForOp affineForOp) {
auto newForOp = replaceForOpWithNewYields(
b, affineForOp, transferRead.getVector(),
SmallVector<Value>{transferWrite.getVector()},
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mlir::linalg::interchangeGenericOp(RewriterBase &rewriter, GenericOp genericOp,
std::back_inserter(allIndices), [&](uint64_t dim) {
return rewriter.create<IndexOp>(indexOp->getLoc(), dim);
});
rewriter.replaceOpWithNewOp<AffineApplyOp>(
rewriter.replaceOpWithNewOp<affine::AffineApplyOp>(
indexOp, permutationMap.getSubMap(indexOp.getDim()), allIndices);
}
}
Expand Down
26 changes: 14 additions & 12 deletions mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ static SmallVector<Value> makeCanonicalAffineApplies(OpBuilder &b, Location loc,
for (auto e : map.getResults()) {
auto exprMap = AffineMap::get(dims, map.getNumSymbols(), e);
SmallVector<Value> operands(vals.begin(), vals.end());
canonicalizeMapAndOperands(&exprMap, &operands);
res.push_back(b.create<AffineApplyOp>(loc, exprMap, operands));
affine::canonicalizeMapAndOperands(&exprMap, &operands);
res.push_back(b.create<affine::AffineApplyOp>(loc, exprMap, operands));
}
return res;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ static void replaceIndexOpsByInductionVariables(RewriterBase &rewriter,
.Case([&](scf::ForOp forOp) {
allIvs.push_back(forOp.getInductionVar());
})
.Case([&](AffineForOp affineForOp) {
.Case([&](affine::AffineForOp affineForOp) {
allIvs.push_back(affineForOp.getInductionVar());
})
.Default([&](Operation *op) { assert(false && "unexpected op"); });
Expand All @@ -208,10 +208,12 @@ static void replaceIndexOpsByInductionVariables(RewriterBase &rewriter,
template <typename LoopTy>
static FailureOr<LinalgLoops> linalgOpToLoopsImpl(RewriterBase &rewriter,
LinalgOp linalgOp) {
using LoadOpTy = std::conditional_t<std::is_same<LoopTy, AffineForOp>::value,
AffineLoadOp, memref::LoadOp>;
using StoreOpTy = std::conditional_t<std::is_same<LoopTy, AffineForOp>::value,
AffineStoreOp, memref::StoreOp>;
using LoadOpTy =
std::conditional_t<std::is_same<LoopTy, affine::AffineForOp>::value,
affine::AffineLoadOp, memref::LoadOp>;
using StoreOpTy =
std::conditional_t<std::is_same<LoopTy, affine::AffineForOp>::value,
affine::AffineStoreOp, memref::StoreOp>;

// The flattened loopToOperandRangesMaps is expected to be an invertible
// permutation map (which is asserted in the inverse calculation).
Expand Down Expand Up @@ -284,11 +286,11 @@ class LinalgRewritePattern : public RewritePattern {
/// other cases, it is replaced by its unique operand.
struct FoldAffineOp : public RewritePattern {
FoldAffineOp(MLIRContext *context)
: RewritePattern(AffineApplyOp::getOperationName(), 0, context) {}
: RewritePattern(affine::AffineApplyOp::getOperationName(), 0, context) {}

LogicalResult matchAndRewrite(Operation *op,
PatternRewriter &rewriter) const override {
AffineApplyOp affineApplyOp = cast<AffineApplyOp>(op);
auto affineApplyOp = cast<affine::AffineApplyOp>(op);
auto map = affineApplyOp.getAffineMap();
if (map.getNumResults() != 1 || map.getNumInputs() > 1)
return failure();
Expand Down Expand Up @@ -316,7 +318,7 @@ static void lowerLinalgToLoopsImpl(func::FuncOp funcOp) {
patterns.add<LinalgRewritePattern<LoopType>>(context);
memref::DimOp::getCanonicalizationPatterns(patterns, context);
tensor::DimOp::getCanonicalizationPatterns(patterns, context);
AffineApplyOp::getCanonicalizationPatterns(patterns, context);
affine::AffineApplyOp::getCanonicalizationPatterns(patterns, context);
patterns.add<FoldAffineOp>(context);
// Just apply the patterns greedily.
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
Expand All @@ -328,7 +330,7 @@ struct LowerToAffineLoops
registry.insert<memref::MemRefDialect>();
}
void runOnOperation() override {
lowerLinalgToLoopsImpl<AffineForOp>(getOperation());
lowerLinalgToLoopsImpl<affine::AffineForOp>(getOperation());
}
};

Expand Down Expand Up @@ -368,7 +370,7 @@ mlir::createConvertLinalgToAffineLoopsPass() {
/// Emits a loop nest of `affine.for` with the proper body for `linalgOp`.
FailureOr<LinalgLoops>
mlir::linalg::linalgOpToAffineLoops(RewriterBase &rewriter, LinalgOp linalgOp) {
return linalgOpToLoopsImpl<AffineForOp>(rewriter, linalgOp);
return linalgOpToLoopsImpl<affine::AffineForOp>(rewriter, linalgOp);
}

/// Emits a loop nest of `scf.for` with the proper body for `linalgOp`.
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Dialect/Linalg/Transforms/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ linalg::splitOp(RewriterBase &rewriter, TilingInterface op, unsigned dimension,
// Adjust the split point so that it doesn't overflow the size.
AffineExpr d0, d1, d2;
bindDims(rewriter.getContext(), d0, d1, d2);
OpFoldResult minSplitPoint = makeComposedFoldedAffineMin(
OpFoldResult minSplitPoint = affine::makeComposedFoldedAffineMin(
rewriter, op.getLoc(),
AffineMap::inferFromExprList(ArrayRef<AffineExpr>{d0, d1 + d2}).front(),
{splitPoint, offsets[dimension], sizes[dimension]});

// Compute the size of the second part. Return early if the second part would
// have an empty iteration space.
OpFoldResult remainingSize = makeComposedFoldedAffineApply(
OpFoldResult remainingSize = affine::makeComposedFoldedAffineApply(
rewriter, op.getLoc(), d0 + d1 - d2,
{iterationSpace[dimension].offset, iterationSpace[dimension].size,
minSplitPoint});
Expand Down Expand Up @@ -121,7 +121,7 @@ linalg::splitOp(RewriterBase &rewriter, TilingInterface op, unsigned dimension,
});

// Create the second part.
OpFoldResult totalOffset = makeComposedFoldedAffineApply(
OpFoldResult totalOffset = affine::makeComposedFoldedAffineApply(
rewriter, op.getLoc(), d0 + d1, {offsets[dimension], minSplitPoint});
SmallVector<Value> secondResults;
TilingInterface secondPart =
Expand Down
15 changes: 8 additions & 7 deletions mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace mlir {
} // namespace mlir

using namespace mlir;
using namespace mlir::affine;
using namespace mlir::linalg;
using namespace mlir::scf;

Expand Down Expand Up @@ -178,7 +179,7 @@ mlir::linalg::computeMultiTileSizes(OpBuilder &builder, LinalgOp op,
AffineExpr s1 = b.getAffineSymbolExpr(1);
AffineExpr s2 = b.getAffineSymbolExpr(2);
auto apply = [&](AffineExpr expr, ValueRange values) -> Value {
return makeComposedAffineApply(b, b.getLoc(), expr, values);
return affine::makeComposedAffineApply(b, b.getLoc(), expr, values);
};
Value a = apply(s0.floorDiv(s1), {tripCount, divisorValue});
Value t = apply((s0 + s1 - 1).floorDiv(s1), {targetSizeValue, divisorValue});
Expand Down Expand Up @@ -228,15 +229,15 @@ static bool canOmitTileOffsetInBoundsCheck(OpFoldResult tileSize,
/// Build an `affine_max` of all the `vals`.
static OpFoldResult buildMax(OpBuilder &b, Location loc,
ArrayRef<OpFoldResult> vals) {
return makeComposedFoldedAffineMax(
return affine::makeComposedFoldedAffineMax(
b, loc, AffineMap::getMultiDimIdentityMap(vals.size(), loc.getContext()),
vals);
}

/// Build an `affine_min` of all the `vals`.
static OpFoldResult buildMin(OpBuilder &b, Location loc,
ArrayRef<OpFoldResult> vals) {
return makeComposedFoldedAffineMin(
return affine::makeComposedFoldedAffineMin(
b, loc, AffineMap::getMultiDimIdentityMap(vals.size(), loc.getContext()),
vals);
}
Expand Down Expand Up @@ -968,10 +969,10 @@ mlir::linalg::getLinalgTilingCanonicalizationPatterns(MLIRContext *ctx) {
void mlir::linalg::populateLinalgTilingCanonicalizationPatterns(
RewritePatternSet &patterns) {
auto *ctx = patterns.getContext();
AffineApplyOp::getCanonicalizationPatterns(patterns, ctx);
AffineForOp::getCanonicalizationPatterns(patterns, ctx);
AffineMinOp::getCanonicalizationPatterns(patterns, ctx);
AffineMaxOp::getCanonicalizationPatterns(patterns, ctx);
affine::AffineApplyOp::getCanonicalizationPatterns(patterns, ctx);
affine::AffineForOp::getCanonicalizationPatterns(patterns, ctx);
affine::AffineMinOp::getCanonicalizationPatterns(patterns, ctx);
affine::AffineMaxOp::getCanonicalizationPatterns(patterns, ctx);
arith::ConstantIndexOp::getCanonicalizationPatterns(patterns, ctx);

memref::SubViewOp::getCanonicalizationPatterns(patterns, ctx);
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static SmallVector<Value> getIndicesForAccess(OpBuilder &b, Location loc,
for (auto result : indexingMap.getResults()) {
AffineMap m = AffineMap::get(indexingMap.getNumDims(),
indexingMap.getNumSymbols(), result);
Value v = b.create<AffineApplyOp>(loc, m, ivs);
Value v = b.create<affine::AffineApplyOp>(loc, m, ivs);
indices.push_back(v);
}
return indices;
Expand Down Expand Up @@ -104,8 +104,8 @@ struct LinalgOpTilingInterface

return llvm::to_vector(
llvm::map_range(map.getResults(), [&](AffineExpr loopExpr) {
OpFoldResult ofr =
makeComposedFoldedAffineApply(b, loc, loopExpr, allShapesSizes);
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
b, loc, loopExpr, allShapesSizes);
return Range{b.getIndexAttr(0), ofr, b.getIndexAttr(1)};
}));
}
Expand Down Expand Up @@ -147,7 +147,7 @@ struct LinalgOpTilingInterface
bindDims(b.getContext(), d0);
SmallVector<OpFoldResult> subShapeSizes =
llvm::to_vector(llvm::map_range(sizes, [&](OpFoldResult ofr) {
return makeComposedFoldedAffineApply(b, loc, d0 - 1, ofr);
return affine::makeComposedFoldedAffineApply(b, loc, d0 - 1, ofr);
}));

OpOperand *outOperand = linalgOp.getDpsInitOperand(resultNumber);
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,11 @@ mlir::linalg::vectorizeLinalgOpPrecondition(LinalgOp linalgOp,
/// Converts affine.apply Ops to arithmetic operations.
static void convertAffineApply(RewriterBase &rewriter, LinalgOp linalgOp) {
OpBuilder::InsertionGuard g(rewriter);
auto toReplace = linalgOp.getBlock()->getOps<AffineApplyOp>();
auto toReplace = linalgOp.getBlock()->getOps<affine::AffineApplyOp>();

for (auto op : make_early_inc_range(toReplace)) {
rewriter.setInsertionPoint(op);
auto expanded = expandAffineExpr(
auto expanded = affine::expandAffineExpr(
rewriter, op->getLoc(), op.getAffineMap().getResult(0),
op.getOperands().take_front(op.getAffineMap().getNumDims()),
op.getOperands().take_back(op.getAffineMap().getNumSymbols()));
Expand Down Expand Up @@ -1868,8 +1868,8 @@ struct PadOpVectorizationWithTransferWritePattern

// Case 2: Both values are identical AffineMinOps. (Should not happen if
// CSE is run.)
auto minOp1 = v1.getDefiningOp<AffineMinOp>();
auto minOp2 = v2.getDefiningOp<AffineMinOp>();
auto minOp1 = v1.getDefiningOp<affine::AffineMinOp>();
auto minOp2 = v2.getDefiningOp<affine::AffineMinOp>();
if (minOp1 && minOp2 && minOp1.getAffineMap() == minOp2.getAffineMap() &&
minOp1.getOperands() == minOp2.getOperands())
continue;
Expand Down
16 changes: 9 additions & 7 deletions mlir/lib/Dialect/Linalg/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

using namespace mlir;
using namespace presburger;
using namespace mlir::affine;
using namespace mlir::linalg;
using namespace mlir::scf;

Expand Down Expand Up @@ -456,11 +457,11 @@ void GenerateLoopNest<AffineForOp>::doit(
constantSteps.push_back(op.value());
}

mlir::buildAffineLoopNest(b, loc, lbs, ubs, constantSteps,
[&](OpBuilder &b, Location loc, ValueRange ivs) {
bodyBuilderFn(b, loc, ivs,
linalgOp->getOperands());
});
affine::buildAffineLoopNest(b, loc, lbs, ubs, constantSteps,
[&](OpBuilder &b, Location loc, ValueRange ivs) {
bodyBuilderFn(b, loc, ivs,
linalgOp->getOperands());
});
}

/// Update the `lb`, `ub` and `step` to get per processor `lb`, `ub` and `step`.
Expand All @@ -470,8 +471,9 @@ void updateBoundsForCyclicDistribution(OpBuilder &b, Location loc, Value procId,
AffineExpr d0, d1;
bindDims(b.getContext(), d0, d1);
AffineExpr s0 = getAffineSymbolExpr(0, b.getContext());
lb = makeComposedAffineApply(b, loc, d0 + d1 * s0, {lb, procId, step});
step = makeComposedAffineApply(b, loc, d0 * s0, {nprocs, step});
lb =
affine::makeComposedAffineApply(b, loc, d0 + d1 * s0, {lb, procId, step});
step = affine::makeComposedAffineApply(b, loc, d0 * s0, {nprocs, step});
}

/// Generates a loop nest consisting of scf.parallel and scf.for, depending
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MemRefTransformDialectExtension

void init() {
declareDependentDialect<pdl::PDLDialect>();
declareGeneratedDialect<AffineDialect>();
declareGeneratedDialect<affine::AffineDialect>();
declareGeneratedDialect<arith::ArithDialect>();
declareGeneratedDialect<memref::MemRefDialect>();
declareGeneratedDialect<nvgpu::NVGPUDialect>();
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ struct ComposeSubViewOpPattern : public OpRewritePattern<memref::SubViewOp> {
}

AffineMap map = AffineMap::get(0, affineApplyOperands.size(), expr);
Value result = rewriter.create<AffineApplyOp>(op.getLoc(), map,
affineApplyOperands);
Value result = rewriter.create<affine::AffineApplyOp>(
op.getLoc(), map, affineApplyOperands);
offsets.push_back(result);
}
}
Expand Down
2 changes: 2 additions & 0 deletions mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ namespace memref {
#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
} // namespace memref
} // namespace mlir

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ getGenericOpViewSizeForEachDim(RewriterBase &rewriter,
AffineExpr s1 = rewriter.getAffineSymbolExpr(1);

for (auto [srcSize, indice] : llvm::zip(srcSizes, indices)) {
finalSizes.push_back(makeComposedFoldedAffineApply(rewriter, loc, s0 - s1,
{srcSize, indice}));
finalSizes.push_back(affine::makeComposedFoldedAffineApply(
rewriter, loc, s0 - s1, {srcSize, indice}));
}
return finalSizes;
}
Expand Down
72 changes: 39 additions & 33 deletions mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ resolveSourceIndicesExpandShape(Location loc, PatternRewriter &rewriter,

// Creating maximally folded and composd affine.apply composes better with
// other transformations without interleaving canonicalization passes.
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, loc,
AffineMap::get(/*numDims=*/groupSize,
/*numSymbols=*/0, srcIndexExpr),
Expand Down Expand Up @@ -135,7 +135,7 @@ resolveSourceIndicesCollapseShape(Location loc, PatternRewriter &rewriter,

// Construct the AffineApplyOp for each delinearizingExpr.
for (int64_t i = 0; i < groupSize; i++) {
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, loc,
AffineMap::get(/*numDims=*/1, /*numSymbols=*/0,
delinearizingExprs[i]),
Expand All @@ -150,7 +150,7 @@ resolveSourceIndicesCollapseShape(Location loc, PatternRewriter &rewriter,
int64_t srcRank =
collapseShapeOp.getViewSource().getType().cast<MemRefType>().getRank();
for (int64_t i = 0; i < srcRank; i++) {
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, loc, zeroAffineMap, dynamicIndices);
sourceIndices.push_back(
getValueOrCreateConstantIndexOp(rewriter, loc, ofr));
Expand Down Expand Up @@ -268,13 +268,13 @@ class SubViewOfSubViewFolder : public OpRewritePattern<memref::SubViewOp> {
// Resolve sizes according to dropped dims.
SmallVector<OpFoldResult> resolvedSizes;
llvm::SmallBitVector srcDroppedDims = srcSubView.getDroppedDims();
resolveSizesIntoOpWithSizes(srcSubView.getMixedSizes(),
subView.getMixedSizes(), srcDroppedDims,
resolvedSizes);
affine::resolveSizesIntoOpWithSizes(srcSubView.getMixedSizes(),
subView.getMixedSizes(), srcDroppedDims,
resolvedSizes);

// Resolve offsets according to source offsets and strides.
SmallVector<Value> resolvedOffsets;
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, subView.getLoc(), srcSubView.getMixedOffsets(),
srcSubView.getMixedStrides(), srcDroppedDims, subView.getMixedOffsets(),
resolvedOffsets);
Expand Down Expand Up @@ -309,7 +309,7 @@ calculateExpandedAccessIndices(AffineMap affineMap,
llvm::map_range(indices, [](Value v) -> OpFoldResult { return v; })));
SmallVector<Value> expandedIndices;
for (unsigned i = 0, e = affineMap.getNumResults(); i < e; i++) {
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, loc, affineMap.getSubMap({i}), indicesOfr);
expandedIndices.push_back(
getValueOrCreateConstantIndexOp(rewriter, loc, ofr));
Expand Down Expand Up @@ -371,22 +371,23 @@ LogicalResult LoadOpOfSubViewOpFolder<OpTy>::matchAndRewrite(
loadOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineLoadOp = dyn_cast<AffineLoadOp>(loadOp.getOperation())) {
if (auto affineLoadOp =
dyn_cast<affine::AffineLoadOp>(loadOp.getOperation())) {
AffineMap affineMap = affineLoadOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, loadOp.getLoc(), rewriter);
indices.assign(expandedIndices.begin(), expandedIndices.end());
}
SmallVector<Value> sourceIndices;
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, loadOp.getLoc(), subViewOp.getMixedOffsets(),
subViewOp.getMixedStrides(), subViewOp.getDroppedDims(), indices,
sourceIndices);

llvm::TypeSwitch<Operation *, void>(loadOp)
.Case([&](AffineLoadOp op) {
rewriter.replaceOpWithNewOp<AffineLoadOp>(loadOp, subViewOp.getSource(),
sourceIndices);
.Case([&](affine::AffineLoadOp op) {
rewriter.replaceOpWithNewOp<affine::AffineLoadOp>(
loadOp, subViewOp.getSource(), sourceIndices);
})
.Case([&](memref::LoadOp op) {
rewriter.replaceOpWithNewOp<memref::LoadOp>(
Expand Down Expand Up @@ -422,7 +423,8 @@ LogicalResult LoadOpOfExpandShapeOpFolder<OpTy>::matchAndRewrite(
loadOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineLoadOp = dyn_cast<AffineLoadOp>(loadOp.getOperation())) {
if (auto affineLoadOp =
dyn_cast<affine::AffineLoadOp>(loadOp.getOperation())) {
AffineMap affineMap = affineLoadOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, loadOp.getLoc(), rewriter);
Expand All @@ -433,7 +435,7 @@ LogicalResult LoadOpOfExpandShapeOpFolder<OpTy>::matchAndRewrite(
loadOp.getLoc(), rewriter, expandShapeOp, indices, sourceIndices)))
return failure();
llvm::TypeSwitch<Operation *, void>(loadOp)
.Case<AffineLoadOp, memref::LoadOp>([&](auto op) {
.Case<affine::AffineLoadOp, memref::LoadOp>([&](auto op) {
rewriter.replaceOpWithNewOp<decltype(op)>(
loadOp, expandShapeOp.getViewSource(), sourceIndices);
})
Expand All @@ -454,7 +456,8 @@ LogicalResult LoadOpOfCollapseShapeOpFolder<OpTy>::matchAndRewrite(
loadOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineLoadOp = dyn_cast<AffineLoadOp>(loadOp.getOperation())) {
if (auto affineLoadOp =
dyn_cast<affine::AffineLoadOp>(loadOp.getOperation())) {
AffineMap affineMap = affineLoadOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, loadOp.getLoc(), rewriter);
Expand All @@ -465,7 +468,7 @@ LogicalResult LoadOpOfCollapseShapeOpFolder<OpTy>::matchAndRewrite(
loadOp.getLoc(), rewriter, collapseShapeOp, indices, sourceIndices)))
return failure();
llvm::TypeSwitch<Operation *, void>(loadOp)
.Case<AffineLoadOp, memref::LoadOp>([&](auto op) {
.Case<affine::AffineLoadOp, memref::LoadOp>([&](auto op) {
rewriter.replaceOpWithNewOp<decltype(op)>(
loadOp, collapseShapeOp.getViewSource(), sourceIndices);
})
Expand All @@ -491,21 +494,22 @@ LogicalResult StoreOpOfSubViewOpFolder<OpTy>::matchAndRewrite(
storeOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineStoreOp = dyn_cast<AffineStoreOp>(storeOp.getOperation())) {
if (auto affineStoreOp =
dyn_cast<affine::AffineStoreOp>(storeOp.getOperation())) {
AffineMap affineMap = affineStoreOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, storeOp.getLoc(), rewriter);
indices.assign(expandedIndices.begin(), expandedIndices.end());
}
SmallVector<Value> sourceIndices;
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, storeOp.getLoc(), subViewOp.getMixedOffsets(),
subViewOp.getMixedStrides(), subViewOp.getDroppedDims(), indices,
sourceIndices);

llvm::TypeSwitch<Operation *, void>(storeOp)
.Case([&](AffineStoreOp op) {
rewriter.replaceOpWithNewOp<AffineStoreOp>(
.Case([&](affine::AffineStoreOp op) {
rewriter.replaceOpWithNewOp<affine::AffineStoreOp>(
op, op.getValue(), subViewOp.getSource(), sourceIndices);
})
.Case([&](memref::StoreOp op) {
Expand Down Expand Up @@ -543,7 +547,8 @@ LogicalResult StoreOpOfExpandShapeOpFolder<OpTy>::matchAndRewrite(
storeOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineStoreOp = dyn_cast<AffineStoreOp>(storeOp.getOperation())) {
if (auto affineStoreOp =
dyn_cast<affine::AffineStoreOp>(storeOp.getOperation())) {
AffineMap affineMap = affineStoreOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, storeOp.getLoc(), rewriter);
Expand All @@ -554,7 +559,7 @@ LogicalResult StoreOpOfExpandShapeOpFolder<OpTy>::matchAndRewrite(
storeOp.getLoc(), rewriter, expandShapeOp, indices, sourceIndices)))
return failure();
llvm::TypeSwitch<Operation *, void>(storeOp)
.Case<AffineStoreOp, memref::StoreOp>([&](auto op) {
.Case<affine::AffineStoreOp, memref::StoreOp>([&](auto op) {
rewriter.replaceOpWithNewOp<decltype(op)>(storeOp, storeOp.getValue(),
expandShapeOp.getViewSource(),
sourceIndices);
Expand All @@ -576,7 +581,8 @@ LogicalResult StoreOpOfCollapseShapeOpFolder<OpTy>::matchAndRewrite(
storeOp.getIndices().end());
// For affine ops, we need to apply the map to get the operands to get the
// "actual" indices.
if (auto affineStoreOp = dyn_cast<AffineStoreOp>(storeOp.getOperation())) {
if (auto affineStoreOp =
dyn_cast<affine::AffineStoreOp>(storeOp.getOperation())) {
AffineMap affineMap = affineStoreOp.getAffineMap();
auto expandedIndices = calculateExpandedAccessIndices(
affineMap, indices, storeOp.getLoc(), rewriter);
Expand All @@ -587,7 +593,7 @@ LogicalResult StoreOpOfCollapseShapeOpFolder<OpTy>::matchAndRewrite(
storeOp.getLoc(), rewriter, collapseShapeOp, indices, sourceIndices)))
return failure();
llvm::TypeSwitch<Operation *, void>(storeOp)
.Case<AffineStoreOp, memref::StoreOp>([&](auto op) {
.Case<affine::AffineStoreOp, memref::StoreOp>([&](auto op) {
rewriter.replaceOpWithNewOp<decltype(op)>(
storeOp, storeOp.getValue(), collapseShapeOp.getViewSource(),
sourceIndices);
Expand Down Expand Up @@ -617,7 +623,7 @@ LogicalResult NvgpuAsyncCopyOpSubViewOpFolder::matchAndRewrite(

if (srcSubViewOp) {
LLVM_DEBUG(DBGS() << "srcSubViewOp : " << srcSubViewOp << "\n");
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, copyOp.getLoc(), srcSubViewOp.getMixedOffsets(),
srcSubViewOp.getMixedStrides(), srcSubViewOp.getDroppedDims(),
srcindices, foldedSrcIndices);
Expand All @@ -630,7 +636,7 @@ LogicalResult NvgpuAsyncCopyOpSubViewOpFolder::matchAndRewrite(

if (dstSubViewOp) {
LLVM_DEBUG(DBGS() << "dstSubViewOp : " << dstSubViewOp << "\n");
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, copyOp.getLoc(), dstSubViewOp.getMixedOffsets(),
dstSubViewOp.getMixedStrides(), dstSubViewOp.getDroppedDims(),
dstindices, foldedDstIndices);
Expand All @@ -650,21 +656,21 @@ LogicalResult NvgpuAsyncCopyOpSubViewOpFolder::matchAndRewrite(
}

void memref::populateFoldMemRefAliasOpPatterns(RewritePatternSet &patterns) {
patterns.add<LoadOpOfSubViewOpFolder<AffineLoadOp>,
patterns.add<LoadOpOfSubViewOpFolder<affine::AffineLoadOp>,
LoadOpOfSubViewOpFolder<memref::LoadOp>,
LoadOpOfSubViewOpFolder<vector::TransferReadOp>,
LoadOpOfSubViewOpFolder<gpu::SubgroupMmaLoadMatrixOp>,
StoreOpOfSubViewOpFolder<AffineStoreOp>,
StoreOpOfSubViewOpFolder<affine::AffineStoreOp>,
StoreOpOfSubViewOpFolder<memref::StoreOp>,
StoreOpOfSubViewOpFolder<vector::TransferWriteOp>,
StoreOpOfSubViewOpFolder<gpu::SubgroupMmaStoreMatrixOp>,
LoadOpOfExpandShapeOpFolder<AffineLoadOp>,
LoadOpOfExpandShapeOpFolder<affine::AffineLoadOp>,
LoadOpOfExpandShapeOpFolder<memref::LoadOp>,
StoreOpOfExpandShapeOpFolder<AffineStoreOp>,
StoreOpOfExpandShapeOpFolder<affine::AffineStoreOp>,
StoreOpOfExpandShapeOpFolder<memref::StoreOp>,
LoadOpOfCollapseShapeOpFolder<AffineLoadOp>,
LoadOpOfCollapseShapeOpFolder<affine::AffineLoadOp>,
LoadOpOfCollapseShapeOpFolder<memref::LoadOp>,
StoreOpOfCollapseShapeOpFolder<AffineStoreOp>,
StoreOpOfCollapseShapeOpFolder<affine::AffineStoreOp>,
StoreOpOfCollapseShapeOpFolder<memref::StoreOp>,
SubViewOfSubViewFolder, NvgpuAsyncCopyOpSubViewOpFolder>(
patterns.getContext());
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/MemRef/Transforms/MultiBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mlir::memref::multiBuffer(RewriterBase &rewriter, memref::AllocOp allocOp,
Value stepVal = getValueOrCreateConstantIndexOp(rewriter, loc, *singleStep);
AffineExpr iv, lb, step;
bindDims(rewriter.getContext(), iv, lb, step);
Value bufferIndex = makeComposedAffineApply(
Value bufferIndex = affine::makeComposedAffineApply(
rewriter, loc, ((iv - lb).floorDiv(step)) % multiBufferingFactor,
{ivVal, lbVal, stepVal});
LLVM_DEBUG(DBGS() << "--multi-buffered indexing: " << bufferIndex << "\n");
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace memref {
#define DEBUG_TYPE "normalize-memrefs"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
3 changes: 2 additions & 1 deletion mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"

using namespace mlir;
using namespace mlir::affine;

//===----------------------------------------------------------------------===//
// GetParentForOp
Expand Down Expand Up @@ -298,7 +299,7 @@ class SCFTransformDialectExtension
using Base::Base;

void init() {
declareGeneratedDialect<AffineDialect>();
declareGeneratedDialect<affine::AffineDialect>();
declareGeneratedDialect<func::FuncDialect>();

registerTransformOps<
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ void mlir::scf::populateSCFForLoopCanonicalizationPatterns(
RewritePatternSet &patterns) {
MLIRContext *ctx = patterns.getContext();
patterns
.add<AffineOpSCFCanonicalizationPattern<AffineMinOp>,
AffineOpSCFCanonicalizationPattern<AffineMaxOp>,
.add<AffineOpSCFCanonicalizationPattern<affine::AffineMinOp>,
AffineOpSCFCanonicalizationPattern<affine::AffineMaxOp>,
DimOfIterArgFolder<tensor::DimOp>, DimOfIterArgFolder<memref::DimOp>,
DimOfLoopResultFolder<tensor::DimOp>,
DimOfLoopResultFolder<memref::DimOp>>(ctx);
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace mlir {
} // namespace mlir

using namespace mlir;
using namespace mlir::affine;
using scf::ForOp;
using scf::ParallelOp;

Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes,
// Otherwise, we dynamically compute the bound for
// each iteration of the outer loop.
newBounds.push_back(
b.create<AffineMinOp>(op.getLoc(), b.getIndexType(), minMap,
ValueRange{newStep, upperBound, iv}));
b.create<affine::AffineMinOp>(op.getLoc(), b.getIndexType(), minMap,
ValueRange{newStep, upperBound, iv}));
}
auto innerLoop = b.create<ParallelOp>(
op.getLoc(), SmallVector<Value, 2>(newBounds.size(), zero), newBounds,
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static OpFoldResult getBoundedTileSize(OpBuilder &b, Location loc,
bindSymbols(b.getContext(), s0, s1);
AffineMap minMap = AffineMap::get(1, 2, {s0, s1 - d0}, b.getContext());
Value size = getValueOrCreateConstantIndexOp(b, loc, loopRange.size);
return makeComposedFoldedAffineMin(
return affine::makeComposedFoldedAffineMin(
b, loc, minMap, SmallVector<OpFoldResult>{iv, tileSize, size});
}

Expand Down
3 changes: 2 additions & 1 deletion mlir/lib/Dialect/SCF/Utils/AffineCanonicalizationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define DEBUG_TYPE "mlir-scf-affine-utils"

using namespace mlir;
using namespace affine;
using namespace presburger;

LogicalResult scf::matchForLikeLoop(Value iv, OpFoldResult &lb,
Expand Down Expand Up @@ -68,7 +69,7 @@ canonicalizeMinMaxOp(RewriterBase &rewriter, Operation *op,
RewriterBase::InsertionGuard guard(rewriter);
rewriter.setInsertionPoint(op);
FailureOr<AffineValueMap> simplified =
mlir::simplifyConstrainedMinMaxOp(op, std::move(constraints));
affine::simplifyConstrainedMinMaxOp(op, std::move(constraints));
if (failed(simplified))
return failure();
return rewriter.replaceOpWithNewOp<AffineApplyOp>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ static Value genVectorMask(PatternRewriter &rewriter, Location loc, VL vl,
{rewriter.getAffineSymbolExpr(0),
rewriter.getAffineDimExpr(0) - rewriter.getAffineDimExpr(1)},
rewriter.getContext());
Value end =
rewriter.createOrFold<AffineMinOp>(loc, min, ValueRange{hi, iv, step});
Value end = rewriter.createOrFold<affine::AffineMinOp>(
loc, min, ValueRange{hi, iv, step});
return rewriter.create<vector::CreateMaskOp>(loc, mtp, end);
}

Expand Down
10 changes: 5 additions & 5 deletions mlir/lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ static OpFoldResult getCollapsedOutputDimFromInputShape(
AffineExpr currExpr = builder.getAffineSymbolExpr(dim - startPos);
expr = (expr ? expr * currExpr : currExpr);
}
return applyMapToValues(builder, loc,
AffineMap::get(0, endPos - startPos + 1, expr),
dynamicDims)[0];
return affine::applyMapToValues(
builder, loc, AffineMap::get(0, endPos - startPos + 1, expr),
dynamicDims)[0];
}

/// Given the `src` of a collapsing reshape op and its reassociation maps,
Expand Down Expand Up @@ -103,7 +103,7 @@ static OpFoldResult getExpandedOutputDimFromInputShape(
linearizedStaticDim *= d.value();
}
Value sourceDim = builder.create<tensor::DimOp>(loc, src, sourceDimPos);
return applyMapToValues(
return affine::applyMapToValues(
builder, loc,
AffineMap::get(
0, 1, builder.getAffineSymbolExpr(0).floorDiv(linearizedStaticDim)),
Expand Down Expand Up @@ -190,7 +190,7 @@ struct ReifyPadOp
};
addOpFoldResult(lowPad[dim]);
addOpFoldResult(highPad[dim]);
shapes.push_back(applyMapToValues(
shapes.push_back(affine::applyMapToValues(
b, loc, AffineMap::get(1, numSymbols, expr), mapOperands)[0]);
}
reifiedReturnShapes.emplace_back(std::move(shapes));
Expand Down
14 changes: 8 additions & 6 deletions mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1528,8 +1528,8 @@ struct FoldDimOfExpandShape : public OpRewritePattern<DimOp> {
rewriter.create<DimOp>(dimOp.getLoc(), expandShapeOp.getSrc(), srcDim);
AffineExpr expr;
bindSymbols(dimOp.getContext(), expr);
rewriter.replaceOpWithNewOp<AffineApplyOp>(dimOp, expr.floorDiv(product),
srcDimSz);
rewriter.replaceOpWithNewOp<affine::AffineApplyOp>(
dimOp, expr.floorDiv(product), srcDimSz);
return success();
}
};
Expand Down Expand Up @@ -1567,7 +1567,8 @@ struct FoldDimOfCollapseShape : public OpRewritePattern<DimOp> {
syms.push_back(rewriter.getAffineSymbolExpr(it.index()));
product = product ? product * syms.back() : syms.back();
}
rewriter.replaceOpWithNewOp<AffineApplyOp>(dimOp, product, srcDimSizes);
rewriter.replaceOpWithNewOp<affine::AffineApplyOp>(dimOp, product,
srcDimSizes);
return success();
}
};
Expand Down Expand Up @@ -3565,7 +3566,7 @@ SmallVector<OpFoldResult> PackOp::getResultShape(
bindSymbols(builder.getContext(), s0, s1);
AffineExpr ceilDivExpr = s0.ceilDiv(s1);
for (auto tiledDim : llvm::enumerate(innerDimsPos)) {
resultDims[tiledDim.value()] = makeComposedFoldedAffineApply(
resultDims[tiledDim.value()] = affine::makeComposedFoldedAffineApply(
builder, loc, ceilDivExpr,
{resultDims[tiledDim.value()], innerTileSizes[tiledDim.index()]});
}
Expand Down Expand Up @@ -3610,7 +3611,8 @@ Value PackOp::createDestinationTensor(OpBuilder &b, Location loc, Value source,
AffineExpr dim0, dim1;
bindDims(b.getContext(), dim0, dim1);
auto ceilDiv = [&](OpFoldResult v1, OpFoldResult v2) -> OpFoldResult {
return makeComposedFoldedAffineApply(b, loc, dim0.ceilDiv(dim1), {v1, v2});
return affine::makeComposedFoldedAffineApply(b, loc, dim0.ceilDiv(dim1),
{v1, v2});
};

SmallVector<OpFoldResult> mixedSizes;
Expand Down Expand Up @@ -3816,7 +3818,7 @@ Value UnPackOp::createDestinationTensor(OpBuilder &b, Location loc,
AffineExpr sym0, sym1;
bindSymbols(b.getContext(), sym0, sym1);
auto dimMul = [&](OpFoldResult v1, OpFoldResult v2) -> OpFoldResult {
return makeComposedFoldedAffineApply(b, loc, sym0 * sym1, {v1, v2});
return affine::makeComposedFoldedAffineApply(b, loc, sym0 * sym1, {v1, v2});
};

SmallVector<OpFoldResult> mixedSizes;
Expand Down
24 changes: 12 additions & 12 deletions mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ struct PackOpTiling
tensor::createDimValues(b, loc, packOp.getSource());
SmallVector<OpFoldResult> inputIndices, inputSizes;
for (auto dim : llvm::seq<int64_t>(0, inputRank)) {
using AV = AffineValueExpr;
AffineBuilder ab(b, loc);
using AV = affine::AffineValueExpr;
affine::AffineBuilder ab(b, loc);
AffineExpr dim0, dim1, sym;
bindDims(b.getContext(), dim0, dim1);
bindSymbols(b.getContext(), sym);
Expand Down Expand Up @@ -255,8 +255,8 @@ static UnpackTileDimInfo getUnpackTileDimInfo(OpBuilder &b, UnPackOp unpackOp,
}

Location loc = unpackOp.getLoc();
using AV = AffineValueExpr;
AffineBuilder ab(b, loc);
using AV = affine::AffineValueExpr;
affine::AffineBuilder ab(b, loc);
AffineExpr dim0, dim1, sym0;
bindDims(b.getContext(), dim0, dim1);
bindSymbols(b.getContext(), sym0);
Expand Down Expand Up @@ -303,12 +303,12 @@ static UnpackTileDimInfo getUnpackTileDimInfo(OpBuilder &b, UnPackOp unpackOp,
return info;
}

DivModValue firstCoord =
getDivMod(b, loc, getValueOrCreateConstantIndexOp(b, loc, tileOffset),
getValueOrCreateConstantIndexOp(b, loc, innerTileSize));
affine::DivModValue firstCoord = affine::getDivMod(
b, loc, getValueOrCreateConstantIndexOp(b, loc, tileOffset),
getValueOrCreateConstantIndexOp(b, loc, innerTileSize));
OpFoldResult tileExclusiveBound =
ab.add(AV(dim0).bind(tileOffset), AV(dim1).bind(tileSize));
DivModValue lastCoord = getDivMod(
affine::DivModValue lastCoord = affine::getDivMod(
b, loc,
getValueOrCreateConstantIndexOp(
b, loc,
Expand Down Expand Up @@ -468,21 +468,21 @@ FailureOr<TilingResult> tensor::bubbleUpPadSlice(OpBuilder &b,
// Add two integers.
auto addMap = AffineMap::get(2, 0, {dim0 + dim1});
auto add = [&](OpFoldResult v1, OpFoldResult v2) {
return makeComposedFoldedAffineApply(b, loc, addMap, {v1, v2});
return affine::makeComposedFoldedAffineApply(b, loc, addMap, {v1, v2});
};
// Subtract two integers.
auto subMap = AffineMap::get(2, 0, {dim0 - dim1});
auto sub = [&](OpFoldResult v1, OpFoldResult v2) {
return makeComposedFoldedAffineApply(b, loc, subMap, {v1, v2});
return affine::makeComposedFoldedAffineApply(b, loc, subMap, {v1, v2});
};
// Take the minimum of two integers.
auto idMap = AffineMap::getMultiDimIdentityMap(2, b.getContext());
auto min = [&](OpFoldResult v1, OpFoldResult v2) {
return makeComposedFoldedAffineMin(b, loc, idMap, {v1, v2});
return affine::makeComposedFoldedAffineMin(b, loc, idMap, {v1, v2});
};
// Take the maximum of two integers.
auto max = [&](OpFoldResult v1, OpFoldResult v2) {
return makeComposedFoldedAffineMax(b, loc, idMap, {v1, v2});
return affine::makeComposedFoldedAffineMax(b, loc, idMap, {v1, v2});
};
// Zero index-typed integer.
OpFoldResult zero = b.getIndexAttr(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ struct PadOpInterface
AffineExpr s0, s1, s2;
bindSymbols(op->getContext(), s0, s1, s2);
AffineExpr sumExpr = s0 + s1 + s2;
Value sum = rewriter.create<AffineApplyOp>(
Value sum = rewriter.create<affine::AffineApplyOp>(
loc, sumExpr, ValueRange{srcDim, lowPad, highPad});
dynamicSizes.push_back(sum);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "llvm/ADT/STLExtras.h"

using namespace mlir;
using namespace mlir::affine;
using namespace mlir::tensor;

/// Get the dimension size of a value of RankedTensor type at the
Expand Down Expand Up @@ -61,7 +62,7 @@ static DimAndIndex invertSliceIndexing(OpBuilder &b, Location loc,
assert(dim < sliceParams.size() && "slice should be non rank-reducing");
return std::make_pair(
dim,
makeComposedAffineApply(
affine::makeComposedAffineApply(
b, loc, s0 + d0 * s1,
{indexValue,
getValueOrCreateConstantIndexOp(b, loc, sliceParams[dim].offset),
Expand Down
12 changes: 6 additions & 6 deletions mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ LogicalResult TransferReadOfExtractSliceOpFolder::matchAndRewrite(
SmallVector<Value> indices(readOp.getIndices().begin(),
readOp.getIndices().end());
SmallVector<Value> sourceIndices;
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, readOp.getLoc(), extractSliceOp.getMixedOffsets(),
extractSliceOp.getMixedStrides(), extractSliceOp.getDroppedDims(),
indices, sourceIndices);
Expand Down Expand Up @@ -132,7 +132,7 @@ LogicalResult InsertSliceOfTransferWriteOpFolder::matchAndRewrite(
SmallVector<Value> indices(writeOp.getIndices().begin(),
writeOp.getIndices().end());
SmallVector<Value> sourceIndices;
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, writeOp.getLoc(), insertSliceOp.getMixedOffsets(),
insertSliceOp.getMixedStrides(), insertSliceOp.getDroppedDims(), indices,
sourceIndices);
Expand Down Expand Up @@ -187,9 +187,9 @@ struct InsertSliceOfInsertSliceFolder : public OpRewritePattern<OpTy> {
// Note: the "insertSlice" case is symmetrical to the extract/subview case:
// `insertSliceOp` is passed as the "source" and `sourceInsertSliceOp` is
// passed as the destination to the helper function.
resolveSizesIntoOpWithSizes(insertSliceOp.getMixedSizes(),
sourceInsertSliceOp.getMixedSizes(),
droppedDims, resolvedSizes);
affine::resolveSizesIntoOpWithSizes(insertSliceOp.getMixedSizes(),
sourceInsertSliceOp.getMixedSizes(),
droppedDims, resolvedSizes);

// If we are inside an InParallel region, temporarily set the insertion
// point outside: only tensor.parallel_insert_slice ops are allowed in
Expand All @@ -204,7 +204,7 @@ struct InsertSliceOfInsertSliceFolder : public OpRewritePattern<OpTy> {
// Note: the "insertSlice" case is symmetrical to the extract/subview case:
// `insertSliceOp` is passed as the "source" and `sourceInsertSliceOp` is
// passed as the destination to the helper function.
resolveIndicesIntoOpWithOffsetsAndStrides(
affine::resolveIndicesIntoOpWithOffsetsAndStrides(
rewriter, insertSliceOp.getLoc(), insertSliceOp.getMixedOffsets(),
insertSliceOp.getMixedStrides(), droppedDims,
sourceInsertSliceOp.getMixedOffsets(), resolvedOffsets);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ struct MergeConsecutiveExtractSlice : public OpRewritePattern<ExtractSliceOp> {
return failure();

SmallVector<OpFoldResult> newOffsets, newSizes, newStrides;
if (failed(mergeOffsetsSizesAndStrides(rewriter, nextOp.getLoc(), prevOp,
nextOp, prevOp.getDroppedDims(),
newOffsets, newSizes, newStrides)))
if (failed(affine::mergeOffsetsSizesAndStrides(
rewriter, nextOp.getLoc(), prevOp, nextOp, prevOp.getDroppedDims(),
newOffsets, newSizes, newStrides)))
return failure();

rewriter.replaceOpWithNewOp<ExtractSliceOp>(nextOp, nextOp.getType(),
Expand Down
3 changes: 2 additions & 1 deletion mlir/lib/Dialect/Tensor/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ PadOp mlir::tensor::createPadHighOp(RankedTensorType type, Value source,
bindDims(b.getContext(), d0);
auto dimOp = b.createOrFold<tensor::DimOp>(loc, source, en.index());
high[en.index()] =
makeComposedAffineApply(b, loc, en.value() - d0, {dimOp}).getResult();
affine::makeComposedAffineApply(b, loc, en.value() - d0, {dimOp})
.getResult();
}
return b.create<PadOp>(loc, type, source, low, high, pad, nofold);
}
Expand Down
27 changes: 14 additions & 13 deletions mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct DistributedLoadStoreHelper {
Value buildDistributedOffset(RewriterBase &b, Location loc, int64_t index) {
int64_t distributedSize = distributedVectorType.getDimSize(index);
AffineExpr tid = getAffineSymbolExpr(0, b.getContext());
return b.createOrFold<AffineApplyOp>(loc, tid * distributedSize,
ArrayRef<Value>{laneId});
return b.createOrFold<affine::AffineApplyOp>(loc, tid * distributedSize,
ArrayRef<Value>{laneId});
}

/// Create a store during the process of distributing the
Expand Down Expand Up @@ -513,9 +513,9 @@ struct WarpOpTransferWrite : public OpRewritePattern<vector::TransferWriteOp> {
unsigned vectorPos = std::get<1>(it).cast<AffineDimExpr>().getPosition();
auto scale =
rewriter.getAffineConstantExpr(targetType.getDimSize(vectorPos));
indices[indexPos] =
makeComposedAffineApply(rewriter, loc, d0 + scale * d1,
{indices[indexPos], newWarpOp.getLaneid()});
indices[indexPos] = affine::makeComposedAffineApply(
rewriter, loc, d0 + scale * d1,
{indices[indexPos], newWarpOp.getLaneid()});
}
newWriteOp.getIndicesMutable().assign(indices);

Expand Down Expand Up @@ -753,9 +753,9 @@ struct WarpOpTransferRead : public OpRewritePattern<WarpExecuteOnLane0Op> {
unsigned vectorPos = std::get<1>(it).cast<AffineDimExpr>().getPosition();
int64_t scale =
distributedVal.getType().cast<VectorType>().getDimSize(vectorPos);
indices[indexPos] =
makeComposedAffineApply(rewriter, read.getLoc(), d0 + scale * d1,
{indices[indexPos], warpOp.getLaneid()});
indices[indexPos] = affine::makeComposedAffineApply(
rewriter, read.getLoc(), d0 + scale * d1,
{indices[indexPos], warpOp.getLaneid()});
}
Value newRead = rewriter.create<vector::TransferReadOp>(
read.getLoc(), distributedVal.getType(), read.getSource(), indices,
Expand Down Expand Up @@ -1046,15 +1046,15 @@ struct WarpOpExtractElement : public OpRewritePattern<WarpExecuteOnLane0Op> {
int64_t elementsPerLane = distributedVecType.getShape()[0];
AffineExpr sym0 = getAffineSymbolExpr(0, rewriter.getContext());
// tid of extracting thread: pos / elementsPerLane
Value broadcastFromTid = rewriter.create<AffineApplyOp>(
Value broadcastFromTid = rewriter.create<affine::AffineApplyOp>(
loc, sym0.ceilDiv(elementsPerLane), extractOp.getPosition());
// Extract at position: pos % elementsPerLane
Value pos =
elementsPerLane == 1
? rewriter.create<arith::ConstantIndexOp>(loc, 0).getResult()
: rewriter
.create<AffineApplyOp>(loc, sym0 % elementsPerLane,
extractOp.getPosition())
.create<affine::AffineApplyOp>(loc, sym0 % elementsPerLane,
extractOp.getPosition())
.getResult();
Value extracted =
rewriter.create<vector::ExtractElementOp>(loc, distributedVec, pos);
Expand Down Expand Up @@ -1119,14 +1119,15 @@ struct WarpOpInsertElement : public OpRewritePattern<WarpExecuteOnLane0Op> {
int64_t elementsPerLane = distrType.getShape()[0];
AffineExpr sym0 = getAffineSymbolExpr(0, rewriter.getContext());
// tid of extracting thread: pos / elementsPerLane
Value insertingLane = rewriter.create<AffineApplyOp>(
Value insertingLane = rewriter.create<affine::AffineApplyOp>(
loc, sym0.ceilDiv(elementsPerLane), newPos);
// Insert position: pos % elementsPerLane
Value pos =
elementsPerLane == 1
? rewriter.create<arith::ConstantIndexOp>(loc, 0).getResult()
: rewriter
.create<AffineApplyOp>(loc, sym0 % elementsPerLane, newPos)
.create<affine::AffineApplyOp>(loc, sym0 % elementsPerLane,
newPos)
.getResult();
Value isInsertingLane = rewriter.create<arith::CmpIOp>(
loc, arith::CmpIPredicate::eq, newWarpOp.getLaneid(), insertingLane);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ class RewriteScalarExtractElementOfTransferRead
if (extractOp.getPosition()) {
AffineExpr sym0, sym1;
bindSymbols(extractOp.getContext(), sym0, sym1);
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, extractOp.getLoc(), sym0 + sym1,
{newIndices[newIndices.size() - 1], extractOp.getPosition()});
if (ofr.is<Value>()) {
Expand Down Expand Up @@ -663,7 +663,7 @@ class RewriteScalarExtractOfTransferRead
int64_t offset = it.value().cast<IntegerAttr>().getInt();
int64_t idx =
newIndices.size() - extractOp.getPosition().size() + it.index();
OpFoldResult ofr = makeComposedFoldedAffineApply(
OpFoldResult ofr = affine::makeComposedFoldedAffineApply(
rewriter, extractOp.getLoc(),
rewriter.getAffineSymbolExpr(0) + offset, {newIndices[idx]});
if (ofr.is<Value>()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ using namespace mlir::vector;
static std::optional<int64_t> extractConstantIndex(Value v) {
if (auto cstOp = v.getDefiningOp<arith::ConstantIndexOp>())
return cstOp.value();
if (auto affineApplyOp = v.getDefiningOp<AffineApplyOp>())
if (auto affineApplyOp = v.getDefiningOp<affine::AffineApplyOp>())
if (affineApplyOp.getAffineMap().isSingleConstant())
return affineApplyOp.getAffineMap().getSingleConstantResult();
return std::nullopt;
Expand Down Expand Up @@ -76,8 +76,8 @@ static Value createInBoundsCond(RewriterBase &b,
int64_t vectorSize = xferOp.getVectorType().getDimSize(resultIdx);
auto d0 = getAffineDimExpr(0, xferOp.getContext());
auto vs = getAffineConstantExpr(vectorSize, xferOp.getContext());
Value sum =
makeComposedAffineApply(b, loc, d0 + vs, xferOp.indices()[indicesIdx]);
Value sum = affine::makeComposedAffineApply(b, loc, d0 + vs,
xferOp.indices()[indicesIdx]);
Value cond = createFoldedSLE(
b, sum, vector::createOrFoldDimOp(b, loc, xferOp.source(), indicesIdx));
if (!cond)
Expand Down Expand Up @@ -208,7 +208,7 @@ createSubViewIntersection(RewriterBase &b, VectorTransferOpInterface xferOp,
SmallVector<AffineMap, 4> maps =
AffineMap::inferFromExprList(MapList{{i - j, k}});
// affine_min(%dimMemRef - %index, %dimAlloc)
Value affineMin = b.create<AffineMinOp>(
Value affineMin = b.create<affine::AffineMinOp>(
loc, index.getType(), maps[0], ValueRange{dimMemRef, index, dimAlloc});
sizes.push_back(affineMin);
});
Expand Down Expand Up @@ -449,7 +449,7 @@ static Operation *getAutomaticAllocationScope(Operation *op) {
parent = parent->getParentOp()) {
if (parent->hasTrait<OpTrait::AutomaticAllocationScope>())
scope = parent;
if (!isa<scf::ForOp, AffineForOp>(parent))
if (!isa<scf::ForOp, affine::AffineForOp>(parent))
break;
}
assert(scope && "Expected op to be inside automatic allocation scope");
Expand Down
3 changes: 2 additions & 1 deletion mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ static SmallVector<Value> sliceTransferIndices(ArrayRef<int64_t> elementOffsets,
auto expr = getAffineDimExpr(0, builder.getContext()) +
getAffineConstantExpr(elementOffsets[dim.index()], ctx);
auto map = AffineMap::get(/*dimCount=*/1, /*symbolCount=*/0, expr);
slicedIndices[pos] = builder.create<AffineApplyOp>(loc, map, indices[pos]);
slicedIndices[pos] =
builder.create<affine::AffineApplyOp>(loc, map, indices[pos]);
}
return slicedIndices;
}
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ static AffineMap makePermutationMap(

for (auto kvp : enclosingLoopToVectorDim) {
assert(kvp.second < perm.size());
auto invariants = getInvariantAccesses(
cast<AffineForOp>(kvp.first).getInductionVar(), indices);
auto invariants = affine::getInvariantAccesses(
cast<affine::AffineForOp>(kvp.first).getInductionVar(), indices);
unsigned numIndices = indices.size();
unsigned countInvariantIndices = 0;
for (unsigned dim = 0; dim < numIndices; ++dim) {
Expand Down Expand Up @@ -119,7 +119,7 @@ static SetVector<Operation *> getParentsOfType(Block *block) {

/// Returns the enclosing AffineForOp, from closest to farthest.
static SetVector<Operation *> getEnclosingforOps(Block *block) {
return getParentsOfType<AffineForOp>(block);
return getParentsOfType<affine::AffineForOp>(block);
}

AffineMap mlir::makePermutationMap(
Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Analysis/TestMemRefBoundCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define DEBUG_TYPE "memref-bound-check"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Analysis/TestMemRefDependenceCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define DEBUG_TYPE "test-memref-dependence-check"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define PASS_NAME "test-affine-data-copy"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"

using namespace mlir;
using namespace mlir::affine;

#define DEBUG_TYPE "test-affine-parametric-tile"

Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define PASS_NAME "test-affine-loop-unswitch"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Dialect/Affine/TestDecomposeAffineOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define PASS_NAME "test-decompose-affine-ops"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
18 changes: 10 additions & 8 deletions mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define DEBUG_TYPE "test-loop-fusion"

using namespace mlir;
using namespace mlir::affine;

static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");

Expand Down Expand Up @@ -60,10 +61,10 @@ struct TestLoopFusion
static bool testDependenceCheck(AffineForOp srcForOp, AffineForOp dstForOp,
unsigned i, unsigned j, unsigned loopDepth,
unsigned maxLoopDepth) {
mlir::ComputationSliceState sliceUnion;
affine::ComputationSliceState sliceUnion;
for (unsigned d = loopDepth + 1; d <= maxLoopDepth; ++d) {
FusionResult result =
mlir::canFuseLoops(srcForOp, dstForOp, d, &sliceUnion);
affine::canFuseLoops(srcForOp, dstForOp, d, &sliceUnion);
if (result.value == FusionResult::FailBlockDependence) {
srcForOp->emitRemark("block-level dependence preventing"
" fusion of loop nest ")
Expand All @@ -85,7 +86,8 @@ static unsigned getBlockIndex(Operation &op) {
}

// Returns a string representation of 'sliceUnion'.
static std::string getSliceStr(const mlir::ComputationSliceState &sliceUnion) {
static std::string
getSliceStr(const affine::ComputationSliceState &sliceUnion) {
std::string result;
llvm::raw_string_ostream os(result);
// Slice insertion point format [loop-depth, operation-block-index]
Expand Down Expand Up @@ -114,8 +116,8 @@ static bool testSliceComputation(AffineForOp forOpA, AffineForOp forOpB,
unsigned i, unsigned j, unsigned loopDepth,
unsigned maxLoopDepth) {
for (unsigned d = loopDepth + 1; d <= maxLoopDepth; ++d) {
mlir::ComputationSliceState sliceUnion;
FusionResult result = mlir::canFuseLoops(forOpA, forOpB, d, &sliceUnion);
affine::ComputationSliceState sliceUnion;
FusionResult result = affine::canFuseLoops(forOpA, forOpB, d, &sliceUnion);
if (result.value == FusionResult::Success) {
forOpB->emitRemark("slice (")
<< " src loop: " << i << ", dst loop: " << j << ", depth: " << d
Expand All @@ -137,10 +139,10 @@ static bool testLoopFusionTransformation(AffineForOp forOpA, AffineForOp forOpB,
unsigned loopDepth,
unsigned maxLoopDepth) {
for (unsigned d = loopDepth + 1; d <= maxLoopDepth; ++d) {
mlir::ComputationSliceState sliceUnion;
FusionResult result = mlir::canFuseLoops(forOpA, forOpB, d, &sliceUnion);
affine::ComputationSliceState sliceUnion;
FusionResult result = affine::canFuseLoops(forOpA, forOpB, d, &sliceUnion);
if (result.value == FusionResult::Success) {
mlir::fuseLoops(forOpA, forOpB, sliceUnion);
affine::fuseLoops(forOpA, forOpB, sliceUnion);
// Note: 'forOpA' is removed to simplify test output. A proper loop
// fusion pass should check the data dependence graph and run memref
// region analysis to ensure removing 'forOpA' is safe.
Expand Down
3 changes: 2 additions & 1 deletion mlir/test/lib/Dialect/Affine/TestLoopMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "mlir/Pass/Pass.h"

using namespace mlir;
using namespace mlir::affine;

namespace {
struct TestLoopMappingPass
Expand All @@ -33,7 +34,7 @@ struct TestLoopMappingPass
explicit TestLoopMappingPass() = default;

void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<AffineDialect, scf::SCFDialect>();
registry.insert<affine::AffineDialect, scf::SCFDialect>();
}

void runOnOperation() override {
Expand Down
1 change: 1 addition & 0 deletions mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define PASS_NAME "test-loop-permutation"

using namespace mlir;
using namespace mlir::affine;

namespace {

Expand Down
5 changes: 3 additions & 2 deletions mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define PASS_NAME "test-affine-reify-value-bounds"

using namespace mlir;
using namespace mlir::affine;
using mlir::presburger::BoundType;

namespace {
Expand All @@ -36,8 +37,8 @@ struct TestReifyValueBounds
TestReifyValueBounds(const TestReifyValueBounds &pass) : PassWrapper(pass){};

void getDependentDialects(DialectRegistry &registry) const override {
registry
.insert<AffineDialect, tensor::TensorDialect, memref::MemRefDialect>();
registry.insert<affine::AffineDialect, tensor::TensorDialect,
memref::MemRefDialect>();
}

void runOnOperation() override;
Expand Down
9 changes: 5 additions & 4 deletions mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define DEBUG_TYPE "affine-super-vectorizer-test"

using namespace mlir;
using namespace mlir::affine;

static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");

Expand Down Expand Up @@ -99,7 +100,7 @@ struct VectorizerTestPass

void VectorizerTestPass::testVectorShapeRatio(llvm::raw_ostream &outs) {
auto f = getOperation();
using matcher::Op;
using affine::matcher::Op;
SmallVector<int64_t, 8> shape(clTestVectorShapeRatio.begin(),
clTestVectorShapeRatio.end());
auto subVectorType =
Expand All @@ -109,7 +110,7 @@ void VectorizerTestPass::testVectorShapeRatio(llvm::raw_ostream &outs) {
auto filter = [&](Operation &op) {
assert(subVectorType.getElementType().isF32() &&
"Only f32 supported for now");
if (!matcher::operatesOnSuperVectorsOf(op, subVectorType)) {
if (!mlir::matcher::operatesOnSuperVectorsOf(op, subVectorType)) {
return false;
}
if (op.getNumResults() != 1) {
Expand Down Expand Up @@ -139,7 +140,7 @@ void VectorizerTestPass::testVectorShapeRatio(llvm::raw_ostream &outs) {
}

static NestedPattern patternTestSlicingOps() {
using matcher::Op;
using affine::matcher::Op;
// Match all operations with the kTestSlicingOpName name.
auto filter = [](Operation &op) {
// Just use a custom op name for this test, it makes life easier.
Expand Down Expand Up @@ -202,7 +203,7 @@ static bool customOpWithAffineMapAttribute(Operation &op) {
void VectorizerTestPass::testComposeMaps(llvm::raw_ostream &outs) {
auto f = getOperation();

using matcher::Op;
using affine::matcher::Op;
auto pattern = Op(customOpWithAffineMapAttribute);
SmallVector<NestedMatch, 8> matches;
pattern.match(f, &matches);
Expand Down
3 changes: 2 additions & 1 deletion mlir/test/lib/Dialect/GPU/TestGpuMemoryPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ struct TestGpuMemoryPromotionPass
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestGpuMemoryPromotionPass)

void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<AffineDialect, memref::MemRefDialect, scf::SCFDialect>();
registry.insert<affine::AffineDialect, memref::MemRefDialect,
scf::SCFDialect>();
}
StringRef getArgument() const final { return "test-gpu-memory-promotion"; }
StringRef getDescription() const final {
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Linalg/TestDataLayoutPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ struct TestDataLayoutPropagationPass
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestDataLayoutPropagationPass)

void getDependentDialects(DialectRegistry &registry) const override {
registry
.insert<AffineDialect, linalg::LinalgDialect, tensor::TensorDialect>();
registry.insert<affine::AffineDialect, linalg::LinalgDialect,
tensor::TensorDialect>();
}

StringRef getArgument() const final {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/lib/Dialect/Linalg/TestLinalgDecomposeOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct TestLinalgDecomposeOps
TestLinalgDecomposeOps(const TestLinalgDecomposeOps &pass)
: PassWrapper(pass){};
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<AffineDialect, linalg::LinalgDialect>();
registry.insert<affine::AffineDialect, linalg::LinalgDialect>();
}
StringRef getArgument() const final { return "test-linalg-decompose-ops"; }
StringRef getDescription() const final {
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Linalg/TestLinalgElementwiseFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ struct TestLinalgElementwiseFusion
TestLinalgElementwiseFusion(const TestLinalgElementwiseFusion &pass)
: PassWrapper(pass) {}
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<AffineDialect, linalg::LinalgDialect, memref::MemRefDialect,
tensor::TensorDialect>();
registry.insert<affine::AffineDialect, linalg::LinalgDialect,
memref::MemRefDialect, tensor::TensorDialect>();
}
StringRef getArgument() const final {
return "test-linalg-elementwise-fusion-patterns";
Expand Down
Loading