summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Analysis
diff options
context:
space:
mode:
authorNicolas Vasilache <ntv@google.com>2019-11-20 10:54:45 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-20 11:49:36 -0800
commitfa14d4f6ab2ec069e43314a1769d21f374ccb4bd (patch)
tree242c890b2347ebb3d6981d9534c804399ceb0698 /mlir/lib/Analysis
parenteb418559ef29716cc34c891c93490c38ac5ea1dd (diff)
downloadbcm5719-llvm-fa14d4f6ab2ec069e43314a1769d21f374ccb4bd.tar.gz
bcm5719-llvm-fa14d4f6ab2ec069e43314a1769d21f374ccb4bd.zip
Implement unrolling of vector ops to finer-grained vector ops as a pattern.
This CL uses the pattern rewrite infrastructure to implement a simple VectorOps -> VectorOps legalization strategy to unroll coarse-grained vector operations into finer grained ones. The transformation is written using local pattern rewrites to allow composition with other rewrites. It proceeds by iteratively introducing fake cast ops and cleaning canonicalizing or lowering them away where appropriate. This is an example of writing transformations as compositions of local pattern rewrites that should enable us to make them significantly more declarative. PiperOrigin-RevId: 281555100
Diffstat (limited to 'mlir/lib/Analysis')
-rw-r--r--mlir/lib/Analysis/VectorAnalysis.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/mlir/lib/Analysis/VectorAnalysis.cpp b/mlir/lib/Analysis/VectorAnalysis.cpp
index 2dab3481e56..1c028b4f347 100644
--- a/mlir/lib/Analysis/VectorAnalysis.cpp
+++ b/mlir/lib/Analysis/VectorAnalysis.cpp
@@ -39,15 +39,15 @@ using namespace mlir;
using llvm::SetVector;
-Optional<SmallVector<unsigned, 4>>
-mlir::shapeRatio(ArrayRef<int64_t> superShape, ArrayRef<int64_t> subShape) {
+Optional<SmallVector<int64_t, 4>> mlir::shapeRatio(ArrayRef<int64_t> superShape,
+ ArrayRef<int64_t> subShape) {
if (superShape.size() < subShape.size()) {
- return Optional<SmallVector<unsigned, 4>>();
+ return Optional<SmallVector<int64_t, 4>>();
}
// Starting from the end, compute the integer divisors.
// Set the boolean `divides` if integral division is not possible.
- std::vector<unsigned> result;
+ std::vector<int64_t> result;
result.reserve(superShape.size());
bool divides = true;
auto divide = [&divides, &result](int superSize, int subSize) {
@@ -76,11 +76,11 @@ mlir::shapeRatio(ArrayRef<int64_t> superShape, ArrayRef<int64_t> subShape) {
"super to sub shape ratio is not of the same size as the super rank");
// Reverse again to get it back in the proper order and return.
- return SmallVector<unsigned, 4>{result.rbegin(), result.rend()};
+ return SmallVector<int64_t, 4>{result.rbegin(), result.rend()};
}
-Optional<SmallVector<unsigned, 4>> mlir::shapeRatio(VectorType superVectorType,
- VectorType subVectorType) {
+Optional<SmallVector<int64_t, 4>> mlir::shapeRatio(VectorType superVectorType,
+ VectorType subVectorType) {
assert(superVectorType.getElementType() == subVectorType.getElementType() &&
"vector types must be of the same elemental type");
return shapeRatio(superVectorType.getShape(), subVectorType.getShape());
OpenPOWER on IntegriCloud