#include "mlir/IR/AffineMap.h"
#include "AffineMapDetail.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <numeric>
#include <optional>
#include <type_traits>
usingnamespacemlir;
divideCeilSigned;
divideFloorSigned;
mod;
namespace {
class AffineExprConstantFolder { … };
}
AffineMap AffineMap::getConstantMap(int64_t val, MLIRContext *context) { … }
AffineMap AffineMap::getMinorIdentityMap(unsigned dims, unsigned results,
MLIRContext *context) { … }
AffineMap AffineMap::getFilteredIdentityMap(
MLIRContext *ctx, unsigned numDims,
llvm::function_ref<bool(AffineDimExpr)> keepDimFilter) { … }
bool AffineMap::isMinorIdentity() const { … }
SmallVector<unsigned> AffineMap::getBroadcastDims() const { … }
bool AffineMap::isMinorIdentityWithBroadcasting(
SmallVectorImpl<unsigned> *broadcastedDims) const { … }
bool AffineMap::isPermutationOfMinorIdentityWithBroadcasting(
SmallVectorImpl<unsigned> &permutedDims) const { … }
AffineMap AffineMap::getPermutationMap(ArrayRef<unsigned> permutation,
MLIRContext *context) { … }
AffineMap AffineMap::getPermutationMap(ArrayRef<int64_t> permutation,
MLIRContext *context) { … }
AffineMap AffineMap::getMultiDimMapWithTargets(unsigned numDims,
ArrayRef<unsigned> targets,
MLIRContext *context) { … }
template <typename AffineExprContainer>
static SmallVector<AffineMap, 4>
inferFromExprList(ArrayRef<AffineExprContainer> exprsList,
MLIRContext *context) { … }
SmallVector<AffineMap, 4>
AffineMap::inferFromExprList(ArrayRef<ArrayRef<AffineExpr>> exprsList,
MLIRContext *context) { … }
SmallVector<AffineMap, 4>
AffineMap::inferFromExprList(ArrayRef<SmallVector<AffineExpr, 4>> exprsList,
MLIRContext *context) { … }
uint64_t AffineMap::getLargestKnownDivisorOfMapExprs() { … }
AffineMap AffineMap::getMultiDimIdentityMap(unsigned numDims,
MLIRContext *context) { … }
MLIRContext *AffineMap::getContext() const { … }
bool AffineMap::isIdentity() const { … }
bool AffineMap::isSymbolIdentity() const { … }
bool AffineMap::isEmpty() const { … }
bool AffineMap::isSingleConstant() const { … }
bool AffineMap::isConstant() const { … }
int64_t AffineMap::getSingleConstantResult() const { … }
SmallVector<int64_t> AffineMap::getConstantResults() const { … }
unsigned AffineMap::getNumDims() const { … }
unsigned AffineMap::getNumSymbols() const { … }
unsigned AffineMap::getNumResults() const { … }
unsigned AffineMap::getNumInputs() const { … }
ArrayRef<AffineExpr> AffineMap::getResults() const { … }
AffineExpr AffineMap::getResult(unsigned idx) const { … }
unsigned AffineMap::getDimPosition(unsigned idx) const { … }
std::optional<unsigned> AffineMap::getResultPosition(AffineExpr input) const { … }
LogicalResult AffineMap::constantFold(ArrayRef<Attribute> operandConstants,
SmallVectorImpl<Attribute> &results,
bool *hasPoison) const { … }
AffineMap AffineMap::partialConstantFold(ArrayRef<Attribute> operandConstants,
SmallVectorImpl<int64_t> *results,
bool *hasPoison) const { … }
void AffineMap::walkExprs(llvm::function_ref<void(AffineExpr)> callback) const { … }
AffineMap AffineMap::replaceDimsAndSymbols(ArrayRef<AffineExpr> dimReplacements,
ArrayRef<AffineExpr> symReplacements,
unsigned numResultDims,
unsigned numResultSyms) const { … }
AffineMap AffineMap::replace(AffineExpr expr, AffineExpr replacement,
unsigned numResultDims,
unsigned numResultSyms) const { … }
AffineMap AffineMap::replace(const DenseMap<AffineExpr, AffineExpr> &map,
unsigned numResultDims,
unsigned numResultSyms) const { … }
AffineMap
AffineMap::replace(const DenseMap<AffineExpr, AffineExpr> &map) const { … }
AffineMap AffineMap::dropResults(const llvm::SmallBitVector &positions) const { … }
AffineMap AffineMap::compose(AffineMap map) const { … }
SmallVector<int64_t, 4> AffineMap::compose(ArrayRef<int64_t> values) const { … }
bool AffineMap::isProjectedPermutation(bool allowZeroInResults) const { … }
bool AffineMap::isPermutation() const { … }
AffineMap AffineMap::getSubMap(ArrayRef<unsigned> resultPos) const { … }
AffineMap AffineMap::getSliceMap(unsigned start, unsigned length) const { … }
AffineMap AffineMap::getMajorSubMap(unsigned numResults) const { … }
AffineMap AffineMap::getMinorSubMap(unsigned numResults) const { … }
static SmallVector<AffineMap> compressUnusedListImpl(
ArrayRef<AffineMap> maps,
llvm::function_ref<AffineMap(AffineMap)> compressionFun) { … }
AffineMap mlir::compressDims(AffineMap map,
const llvm::SmallBitVector &unusedDims) { … }
AffineMap mlir::compressUnusedDims(AffineMap map) { … }
SmallVector<AffineMap> mlir::compressUnusedDims(ArrayRef<AffineMap> maps) { … }
AffineMap mlir::compressSymbols(AffineMap map,
const llvm::SmallBitVector &unusedSymbols) { … }
AffineMap mlir::compressUnusedSymbols(AffineMap map) { … }
SmallVector<AffineMap> mlir::compressUnusedSymbols(ArrayRef<AffineMap> maps) { … }
AffineMap mlir::foldAttributesIntoMap(Builder &b, AffineMap map,
ArrayRef<OpFoldResult> operands,
SmallVector<Value> &remainingValues) { … }
AffineMap mlir::simplifyAffineMap(AffineMap map) { … }
AffineMap mlir::removeDuplicateExprs(AffineMap map) { … }
AffineMap mlir::inversePermutation(AffineMap map) { … }
AffineMap mlir::inverseAndBroadcastProjectedPermutation(AffineMap map) { … }
AffineMap mlir::concatAffineMaps(ArrayRef<AffineMap> maps) { … }
template <typename AffineDimOrSymExpr>
static AffineMap projectCommonImpl(AffineMap map,
const llvm::SmallBitVector &toProject,
bool compress) { … }
AffineMap mlir::projectDims(AffineMap map,
const llvm::SmallBitVector &projectedDimensions,
bool compressDimsFlag) { … }
AffineMap mlir::projectSymbols(AffineMap map,
const llvm::SmallBitVector &projectedSymbols,
bool compressSymbolsFlag) { … }
AffineMap mlir::getProjectedMap(AffineMap map,
const llvm::SmallBitVector &projectedDimensions,
bool compressDimsFlag,
bool compressSymbolsFlag) { … }
llvm::SmallBitVector mlir::getUnusedDimsBitVector(ArrayRef<AffineMap> maps) { … }
llvm::SmallBitVector mlir::getUnusedSymbolsBitVector(ArrayRef<AffineMap> maps) { … }
AffineMap
mlir::expandDimsToRank(AffineMap map, int64_t rank,
const llvm::SmallBitVector &projectedDimensions) { … }
MutableAffineMap::MutableAffineMap(AffineMap map)
: … { … }
void MutableAffineMap::reset(AffineMap map) { … }
bool MutableAffineMap::isMultipleOf(unsigned idx, int64_t factor) const { … }
void MutableAffineMap::simplify() { … }
AffineMap MutableAffineMap::getAffineMap() const { … }