forked from OSchip/llvm-project
[mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis
The current state of the top level Analysis/ directory is that it contains two libraries; a generic Analysis library (free from dialect dependencies), and a LoopAnalysis library that contains various analysis utilities that originated from Affine loop transformations. This commit moves the LoopAnalysis to the more appropriate home of `Dialect/Affine/Analysis/`, given the use and intention of the majority of the code within it. After the move, if there are generic utilities that would fit better in the top-level Analysis/ directory, we can move them. Differential Revision: https://reviews.llvm.org/D117351
This commit is contained in:
parent
8f4a6187f2
commit
755dc07d69
|
@ -17,7 +17,7 @@
|
|||
#include "llvm/ADT/SetVector.h"
|
||||
|
||||
namespace mlir {
|
||||
|
||||
class BlockArgument;
|
||||
class Operation;
|
||||
class Value;
|
||||
|
||||
|
@ -205,6 +205,37 @@ getSlice(Operation *op,
|
|||
/// Returns a topologically sorted SetVector.
|
||||
SetVector<Operation *> topologicalSort(const SetVector<Operation *> &toSort);
|
||||
|
||||
/// Utility to match a generic reduction given a list of iteration-carried
|
||||
/// arguments, `iterCarriedArgs` and the position of the potential reduction
|
||||
/// argument within the list, `redPos`. If a reduction is matched, returns the
|
||||
/// reduced value and the topologically-sorted list of combiner operations
|
||||
/// involved in the reduction. Otherwise, returns a null value.
|
||||
///
|
||||
/// The matching algorithm relies on the following invariants, which are subject
|
||||
/// to change:
|
||||
/// 1. The first combiner operation must be a binary operation with the
|
||||
/// iteration-carried value and the reduced value as operands.
|
||||
/// 2. The iteration-carried value and combiner operations must be side
|
||||
/// effect-free, have single result and a single use.
|
||||
/// 3. Combiner operations must be immediately nested in the region op
|
||||
/// performing the reduction.
|
||||
/// 4. Reduction def-use chain must end in a terminator op that yields the
|
||||
/// next iteration/output values in the same order as the iteration-carried
|
||||
/// values in `iterCarriedArgs`.
|
||||
/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
|
||||
/// of the region op performing the reduction.
|
||||
///
|
||||
/// This utility is generic enough to detect reductions involving multiple
|
||||
/// combiner operations (disabled for now) across multiple dialects, including
|
||||
/// Linalg, Affine and SCF. For the sake of genericity, it does not return
|
||||
/// specific enum values for the combiner operations since its goal is also
|
||||
/// matching reductions without pre-defined semantics in core MLIR. It's up to
|
||||
/// each client to make sense out of the list of combiner operations. It's also
|
||||
/// up to each client to check for additional invariants on the expected
|
||||
/// reductions not covered by this generic matching.
|
||||
Value matchReduction(ArrayRef<BlockArgument> iterCarriedArgs, unsigned redPos,
|
||||
SmallVectorImpl<Operation *> &combinerOps);
|
||||
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_ANALYSIS_SLICEANALYSIS_H_
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_ANALYSIS_AFFINEANALYSIS_H
|
||||
#define MLIR_ANALYSIS_AFFINEANALYSIS_H
|
||||
#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
|
||||
#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
|
||||
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
|
@ -185,4 +185,4 @@ void getDependenceComponents(
|
|||
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_ANALYSIS_AFFINEANALYSIS_H
|
||||
#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
|
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_ANALYSIS_AFFINESTRUCTURES_H
|
||||
#define MLIR_ANALYSIS_AFFINESTRUCTURES_H
|
||||
#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
|
||||
#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
|
||||
|
||||
#include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
|
||||
#include "mlir/Analysis/Presburger/Matrix.h"
|
||||
|
@ -694,4 +694,4 @@ LogicalResult getRelationFromMap(const AffineValueMap &map,
|
|||
|
||||
} // namespace mlir.
|
||||
|
||||
#endif // MLIR_ANALYSIS_AFFINESTRUCTURES_H
|
||||
#endif // MLIR_DIALECT_AFFINE_ANALYSIS_AFFINESTRUCTURES_H
|
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_ANALYSIS_LOOPANALYSIS_H
|
||||
#define MLIR_ANALYSIS_LOOPANALYSIS_H
|
||||
#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
|
||||
#define MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
|
||||
|
||||
#include "mlir/Support/LLVM.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
|
@ -83,36 +83,6 @@ bool isVectorizableLoopBody(AffineForOp loop, int *memRefDim,
|
|||
// the support.
|
||||
bool isOpwiseShiftValid(AffineForOp forOp, ArrayRef<uint64_t> shifts);
|
||||
|
||||
/// Utility to match a generic reduction given a list of iteration-carried
|
||||
/// arguments, `iterCarriedArgs` and the position of the potential reduction
|
||||
/// argument within the list, `redPos`. If a reduction is matched, returns the
|
||||
/// reduced value and the topologically-sorted list of combiner operations
|
||||
/// involved in the reduction. Otherwise, returns a null value.
|
||||
///
|
||||
/// The matching algorithm relies on the following invariants, which are subject
|
||||
/// to change:
|
||||
/// 1. The first combiner operation must be a binary operation with the
|
||||
/// iteration-carried value and the reduced value as operands.
|
||||
/// 2. The iteration-carried value and combiner operations must be side
|
||||
/// effect-free, have single result and a single use.
|
||||
/// 3. Combiner operations must be immediately nested in the region op
|
||||
/// performing the reduction.
|
||||
/// 4. Reduction def-use chain must end in a terminator op that yields the
|
||||
/// next iteration/output values in the same order as the iteration-carried
|
||||
/// values in `iterCarriedArgs`.
|
||||
/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
|
||||
/// of the region op performing the reduction.
|
||||
///
|
||||
/// This utility is generic enough to detect reductions involving multiple
|
||||
/// combiner operations (disabled for now) across multiple dialects, including
|
||||
/// Linalg, Affine and SCF. For the sake of genericity, it does not return
|
||||
/// specific enum values for the combiner operations since its goal is also
|
||||
/// matching reductions without pre-defined semantics in core MLIR. It's up to
|
||||
/// each client to make sense out of the list of combiner operations. It's also
|
||||
/// up to each client to check for additional invariants on the expected
|
||||
/// reductions not covered by this generic matching.
|
||||
Value matchReduction(ArrayRef<BlockArgument> iterCarriedArgs, unsigned redPos,
|
||||
SmallVectorImpl<Operation *> &combinerOps);
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_ANALYSIS_LOOPANALYSIS_H
|
||||
#endif // MLIR_DIALECT_AFFINE_ANALYSIS_LOOPANALYSIS_H
|
|
@ -6,8 +6,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_ANALYSIS_NESTEDMATCHER_H
|
||||
#define MLIR_ANALYSIS_NESTEDMATCHER_H
|
||||
#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
|
||||
#define MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
|
||||
|
||||
#include "mlir/IR/BuiltinOps.h"
|
||||
#include "mlir/IR/Operation.h"
|
||||
|
@ -198,4 +198,4 @@ bool isLoadOrStore(Operation &op);
|
|||
} // namespace matcher
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_ANALYSIS_NESTEDMATCHER_H
|
||||
#endif // MLIR_DIALECT_AFFINE_ANALYSIS_NESTEDMATCHER_H
|
|
@ -13,10 +13,10 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef MLIR_ANALYSIS_UTILS_H
|
||||
#define MLIR_ANALYSIS_UTILS_H
|
||||
#ifndef MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
|
||||
#define MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
|
||||
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/IR/AffineMap.h"
|
||||
#include "mlir/IR/Block.h"
|
||||
#include "mlir/IR/Location.h"
|
||||
|
@ -382,4 +382,4 @@ unsigned getInnermostCommonLoopDepth(
|
|||
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_ANALYSIS_UTILS_H
|
||||
#endif // MLIR_DIALECT_AFFINE_ANALYSIS_UTILS_H
|
|
@ -13,7 +13,7 @@
|
|||
#ifndef MLIR_DIALECT_AFFINE_UTILS_H
|
||||
#define MLIR_DIALECT_AFFINE_UTILS_H
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
|
||||
namespace mlir {
|
||||
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
set(LLVM_OPTIONAL_SOURCES
|
||||
AliasAnalysis.cpp
|
||||
AffineAnalysis.cpp
|
||||
AffineStructures.cpp
|
||||
BufferViewFlowAnalysis.cpp
|
||||
CallGraph.cpp
|
||||
DataFlowAnalysis.cpp
|
||||
DataLayoutAnalysis.cpp
|
||||
Liveness.cpp
|
||||
LoopAnalysis.cpp
|
||||
NestedMatcher.cpp
|
||||
SliceAnalysis.cpp
|
||||
Utils.cpp
|
||||
|
||||
AliasAnalysis/LocalAliasAnalysis.cpp
|
||||
)
|
||||
|
@ -41,27 +36,4 @@ add_mlir_library(MLIRAnalysis
|
|||
MLIRViewLikeInterface
|
||||
)
|
||||
|
||||
add_mlir_library(MLIRLoopAnalysis
|
||||
AffineAnalysis.cpp
|
||||
AffineStructures.cpp
|
||||
LoopAnalysis.cpp
|
||||
NestedMatcher.cpp
|
||||
Utils.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
|
||||
|
||||
DEPENDS
|
||||
mlir-headers
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRAffine
|
||||
MLIRAnalysis
|
||||
MLIRCallInterfaces
|
||||
MLIRControlFlowInterfaces
|
||||
MLIRInferTypeOpInterface
|
||||
MLIRPresburger
|
||||
MLIRSCF
|
||||
)
|
||||
|
||||
add_subdirectory(Presburger)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mlir/IR/Operation.h"
|
||||
#include "mlir/Support/LLVM.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
|
||||
///
|
||||
/// Implements Analysis functions specific to slicing in Function.
|
||||
|
@ -212,3 +213,105 @@ mlir::topologicalSort(const SetVector<Operation *> &toSort) {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Returns true if `value` (transitively) depends on iteration-carried values
|
||||
/// of the given `ancestorOp`.
|
||||
static bool dependsOnCarriedVals(Value value,
|
||||
ArrayRef<BlockArgument> iterCarriedArgs,
|
||||
Operation *ancestorOp) {
|
||||
// Compute the backward slice of the value.
|
||||
SetVector<Operation *> slice;
|
||||
getBackwardSlice(value, &slice,
|
||||
[&](Operation *op) { return !ancestorOp->isAncestor(op); });
|
||||
|
||||
// Check that none of the operands of the operations in the backward slice are
|
||||
// loop iteration arguments, and neither is the value itself.
|
||||
SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
|
||||
iterCarriedArgs.end());
|
||||
if (iterCarriedValSet.contains(value))
|
||||
return true;
|
||||
|
||||
for (Operation *op : slice)
|
||||
for (Value operand : op->getOperands())
|
||||
if (iterCarriedValSet.contains(operand))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Utility to match a generic reduction given a list of iteration-carried
|
||||
/// arguments, `iterCarriedArgs` and the position of the potential reduction
|
||||
/// argument within the list, `redPos`. If a reduction is matched, returns the
|
||||
/// reduced value and the topologically-sorted list of combiner operations
|
||||
/// involved in the reduction. Otherwise, returns a null value.
|
||||
///
|
||||
/// The matching algorithm relies on the following invariants, which are subject
|
||||
/// to change:
|
||||
/// 1. The first combiner operation must be a binary operation with the
|
||||
/// iteration-carried value and the reduced value as operands.
|
||||
/// 2. The iteration-carried value and combiner operations must be side
|
||||
/// effect-free, have single result and a single use.
|
||||
/// 3. Combiner operations must be immediately nested in the region op
|
||||
/// performing the reduction.
|
||||
/// 4. Reduction def-use chain must end in a terminator op that yields the
|
||||
/// next iteration/output values in the same order as the iteration-carried
|
||||
/// values in `iterCarriedArgs`.
|
||||
/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
|
||||
/// of the region op performing the reduction.
|
||||
///
|
||||
/// This utility is generic enough to detect reductions involving multiple
|
||||
/// combiner operations (disabled for now) across multiple dialects, including
|
||||
/// Linalg, Affine and SCF. For the sake of genericity, it does not return
|
||||
/// specific enum values for the combiner operations since its goal is also
|
||||
/// matching reductions without pre-defined semantics in core MLIR. It's up to
|
||||
/// each client to make sense out of the list of combiner operations. It's also
|
||||
/// up to each client to check for additional invariants on the expected
|
||||
/// reductions not covered by this generic matching.
|
||||
Value mlir::matchReduction(ArrayRef<BlockArgument> iterCarriedArgs,
|
||||
unsigned redPos,
|
||||
SmallVectorImpl<Operation *> &combinerOps) {
|
||||
assert(redPos < iterCarriedArgs.size() && "'redPos' is out of bounds");
|
||||
|
||||
BlockArgument redCarriedVal = iterCarriedArgs[redPos];
|
||||
if (!redCarriedVal.hasOneUse())
|
||||
return nullptr;
|
||||
|
||||
// For now, the first combiner op must be a binary op.
|
||||
Operation *combinerOp = *redCarriedVal.getUsers().begin();
|
||||
if (combinerOp->getNumOperands() != 2)
|
||||
return nullptr;
|
||||
Value reducedVal = combinerOp->getOperand(0) == redCarriedVal
|
||||
? combinerOp->getOperand(1)
|
||||
: combinerOp->getOperand(0);
|
||||
|
||||
Operation *redRegionOp =
|
||||
iterCarriedArgs.front().getOwner()->getParent()->getParentOp();
|
||||
if (dependsOnCarriedVals(reducedVal, iterCarriedArgs, redRegionOp))
|
||||
return nullptr;
|
||||
|
||||
// Traverse the def-use chain starting from the first combiner op until a
|
||||
// terminator is found. Gather all the combiner ops along the way in
|
||||
// topological order.
|
||||
while (!combinerOp->mightHaveTrait<OpTrait::IsTerminator>()) {
|
||||
if (!MemoryEffectOpInterface::hasNoEffect(combinerOp) ||
|
||||
combinerOp->getNumResults() != 1 || !combinerOp->hasOneUse() ||
|
||||
combinerOp->getParentOp() != redRegionOp)
|
||||
return nullptr;
|
||||
|
||||
combinerOps.push_back(combinerOp);
|
||||
combinerOp = *combinerOp->getUsers().begin();
|
||||
}
|
||||
|
||||
// Limit matching to single combiner op until we can properly test reductions
|
||||
// involving multiple combiners.
|
||||
if (combinerOps.size() != 1)
|
||||
return nullptr;
|
||||
|
||||
// Check that the yielded value is in the same position as in
|
||||
// `iterCarriedArgs`.
|
||||
Operation *terminatorOp = combinerOp;
|
||||
if (terminatorOp->getOperand(redPos) != combinerOps.back()->getResults()[0])
|
||||
return nullptr;
|
||||
|
||||
return reducedVal;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
#include "mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"
|
||||
#include "../PassDetail.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
||||
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/Presburger/LinearTransform.h"
|
||||
#include "mlir/Analysis/Presburger/Simplex.h"
|
||||
#include "mlir/Analysis/Presburger/Utils.h"
|
|
@ -0,0 +1,22 @@
|
|||
add_mlir_dialect_library(MLIRAffineAnalysis
|
||||
AffineAnalysis.cpp
|
||||
AffineStructures.cpp
|
||||
LoopAnalysis.cpp
|
||||
NestedMatcher.cpp
|
||||
Utils.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Affine
|
||||
|
||||
DEPENDS
|
||||
mlir-headers
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRAffine
|
||||
MLIRAnalysis
|
||||
MLIRCallInterfaces
|
||||
MLIRControlFlowInterfaces
|
||||
MLIRInferTypeOpInterface
|
||||
MLIRPresburger
|
||||
MLIRSCF
|
||||
)
|
|
@ -10,12 +10,12 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Support/MathExtras.h"
|
||||
|
@ -381,105 +381,3 @@ bool mlir::isOpwiseShiftValid(AffineForOp forOp, ArrayRef<uint64_t> shifts) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns true if `value` (transitively) depends on iteration-carried values
|
||||
/// of the given `ancestorOp`.
|
||||
static bool dependsOnCarriedVals(Value value,
|
||||
ArrayRef<BlockArgument> iterCarriedArgs,
|
||||
Operation *ancestorOp) {
|
||||
// Compute the backward slice of the value.
|
||||
SetVector<Operation *> slice;
|
||||
getBackwardSlice(value, &slice,
|
||||
[&](Operation *op) { return !ancestorOp->isAncestor(op); });
|
||||
|
||||
// Check that none of the operands of the operations in the backward slice are
|
||||
// loop iteration arguments, and neither is the value itself.
|
||||
SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
|
||||
iterCarriedArgs.end());
|
||||
if (iterCarriedValSet.contains(value))
|
||||
return true;
|
||||
|
||||
for (Operation *op : slice)
|
||||
for (Value operand : op->getOperands())
|
||||
if (iterCarriedValSet.contains(operand))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Utility to match a generic reduction given a list of iteration-carried
|
||||
/// arguments, `iterCarriedArgs` and the position of the potential reduction
|
||||
/// argument within the list, `redPos`. If a reduction is matched, returns the
|
||||
/// reduced value and the topologically-sorted list of combiner operations
|
||||
/// involved in the reduction. Otherwise, returns a null value.
|
||||
///
|
||||
/// The matching algorithm relies on the following invariants, which are subject
|
||||
/// to change:
|
||||
/// 1. The first combiner operation must be a binary operation with the
|
||||
/// iteration-carried value and the reduced value as operands.
|
||||
/// 2. The iteration-carried value and combiner operations must be side
|
||||
/// effect-free, have single result and a single use.
|
||||
/// 3. Combiner operations must be immediately nested in the region op
|
||||
/// performing the reduction.
|
||||
/// 4. Reduction def-use chain must end in a terminator op that yields the
|
||||
/// next iteration/output values in the same order as the iteration-carried
|
||||
/// values in `iterCarriedArgs`.
|
||||
/// 5. `iterCarriedArgs` must contain all the iteration-carried/output values
|
||||
/// of the region op performing the reduction.
|
||||
///
|
||||
/// This utility is generic enough to detect reductions involving multiple
|
||||
/// combiner operations (disabled for now) across multiple dialects, including
|
||||
/// Linalg, Affine and SCF. For the sake of genericity, it does not return
|
||||
/// specific enum values for the combiner operations since its goal is also
|
||||
/// matching reductions without pre-defined semantics in core MLIR. It's up to
|
||||
/// each client to make sense out of the list of combiner operations. It's also
|
||||
/// up to each client to check for additional invariants on the expected
|
||||
/// reductions not covered by this generic matching.
|
||||
Value mlir::matchReduction(ArrayRef<BlockArgument> iterCarriedArgs,
|
||||
unsigned redPos,
|
||||
SmallVectorImpl<Operation *> &combinerOps) {
|
||||
assert(redPos < iterCarriedArgs.size() && "'redPos' is out of bounds");
|
||||
|
||||
BlockArgument redCarriedVal = iterCarriedArgs[redPos];
|
||||
if (!redCarriedVal.hasOneUse())
|
||||
return nullptr;
|
||||
|
||||
// For now, the first combiner op must be a binary op.
|
||||
Operation *combinerOp = *redCarriedVal.getUsers().begin();
|
||||
if (combinerOp->getNumOperands() != 2)
|
||||
return nullptr;
|
||||
Value reducedVal = combinerOp->getOperand(0) == redCarriedVal
|
||||
? combinerOp->getOperand(1)
|
||||
: combinerOp->getOperand(0);
|
||||
|
||||
Operation *redRegionOp =
|
||||
iterCarriedArgs.front().getOwner()->getParent()->getParentOp();
|
||||
if (dependsOnCarriedVals(reducedVal, iterCarriedArgs, redRegionOp))
|
||||
return nullptr;
|
||||
|
||||
// Traverse the def-use chain starting from the first combiner op until a
|
||||
// terminator is found. Gather all the combiner ops along the way in
|
||||
// topological order.
|
||||
while (!combinerOp->mightHaveTrait<OpTrait::IsTerminator>()) {
|
||||
if (!MemoryEffectOpInterface::hasNoEffect(combinerOp) ||
|
||||
combinerOp->getNumResults() != 1 || !combinerOp->hasOneUse() ||
|
||||
combinerOp->getParentOp() != redRegionOp)
|
||||
return nullptr;
|
||||
|
||||
combinerOps.push_back(combinerOp);
|
||||
combinerOp = *combinerOp->getUsers().begin();
|
||||
}
|
||||
|
||||
// Limit matching to single combiner op until we can properly test reductions
|
||||
// involving multiple combiners.
|
||||
if (combinerOps.size() != 1)
|
||||
return nullptr;
|
||||
|
||||
// Check that the yielded value is in the same position as in
|
||||
// `iterCarriedArgs`.
|
||||
Operation *terminatorOp = combinerOp;
|
||||
if (terminatorOp->getOperand(redPos) != combinerOps.back()->getResults()[0])
|
||||
return nullptr;
|
||||
|
||||
return reducedVal;
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "mlir/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
|
|
@ -11,10 +11,10 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Analysis/Presburger/PresburgerSet.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
|
@ -1,3 +1,4 @@
|
|||
add_subdirectory(Analysis)
|
||||
add_subdirectory(IR)
|
||||
add_subdirectory(Transforms)
|
||||
add_subdirectory(Utils)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Passes.h"
|
||||
#include "mlir/IR/IntegerSet.h"
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Utils.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "mlir/Dialect/Affine/Utils.h"
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
|
|
|
@ -5,10 +5,10 @@ add_mlir_dialect_library(MLIRLinalgAnalysis
|
|||
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRAffineAnalysis
|
||||
MLIRAnalysis
|
||||
MLIRIR
|
||||
MLIRLinalg
|
||||
MLIRLoopAnalysis
|
||||
MLIRMemRef
|
||||
MLIRStandard
|
||||
)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Affine/Utils.h"
|
||||
#include "mlir/Dialect/Linalg/IR/Linalg.h"
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
|
||||
#include "mlir/Dialect/Linalg/IR/Linalg.h"
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
#include "mlir/Dialect/Linalg/Utils/Utils.h"
|
||||
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/SCF/AffineCanonicalizationUtils.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/SCF/SCF.h"
|
||||
#include "mlir/Dialect/Utils/StaticValueUtils.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/SCF/AffineCanonicalizationUtils.h"
|
||||
|
|
|
@ -27,7 +27,7 @@ add_mlir_dialect_library(MLIRVector
|
|||
MLIRLinalg
|
||||
MLIRMemRef
|
||||
MLIRSCF
|
||||
MLIRLoopAnalysis
|
||||
MLIRAffineAnalysis
|
||||
MLIRDataLayoutInterfaces
|
||||
MLIRSideEffectInterfaces
|
||||
MLIRVectorInterfaces
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/Vector/VectorUtils.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include "PassDetail.h"
|
||||
#include "mlir/Transforms/Passes.h"
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
#include "mlir/Dialect/StandardOps/Utils/Utils.h"
|
||||
|
|
|
@ -18,7 +18,7 @@ add_mlir_library(MLIRTransformUtils
|
|||
MLIRAffine
|
||||
MLIRArithmetic
|
||||
MLIRAnalysis
|
||||
MLIRLoopAnalysis
|
||||
MLIRAffineAnalysis
|
||||
MLIRMemRef
|
||||
MLIRSCF
|
||||
MLIRPass
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
#include "mlir/Transforms/LoopFusionUtils.h"
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
#include "mlir/IR/AffineMap.h"
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
#include "mlir/Transforms/LoopUtils.h"
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Transforms/Utils.h"
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/LoopAnalysis.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
||||
using namespace mlir;
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Utils.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "mlir/Transforms/LoopUtils.h"
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Analysis/SliceAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/Affine/Utils.h"
|
||||
#include "mlir/Dialect/Vector/VectorOps.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/Utils.h"
|
||||
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
||||
#include "mlir/Dialect/StandardOps/IR/Ops.h"
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
|
|
@ -29,7 +29,7 @@ set(LIBS
|
|||
${dialect_libs}
|
||||
${conversion_libs}
|
||||
${test_libs}
|
||||
MLIRLoopAnalysis
|
||||
MLIRAffineAnalysis
|
||||
MLIRAnalysis
|
||||
MLIRDialect
|
||||
MLIRLspServerLib
|
||||
|
|
|
@ -37,7 +37,7 @@ set(LIBS
|
|||
${dialect_libs}
|
||||
${conversion_libs}
|
||||
${test_libs}
|
||||
MLIRLoopAnalysis
|
||||
MLIRAffineAnalysis
|
||||
MLIRAnalysis
|
||||
MLIRDialect
|
||||
MLIROptLib
|
||||
|
|
|
@ -1,12 +1 @@
|
|||
add_mlir_unittest(MLIRAnalysisTests
|
||||
AffineStructuresParser.cpp
|
||||
AffineStructuresParserTest.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(MLIRAnalysisTests
|
||||
PRIVATE
|
||||
MLIRLoopAnalysis
|
||||
MLIRParser
|
||||
)
|
||||
|
||||
add_subdirectory(Presburger)
|
||||
|
|
|
@ -4,11 +4,11 @@ add_mlir_unittest(MLIRPresburgerTests
|
|||
MatrixTest.cpp
|
||||
PresburgerSetTest.cpp
|
||||
SimplexTest.cpp
|
||||
../AffineStructuresParser.cpp
|
||||
../../Dialect/Affine/Analysis/AffineStructuresParser.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(MLIRPresburgerTests
|
||||
PRIVATE MLIRPresburger
|
||||
MLIRLoopAnalysis
|
||||
MLIRAffineAnalysis
|
||||
MLIRParser
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
|
||||
#include "../AffineStructuresParser.h"
|
||||
#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
|
||||
#include "mlir/IR/MLIRContext.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Presburger/PresburgerSet.h"
|
||||
#include "../AffineStructuresParser.h"
|
||||
#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Analysis/Presburger/Simplex.h"
|
||||
#include "../AffineStructuresParser.h"
|
||||
#include "../../Dialect/Affine/Analysis/AffineStructuresParser.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#ifndef MLIR_UNITTEST_ANALYSIS_AFFINESTRUCTURESPARSER_H
|
||||
#define MLIR_UNITTEST_ANALYSIS_AFFINESTRUCTURESPARSER_H
|
||||
|
||||
#include "mlir/Analysis/AffineStructures.h"
|
||||
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
|
||||
#include "mlir/Support/LogicalResult.h"
|
||||
|
||||
namespace mlir {
|
|
@ -0,0 +1,10 @@
|
|||
add_mlir_unittest(MLIRAffineAnalysisTests
|
||||
AffineStructuresParser.cpp
|
||||
AffineStructuresParserTest.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(MLIRAffineAnalysisTests
|
||||
PRIVATE
|
||||
MLIRAffineAnalysis
|
||||
MLIRParser
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(Analysis)
|
|
@ -6,6 +6,7 @@ target_link_libraries(MLIRDialectTests
|
|||
MLIRIR
|
||||
MLIRDialect)
|
||||
|
||||
add_subdirectory(Affine)
|
||||
add_subdirectory(Quant)
|
||||
add_subdirectory(SparseTensor)
|
||||
add_subdirectory(SPIRV)
|
||||
|
|
Loading…
Reference in New Issue