summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
diff options
context:
space:
mode:
authorJean-Michel Gorius <jean-michel.gorius@ens-rennes.fr>2019-11-22 07:52:02 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-22 08:24:49 -0800
commit104777d8e6cd66b8817822836eaa4019d2a46210 (patch)
treed3b79528d0503f64e4771ffb86ac4143a0a5786a /mlir/lib/Transforms
parentf7906c921134166ff65aeb491597347e73a65d27 (diff)
downloadbcm5719-llvm-104777d8e6cd66b8817822836eaa4019d2a46210.tar.gz
bcm5719-llvm-104777d8e6cd66b8817822836eaa4019d2a46210.zip
Unify vector op names with other dialects.
Change vector op names from VectorFooOp to Vector_FooOp and from vector::VectorFooOp to vector::FooOp. Closes tensorflow/mlir#257 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/257 from Kayjukh:master dfc3a0e04114885aaec8740d5951d6984d6e1577 PiperOrigin-RevId: 281967461
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r--mlir/lib/Transforms/MaterializeVectors.cpp31
-rw-r--r--mlir/lib/Transforms/Vectorize.cpp8
2 files changed, 19 insertions, 20 deletions
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp
index 3034b71cc5f..874eac6e4e6 100644
--- a/mlir/lib/Transforms/MaterializeVectors.cpp
+++ b/mlir/lib/Transforms/MaterializeVectors.cpp
@@ -146,8 +146,8 @@ using llvm::dbgs;
using llvm::SetVector;
using namespace mlir;
-using vector::VectorTransferReadOp;
-using vector::VectorTransferWriteOp;
+using vector::TransferReadOp;
+using vector::TransferWriteOp;
using functional::makePtrDynCaster;
using functional::map;
@@ -408,9 +408,9 @@ materializeAttributes(Operation *opInst, VectorType hwVectorType) {
static Operation *instantiate(OpBuilder b, Operation *opInst,
VectorType hwVectorType,
DenseMap<Value *, Value *> *substitutionsMap) {
- assert(!isa<VectorTransferReadOp>(opInst) &&
+ assert(!isa<TransferReadOp>(opInst) &&
"Should call the function specialized for VectorTransferReadOp");
- assert(!isa<VectorTransferWriteOp>(opInst) &&
+ assert(!isa<TransferWriteOp>(opInst) &&
"Should call the function specialized for VectorTransferWriteOp");
if (opInst->getNumRegions() != 0)
return nullptr;
@@ -443,10 +443,9 @@ static Operation *instantiate(OpBuilder b, Operation *opInst,
template <typename VectorTransferOpTy>
static AffineMap projectedPermutationMap(VectorTransferOpTy transfer,
VectorType hwVectorType) {
- static_assert(
- std::is_same<VectorTransferOpTy, VectorTransferReadOp>::value ||
- std::is_same<VectorTransferOpTy, VectorTransferWriteOp>::value,
- "Must be called on a VectorTransferOp");
+ static_assert(std::is_same<VectorTransferOpTy, TransferReadOp>::value ||
+ std::is_same<VectorTransferOpTy, TransferWriteOp>::value,
+ "Must be called on a VectorTransferOp");
auto superVectorType = transfer.getVectorType();
auto optionalRatio = shapeRatio(superVectorType, hwVectorType);
assert(optionalRatio &&
@@ -481,7 +480,7 @@ static AffineMap projectedPermutationMap(VectorTransferOpTy transfer,
/// `hwVectorType` int the covering of the super-vector type. For a more
/// detailed description of the problem, see the description of
/// reindexAffineIndices.
-static Operation *instantiate(OpBuilder b, VectorTransferReadOp read,
+static Operation *instantiate(OpBuilder b, TransferReadOp read,
VectorType hwVectorType,
ArrayRef<int64_t> hwVectorInstance,
DenseMap<Value *, Value *> *substitutionsMap) {
@@ -493,7 +492,7 @@ static Operation *instantiate(OpBuilder b, VectorTransferReadOp read,
if (!map) {
return nullptr;
}
- auto cloned = b.create<VectorTransferReadOp>(
+ auto cloned = b.create<TransferReadOp>(
read.getLoc(), hwVectorType, read.memref(), affineIndices,
AffineMapAttr::get(map), read.padding());
return cloned.getOperation();
@@ -505,7 +504,7 @@ static Operation *instantiate(OpBuilder b, VectorTransferReadOp read,
/// `hwVectorType` int the covering of th3e super-vector type. For a more
/// detailed description of the problem, see the description of
/// reindexAffineIndices.
-static Operation *instantiate(OpBuilder b, VectorTransferWriteOp write,
+static Operation *instantiate(OpBuilder b, TransferWriteOp write,
VectorType hwVectorType,
ArrayRef<int64_t> hwVectorInstance,
DenseMap<Value *, Value *> *substitutionsMap) {
@@ -513,7 +512,7 @@ static Operation *instantiate(OpBuilder b, VectorTransferWriteOp write,
map(makePtrDynCaster<Value>(), write.indices());
auto affineIndices =
reindexAffineIndices(b, hwVectorType, hwVectorInstance, indices);
- auto cloned = b.create<VectorTransferWriteOp>(
+ auto cloned = b.create<TransferWriteOp>(
write.getLoc(),
substitute(write.vector(), hwVectorType, substitutionsMap),
write.memref(), affineIndices,
@@ -556,12 +555,12 @@ static bool instantiateMaterialization(Operation *op,
if (op->getNumRegions() != 0)
return op->emitError("NYI path Op with region"), true;
- if (auto write = dyn_cast<VectorTransferWriteOp>(op)) {
+ if (auto write = dyn_cast<TransferWriteOp>(op)) {
auto *clone = instantiate(b, write, state->hwVectorType,
state->hwVectorInstance, state->substitutionsMap);
return clone == nullptr;
}
- if (auto read = dyn_cast<VectorTransferReadOp>(op)) {
+ if (auto read = dyn_cast<TransferReadOp>(op)) {
auto *clone = instantiate(b, read, state->hwVectorType,
state->hwVectorInstance, state->substitutionsMap);
if (!clone) {
@@ -679,7 +678,7 @@ static bool materialize(FuncOp f, const SetVector<Operation *> &terminators,
continue;
}
- auto terminator = cast<VectorTransferWriteOp>(term);
+ auto terminator = cast<TransferWriteOp>(term);
LLVM_DEBUG(dbgs() << "\nFrom terminator:" << *term);
// Get the transitive use-defs starting from terminator, limited to the
@@ -749,7 +748,7 @@ void MaterializeVectorsPass::runOnFunction() {
// Capture terminators; i.e. vector.transfer_write ops involving a strict
// super-vector of subVectorType.
auto filter = [subVectorType](Operation &op) {
- if (!isa<VectorTransferWriteOp>(op)) {
+ if (!isa<TransferWriteOp>(op)) {
return false;
}
return matcher::operatesOnSuperVectorsOf(op, subVectorType);
diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp
index b3eea35a55f..2a0ce092f81 100644
--- a/mlir/lib/Transforms/Vectorize.cpp
+++ b/mlir/lib/Transforms/Vectorize.cpp
@@ -833,7 +833,7 @@ static LogicalResult vectorizeRootOrTerminal(Value *iv,
return LogicalResult::Failure;
LLVM_DEBUG(dbgs() << "\n[early-vect]+++++ permutationMap: ");
LLVM_DEBUG(permutationMap.print(dbgs()));
- auto transfer = b.create<vector::VectorTransferReadOp>(
+ auto transfer = b.create<vector::TransferReadOp>(
opInst->getLoc(), vectorType, memoryOp.getMemRef(),
map(makePtrDynCaster<Value>(), indices),
AffineMapAttr::get(permutationMap),
@@ -1035,9 +1035,9 @@ static Operation *vectorizeOneOperation(Operation *opInst,
// Sanity checks.
assert(!isa<AffineLoadOp>(opInst) &&
"all loads must have already been fully vectorized independently");
- assert(!isa<vector::VectorTransferReadOp>(opInst) &&
+ assert(!isa<vector::TransferReadOp>(opInst) &&
"vector.transfer_read cannot be further vectorized");
- assert(!isa<vector::VectorTransferWriteOp>(opInst) &&
+ assert(!isa<vector::TransferWriteOp>(opInst) &&
"vector.transfer_write cannot be further vectorized");
if (auto store = dyn_cast<AffineStoreOp>(opInst)) {
@@ -1064,7 +1064,7 @@ static Operation *vectorizeOneOperation(Operation *opInst,
return nullptr;
LLVM_DEBUG(dbgs() << "\n[early-vect]+++++ permutationMap: ");
LLVM_DEBUG(permutationMap.print(dbgs()));
- auto transfer = b.create<vector::VectorTransferWriteOp>(
+ auto transfer = b.create<vector::TransferWriteOp>(
opInst->getLoc(), vectorValue, memRef, indices,
AffineMapAttr::get(permutationMap));
auto *res = transfer.getOperation();
OpenPOWER on IntegriCloud