[mlir][Affine] Minor clean-up of D79829

Addressing D79829 post-commit comments. Minor changes.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D80814
This commit is contained in:
Diego Caballero 2020-05-29 14:31:03 -07:00
parent 881c5eef98
commit e75325cfc3
5 changed files with 24 additions and 28 deletions

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
#define MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
#ifndef MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
#define MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/OpDefinition.h"
@ -21,4 +21,4 @@ namespace mlir {
#include "mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc"
} // namespace mlir
#endif // MLIR_INTERFACES_AFFINEMEMORYOPINTERFACES_H_
#endif // MLIR_DIALECT_AFFINE_IR_AFFINEMEMORYOPDIALECT_H_

View File

@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_AFFINEMEMORYOPINTERFACES
#define MLIR_AFFINEMEMORYOPINTERFACES
#ifndef AFFINEMEMORYOPINTERFACES
#define AFFINEMEMORYOPINTERFACES
include "mlir/IR/OpBase.td"
@ -23,7 +23,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
let methods = [
InterfaceMethod<
/*desc=*/[{ Returns the memref operand to read from. }],
/*desc=*/"Returns the memref operand to read from.",
/*retTy=*/"Value",
/*methodName=*/"getMemRef",
/*args=*/(ins),
@ -34,7 +34,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns the type of the memref operand. }],
/*desc=*/"Returns the type of the memref operand.",
/*retTy=*/"MemRefType",
/*methodName=*/"getMemRefType",
/*args=*/(ins),
@ -45,7 +45,7 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns affine map operands. }],
/*desc=*/"Returns affine map operands.",
/*retTy=*/"Operation::operand_range",
/*methodName=*/"getMapOperands",
/*args=*/(ins),
@ -56,8 +56,9 @@ def AffineReadOpInterface : OpInterface<"AffineReadOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns the affine map used to index the memref for this
operation. }],
/*desc=*/[{
Returns the affine map used to index the memref for this operation.
}],
/*retTy=*/"AffineMap",
/*methodName=*/"getAffineMap",
/*args=*/(ins),
@ -78,7 +79,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
let methods = [
InterfaceMethod<
/*desc=*/[{ Returns the memref operand to write to. }],
/*desc=*/"Returns the memref operand to write to.",
/*retTy=*/"Value",
/*methodName=*/"getMemRef",
/*args=*/(ins),
@ -89,7 +90,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns the type of the memref operand. }],
/*desc=*/"Returns the type of the memref operand.",
/*retTy=*/"MemRefType",
/*methodName=*/"getMemRefType",
/*args=*/(ins),
@ -100,7 +101,7 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns affine map operands. }],
/*desc=*/"Returns affine map operands.",
/*retTy=*/"Operation::operand_range",
/*methodName=*/"getMapOperands",
/*args=*/(ins),
@ -111,8 +112,9 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
}]
>,
InterfaceMethod<
/*desc=*/[{ Returns the affine map used to index the memref for this
operation. }],
/*desc=*/[{
Returns the affine map used to index the memref for this operation.
}],
/*retTy=*/"AffineMap",
/*methodName=*/"getAffineMap",
/*args=*/(ins),
@ -125,4 +127,4 @@ def AffineWriteOpInterface : OpInterface<"AffineWriteOpInterface"> {
];
}
#endif // MLIR_AFFINEMEMORYOPINTERFACES
#endif // AFFINEMEMORYOPINTERFACES

View File

@ -1,10 +1,5 @@
add_mlir_dialect(AffineOps affine)
add_mlir_doc(AffineOps -gen-op-doc AffineOps Dialects/)
set(LLVM_TARGET_DEFINITIONS AffineMemoryOpInterfaces.td)
mlir_tablegen(AffineMemoryOpInterfaces.h.inc -gen-op-interface-decls)
mlir_tablegen(AffineMemoryOpInterfaces.cpp.inc -gen-op-interface-defs)
add_public_tablegen_target(MLIRAffineMemoryOpInterfacesIncGen)
add_dependencies(mlir-generic-headers MLIRAffineMemoryOpInterfacesIncGen)
add_mlir_interface(AffineMemoryOpInterfaces)
add_dependencies(MLIRAffineOpsIncGen MLIRAffineMemoryOpInterfacesIncGen)

View File

@ -660,12 +660,11 @@ static void computeDirectionVector(
void MemRefAccess::getAccessMap(AffineValueMap *accessMap) const {
// Get affine map from AffineLoad/Store.
AffineMap map;
if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst)) {
if (auto loadOp = dyn_cast<AffineReadOpInterface>(opInst))
map = loadOp.getAffineMap();
} else {
auto storeOp = cast<AffineWriteOpInterface>(opInst);
map = storeOp.getAffineMap();
}
else
map = cast<AffineWriteOpInterface>(opInst).getAffineMap();
SmallVector<Value, 8> operands(indices.begin(), indices.end());
fullyComposeAffineMapAndOperands(&map, &operands);
map = simplifyAffineMap(map);

View File

@ -1,4 +1,4 @@
//===- AffineMemoryOpInterfaces.cpp - Loop-like operations in MLIR --------===//
//===- AffineMemoryOpInterfaces.cpp ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.