#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Interfaces/VectorInterfaces.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include <numeric>
#include <optional>
#define DEBUG_TYPE …
#define DBGS() …
#define LDBG(X) …
usingnamespacemlir;
usingnamespacemlir::vector;
static SmallVector<Value> sliceTransferIndices(ArrayRef<int64_t> elementOffsets,
ArrayRef<Value> indices,
AffineMap permutationMap,
Location loc,
OpBuilder &builder) { … }
static Operation *cloneOpWithOperandsAndTypes(OpBuilder &builder, Location loc,
Operation *op,
ArrayRef<Value> operands,
ArrayRef<Type> resultTypes) { … }
static std::optional<SmallVector<int64_t>>
getTargetShape(const vector::UnrollVectorOptions &options, Operation *op) { … }
static SmallVector<int64_t>
getUnrollOrder(unsigned numLoops, Operation *op,
const vector::UnrollVectorOptions &options) { … }
namespace {
struct UnrollTransferReadPattern
: public OpRewritePattern<vector::TransferReadOp> { … };
struct UnrollTransferWritePattern
: public OpRewritePattern<vector::TransferWriteOp> { … };
struct OffsetMapInfo { … };
struct UnrollContractionPattern
: public OpRewritePattern<vector::ContractionOp> { … };
struct UnrollMultiReductionPattern
: public OpRewritePattern<vector::MultiDimReductionOp> { … };
struct UnrollElementwisePattern : public RewritePattern { … };
struct UnrollReductionPattern : public OpRewritePattern<vector::ReductionOp> { … };
struct UnrollTransposePattern : public OpRewritePattern<vector::TransposeOp> { … };
struct UnrollGatherPattern : public OpRewritePattern<vector::GatherOp> { … };
}
void mlir::vector::populateVectorUnrollPatterns(
RewritePatternSet &patterns, const UnrollVectorOptions &options,
PatternBenefit benefit) { … }