|
MLIR 22.0.0git
|
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"#include <cassert>#include <cstdint>#include <functional>#include <optional>#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Arith/Utils/Utils.h"#include "mlir/Dialect/MemRef/IR/MemRef.h"#include "mlir/Dialect/SCF/IR/SCF.h"#include "mlir/Dialect/Utils/IndexingUtils.h"#include "mlir/Dialect/Utils/StructuredOpsUtils.h"#include "mlir/Dialect/Vector/IR/VectorOps.h"#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"#include "mlir/Dialect/Vector/Utils/VectorUtils.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/Location.h"#include "mlir/IR/Matchers.h"#include "mlir/IR/PatternMatch.h"#include "mlir/IR/TypeUtilities.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Support/FormatVariadic.h"#include "mlir/Dialect/Vector/Transforms/VectorTransformsEnums.cpp.inc"Go to the source code of this file.
Classes | |
| class | DropInnerMostUnitDimsTransferRead |
| Drop inner most contiguous unit dimensions from transfer_read operand. More... | |
| class | DropInnerMostUnitDimsTransferWrite |
| Drop inner most contiguous unit dimensions from transfer_write operand. E.g., vector.transfer_write arg1, arg0[c0, arg2, c0, c0, c0] {in_bounds = [true, true, true, true, true]} : vector<1x16x16x1x1xf32>, memref<1x512x16x1x1xf32> More... | |
| struct | CanonicalizeContractMatmulToMMT |
| Canonicalization of a vector.contraction a, b, c with row-major matmul semantics to a contraction suitable for MMT (matrix matrix multiplication with the RHS transposed) lowering. More... | |
| struct | FoldArithExtIntoContractionOp< ExtOp > |
| Pattern to fold arithmetic extensions on floating point data types into vector contraction operations. linalg.matmul introduces arithmetic extensions on its operands. Please mlir snippets below for more details. More... | |
| struct | ChainedReduction |
| Pattern to fold chained reduction to a series of vector additions and a final reduction. This form should require fewer subgroup operations. More... | |
| struct | DropUnitDimFromElementwiseOps |
| For vectors with at least one unit dim, replaces: elementwise(a, b) with: sc_a = shape_cast(a) sc_b = shape_cast(b) res = elementwise(sc_a, sc_b) return shape_cast(res) The newly inserted shape_cast Ops fold (before elementwise Op) and then restore (after elementwise Op) the unit dim. Vectors a and b are required to be rank > 1. More... | |
| struct | DropUnitDimsFromTransposeOp |
| A pattern to drop unit dims from vector.transpose. More... | |
| struct | DropUnitDimsFromScfForOp |
| A pattern to drop unit dims from the iter_args of an scf.for. More... | |
| struct | ReduceRedundantZero |
| Pattern to eliminate redundant zero-constants added to reduction operands. It's enough for there to be one initial zero value, so we can eliminate the extra ones that feed into vector.reduction <add>. These get created by the ChainedReduction pattern. More... | |
| struct | BreakDownVectorReduction |
| Example: More... | |
Macros | |
| #define | DEBUG_TYPE "vector-to-vector" |
Functions | |
| template<typename IntType> | |
| static SmallVector< IntType > | extractVector (ArrayAttr arrayAttr) |
| static std::optional< int64_t > | getResultIndex (AffineMap map, int64_t index) |
| static FailureOr< size_t > | getTransferFoldableInnerUnitDims (MemRefType srcType, VectorType vectorType) |
| Returns the number of dims can be folded away from transfer ops. It returns a failure if it can not determine the number of dims to be folded. | |
| static VectorType | dropNonScalableUnitDimFromType (VectorType inVecTy) |
Variables | |
| *B * | Example |
| Fold mulf(tr(broadcast(A)), broadcast(B)) into `vector.outerproduct(A,. | |
| *B | rhsBcast |
| *B | rhs |
| *B vector< 4xi32 > **Supports only to broadcasts The following cases are not supported * | ex1 |
| #define DEBUG_TYPE "vector-to-vector" |
Definition at line 38 of file VectorTransforms.cpp.
|
static |
Definition at line 1914 of file VectorTransforms.cpp.
Referenced by DropUnitDimFromElementwiseOps::matchAndRewrite(), DropUnitDimsFromScfForOp::matchAndRewrite(), and DropUnitDimsFromTransposeOp::matchAndRewrite().
|
static |
Definition at line 44 of file VectorTransforms.cpp.
References ArrayAttr().
Definition at line 51 of file VectorTransforms.cpp.
References mlir::AffineMap::getDimPosition(), and mlir::AffineMap::getNumResults().
|
static |
Returns the number of dims can be folded away from transfer ops. It returns a failure if it can not determine the number of dims to be folded.
Ex 1: returns "2" if srcType is memref<512x16x1x1xf32> and vectorType is vector<16x16x1x1xf32> (there two inner most dims can be dropped by memref.subview ops)
Ex 2: returns "1" if srcType is memref<512x16x1x1xf32> with [8192, 16, 8, 1] strides and vectorType is vector<16x16x1x1xf32> (only the inner most unit dim of srcType can be dropped)
Ex 3: return "0" if srcType is memref<512x16x1x1xf32> and vectorType is vector<16x16x1x[1]xf32> (the most inner dim in vectorType is not a unit dim (it's a "scalable unit")
Definition at line 1526 of file VectorTransforms.cpp.
References result.
| * B vector<4xi32>* * Supports only to broadcasts The following cases are not supported* ex1 |
Definition at line 2250 of file VectorTransforms.cpp.
| * B* Example |
Fold mulf(tr(broadcast(A)), broadcast(B)) into `vector.outerproduct(A,.
Definition at line 2239 of file VectorTransforms.cpp.
| * B rhs |
Definition at line 2247 of file VectorTransforms.cpp.
Referenced by mlir::ArithBuilder::_and(), mlir::affine::AffineBuilder::add(), mlir::ArithBuilder::add(), mlir::sparse_tensor::ir_detail::VarSet::add(), mlir::FlatLinearValueConstraints::addBound(), mlir::xegpu::addElementwise(), addIntegerAttrs(), mlir::SimpleAffineExprFlattener::addLocalIdSemiAffine(), mlir::xegpu::addWithRightAligned(), mlir::AliasAnalysis::alias(), mlir::detail::AliasAnalysisTraits::Concept::alias(), mlir::detail::AliasAnalysisTraits::Model< ImplT >::alias(), mlir::LocalAliasAnalysis::alias(), mlir::LocalAliasAnalysis::aliasImpl(), mlir::arith::applyCmpPredicate(), mlir::arith::applyCmpPredicate(), mlir::PatternApplicator::applyCostModel(), applyToIntegerAttrs(), binaryFolder(), mlir::sparse_tensor::Merger::buildLattices(), MmaSyncBuilder::buildMmaSync(), canonicalizeMapExprAndTermOrder(), mlir::affine::AffineBuilder::ceil(), checkDistinctObjects(), mlir::sparse_tensor::detail::checkedMul(), checkOperandAffineExprRecursively(), mlir::func::impl::DuplicateFunctionEliminationPassBase< DerivedT >::clonePass(), mlir::OptionValue< mlir::OpPassManager >::compare(), mlir::OptionValue< mlir::OpPassManager >::compare(), mlir::ValueBoundsConstraintSet::compare(), compareIndices(), mlir::OperationName::compareOpProperties(), comparePosDepth(), mlir::OperationName::UnregisteredOpModel::compareProperties(), mlir::RegisteredOperationName::Model< ConcreteOp >::compareProperties(), composedAffineMultiply(), concatArrayAttr(), mlir::constFoldBinaryOpConditional(), mlir::OperationName::copyOpProperties(), mlir::DynamicOpDefinition::copyProperties(), mlir::Operation::copyProperties(), mlir::OperationName::UnregisteredOpModel::copyProperties(), mlir::RegisteredOperationName::Model< ConcreteOp >::copyProperties(), mlir::func::createDuplicateFunctionEliminationPass(), mlir::AsmParser::CyclicParseReset::CyclicParseReset(), mlir::AsmPrinter::CyclicPrintReset::CyclicPrintReset(), mlir::DefaultTimingManager::DefaultTimingManager(), mlir::DefaultTimingManager::DefaultTimingManager(), DEFINE_C_API_STRUCT(), deriveStaticUpperBound(), dominanceSort(), mlir::detail::ElementsAttrIndexer::ElementsAttrIndexer(), mlir::detail::ElementsAttrIndexer::ElementsAttrIndexer(), mlir::shard::Sharding::equalHaloAndShardSizes(), mlir::shard::Sharding::equalHaloSizes(), equalIterationSpaces(), mlir::shard::Sharding::equalShardSizes(), mlir::shard::Sharding::equalSplitAxes(), mlir::intrange::evaluatePred(), mlir::OperationEquivalence::exactValueMatch(), findDepIdxSet(), mlir::affine::AffineBuilder::floor(), foldBinaryOpChecked(), foldBinaryOpUnchecked(), foldDivMul(), mlir::sparse_tensor::foreachInSparseConstant(), mlir::pdl_to_pdl_interp::MatcherNode::generateMatcherTree(), mlir::ReductionNode::generateNewVariants(), mlir::quant::detail::AnyQuantizedTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::CalibratedQuantizedTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedPerAxisTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedSubChannelTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedTypeStorage::KeyTy::genericIsEqual(), genInsertionStore(), genStmt(), genTensorStore(), mlir::getAffineBinaryOpExpr(), mlir::getAffineConstantExprs(), getAffineExprOfType(), mlir::arith::impl::ArithIntRangeOptsBase< DerivedT >::getArgumentName(), mlir::vector::getConstantVscaleMultiplier(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getDependentDialects(), mlir::func::impl::DuplicateFunctionEliminationPassBase< DerivedT >::getDependentDialects(), mlir::AffineExpr::getLargestKnownDivisor(), mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::getLatticeElement(), mlir::MLIRContext::getLoadedDialects(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getName(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getPassName(), mlir::arith::getReductionOp(), mlir::MLIRContext::getRegisteredOperationsByDialect(), mlir::AffineBinaryOpExpr::getRHS(), getSemiAffineExprFromFlatForm(), mlir::vector::ScalableValueBoundsConstraintSet::ConstantOrScalableBound::getSize(), groupByDialectPerByte(), hasSizeMismatch(), idivCheck(), mlir::OperationEquivalence::ignoreValueEquivalence(), mlir::intrange::inferAdd(), mlir::intrange::inferCeilDivS(), mlir::intrange::inferCeilDivU(), mlir::intrange::inferDivS(), inferDivSRange(), mlir::intrange::inferDivU(), inferDivURange(), mlir::intrange::inferFloorDivS(), mlir::intrange::inferMaxS(), mlir::intrange::inferMaxU(), mlir::intrange::inferMinS(), mlir::intrange::inferMinU(), mlir::intrange::inferMul(), mlir::intrange::inferRemS(), mlir::intrange::inferRemU(), mlir::intrange::inferShl(), mlir::intrange::inferShrS(), mlir::intrange::inferShrU(), mlir::intrange::inferSub(), mlir::intrange::inferXor(), mlir::InFlightDiagnostic::InFlightDiagnostic(), mlir::pdll::ast::InFlightDiagnostic::InFlightDiagnostic(), inplaceAdd(), mlir::tblgen::Interface::Interface(), mlir::bytecode::detail::IRNumberingState::IRNumberingState(), mlir::linalg::isDimTimesConstantOrDimOnly(), llvm::DenseMapInfo< mlir::AsmDialectResourceHandle >::isEqual(), llvm::DenseMapInfo< mlir::Block::iterator >::isEqual(), llvm::DenseMapInfo< mlir::NamedAttribute >::isEqual(), llvm::DenseMapInfo< mlir::OperationName >::isEqual(), llvm::DenseMapInfo< mlir::PassInstrumentation::PipelineParentInfo >::isEqual(), llvm::DenseMapInfo< mlir::pdll::ast::Type >::isEqual(), llvm::DenseMapInfo< mlir::ProgramPoint >::isEqual(), llvm::DenseMapInfo< mlir::remark::detail::Remark >::isEqual(), llvm::DenseMapInfo< mlir::SuccessorRange >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::Constraint >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::DagLeaf >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::DagNode >::isEqual(), llvm::DenseMapInfo< mlir::TypeID >::isEqual(), llvm::DenseMapInfo< mlir::TypeRange >::isEqual(), llvm::DenseMapInfo< mlir::Value >::isEqual(), llvm::DenseMapInfo< MlirTypeID >::isEqual(), llvm::DenseMapInfo< T, std::enable_if_t< mlir::detail::IsInterface< T >::value > >::isEqual(), llvm::DenseMapInfo< T, std::enable_if_t< std::is_base_of< mlir::OpState, T >::value &&!mlir::detail::IsInterface< T >::value > >::isEqual(), mlir::DataFlowSolver::isEquivalent(), mlir::OperationEquivalence::isEquivalentTo(), mlir::OperationEquivalence::isEquivalentTo(), mlir::OperationEquivalence::isRegionEquivalentTo(), mlir::OperationEquivalence::isRegionEquivalentTo(), isStaticallyTrue(), mlir::DialectRegistry::isSubsetOf(), mlir::dataflow::AbstractDenseForwardDataFlowAnalysis::join(), mlir::dataflow::AbstractDenseLattice::join(), mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::join(), mlir::dataflow::AbstractSparseLattice::join(), mlir::dataflow::ConstantValue::join(), mlir::dataflow::Lattice< ValueT >::join(), mlir::dataflow::Lattice< ValueT >::join(), mlir::IntegerValueRange::join(), mlir::StridedMetadataRange::join(), mlir::tosa::ValueKnowledge::join(), mlir::affine::loopUnrollJamByFactor(), makeAtomicReductionGen(), makeReductionGen(), makeVectorShapes(), CanonicalizeContractMatmulToMMT::matchAndRewrite(), CmpFIntToFPConst::matchAndRewrite(), FoldAddIntoDest::matchAndRewrite(), IAddCarryFold::matchAndRewrite(), MulExtendedFold< spirv::SMulExtendedOp, true >::matchAndRewrite(), UMulExtendedOpXOne::matchAndRewrite(), materializeBinaryNanCheckIfRequired(), mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::meet(), mlir::dataflow::AbstractDenseLattice::meet(), mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::meet(), mlir::dataflow::AbstractSparseLattice::meet(), mlir::dataflow::Lattice< ValueT >::meet(), mlir::dataflow::Lattice< ValueT >::meet(), mlir::tosa::ValueKnowledge::meet(), mlir::affine::MemRefAccess::MemRefAccess(), mlir::detail::OpPassManagerImpl::mergeInto(), minMaxBy(), mlirAffineAddExprGet(), mlirAffineCeilDivExprGet(), mlirAffineExprEqual(), mlirAffineFloorDivExprGet(), mlirAffineModExprGet(), mlirAffineMulExprGet(), mlirModuleEqual(), mlir::affine::AffineBuilder::mul(), mlir::ArithBuilder::mul(), mulIntegerAttrs(), mlir::affine::MemRefAccess::operator!=(), mlir::Location::operator!=(), mlir::ModRefResult::operator!=(), mlir::NamedAttribute::operator!=(), mlir::OperationName::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::PatternBenefit::operator!=(), mlir::Region::OpIterator::operator!=(), mlir::RegionSuccessor::operator!=, mlir::ResultRange::UseIterator::operator!=(), mlir::shard::Sharding::operator!=(), mlir::shard::Sharding::operator!=(), mlir::WalkResult::operator!=(), mlir::operator&(), mlir::bufferization::ValueComparator::operator()(), mlir::AffineExpr::operator*(), operator*(), mlir::detail::ElementsAttrIterator< T >::operator-(), operator/(), mlir::detail::ElementsAttrIterator< T >::operator<(), mlir::detail::ParallelDiagnosticHandlerImpl::ThreadDiagnostic::operator<(), mlir::NamedAttribute::operator<(), mlir::NamedAttribute::operator<(), mlir::PatternBenefit::operator<(), mlir::spirv::StructType::MemberDecorationInfo::operator<, mlir::spirv::StructType::StructDecorationInfo::operator<, mlir::PatternBenefit::operator<=(), mlir::AsmParser::CyclicParseReset::operator=(), mlir::AsmPrinter::CyclicPrintReset::operator=(), mlir::AsmResourceBlob::operator=(), mlir::DefaultTimingManager::operator=(), mlir::detail::InterfaceMap::operator=(), mlir::NamedAttrList::operator=(), mlir::OpPassManager::operator=(), mlir::OpPassManager::operator=(), mlir::OptionValue< mlir::OpPassManager >::operator=(), mlir::affine::MemRefAccess::operator==(), mlir::dataflow::ConstantValue::operator==(), mlir::detail::ElementsAttrIterator< T >::operator==(), mlir::IntegerValueRange::operator==(), mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::iterator::operator==(), mlir::Location::operator==(), mlir::ModRefResult::operator==(), mlir::NamedAttribute::operator==(), mlir::OperationName::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::PatternBenefit::operator==(), mlir::Region::OpIterator::operator==(), mlir::RegionBranchPoint::operator==, mlir::RegionSuccessor::operator==(), mlir::ResultRange::UseIterator::operator==(), mlir::shard::Sharding::operator==(), mlir::shard::Sharding::operator==(), mlir::spirv::StructType::MemberDecorationInfo::operator==, mlir::spirv::StructType::StructDecorationInfo::operator==, mlir::tosa::TosaLevel::operator==(), mlir::tosa::ValueKnowledge::operator==(), mlir::ValueUseIterator< OpOperand >::operator==(), mlir::WalkResult::operator==(), mlir::PatternBenefit::operator>(), mlir::PatternBenefit::operator>=(), mlir::operator|(), operator|(), mlir::operator|=(), operator|=(), mlir::OpPassManager::OpPassManager(), mlir::OpPassManager::OpPassManager(), mlir::detail::OpPassManagerImpl::OpPassManagerImpl(), mlir::OptionValue< mlir::OpPassManager >::OptionValue(), mlir::detail::OpToOpPassAdaptor::OpToOpPassAdaptor(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::OuterProductFusionBase(), mlir::OpAsmParser::parseAssignmentList(), parseCmpOp(), mlir::OpAsmParser::parseOptionalAssignmentList(), mlir::ValueBoundsConstraintSet::populateAndCompare(), mlir::tracing::DebugCounter::print(), mlir::AsmPrinter::Impl::printAffineExprInternal(), mlir::TranslationParser::printOptionInfo(), mlir::printRegisteredPasses(), printResultsAsList(), mlir::AffineExpr::replace(), mlir::AffineExpr::replaceDimsAndSymbols(), mlir::ArithBuilder::select(), mlir::OperationName::setImpl(), mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::setToEntryState(), mlir::ArithBuilder::sgt(), mlir::shard::Sharding::Sharding(), shortenAddChainsContainingAll(), simplifyCeilDiv(), simplifyExprAndOperands(), simplifyFloorDiv(), simplifyMod(), simplifyMul(), mlir::ArithBuilder::slt(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::sortInPlace(), sortMapByName(), streq(), strne(), mlir::ValueBoundsConstraintSet::strongCompare(), mlir::affine::AffineBuilder::sub(), mlir::ArithBuilder::sub(), subIntegerAttrs(), mlir::tblgen::MethodParameters::subsumes(), mlir::detail::OpToOpPassAdaptor::tryMergeInto(), mlir::sparse_tensor::ir_detail::DimLvlExpr::unpackBinop(), mlir::SimpleAffineExprFlattener::visitAddExpr(), mlir::SimpleAffineExprFlattener::visitModExpr(), mlir::SimpleAffineExprFlattener::visitMulExpr(), mlir::LocalAliasAnalysis::~LocalAliasAnalysis(), mlir::OpPassManager::~OpPassManager(), and mlir::SimpleAffineExprFlattener::~SimpleAffineExprFlattener().
| * B rhsBcast |
Definition at line 2243 of file VectorTransforms.cpp.