[MLIR][HLO] Remove duplicate `PopulateTransformUnrankedHloPatterns`

PiperOrigin-RevId: 359046173
This commit is contained in:
A. Unique TensorFlower 2021-02-23 07:49:54 -08:00 committed by TensorFlow MLIR Team
parent 2df1bb3d6b
commit ac0552f127
6 changed files with 9 additions and 11 deletions

View File

@ -105,7 +105,7 @@ def TestInferShapedTypeMethodsPass : Pass<"mhlo-test-infer-shaped-type-methods",
}
def TransformUnrankedHloPass : Pass<"transform-unranked-hlo", "FuncOp"> {
def TransformUnrankedHloPass : Pass<"mhlo-transform-unranked-hlo", "FuncOp"> {
let summary = "Realize element-wise operations on ranked tensors where possible.";
let constructor = "createTransformUnrankedHloPass()";
}

View File

@ -30,11 +30,11 @@ template <typename T>
class OperationPass;
class Pass;
namespace mhlo {
// Transforms unranked HLO operations to ranked ones where possible.
std::unique_ptr<FunctionPass> createTransformUnrankedHloPass();
namespace mhlo {
/// Lowers HLO control flow ops to the Standard dialect.
std::unique_ptr<OperationPass<FuncOp>> createLegalizeControlFlowPass();

View File

@ -26,11 +26,6 @@ limitations under the License.
namespace mlir {
class OwningRewritePatternList;
// Populates a collection of rewrite patterns to realize element-wise operations
// on ranked tensors where possible.
void PopulateTransformUnrankedHloPatterns(MLIRContext *context,
OwningRewritePatternList *patterns);
namespace mhlo {
// Collection of rewrite patterns for lowering a general dot product.

View File

@ -51,7 +51,7 @@ struct ConvertConstantLikeOp : public OpConversionPattern<ConstantLikeOp> {
ConversionPatternRewriter &rewriter) const override {
auto result_ty = op.getType().cast<ShapedType>();
// Unranked uses are not supported. Consider `transform-unranked-hlo`.
// Unranked uses are not supported. Consider `mhlo-transform-unranked-hlo`.
if (!result_ty.hasRank()) return failure();
// Lower to MHLO constant if statically shaped.

View File

@ -526,7 +526,7 @@ struct TransformUnrankedHloPass
// Populate rewrite patterns.
OwningRewritePatternList patterns;
PopulateTransformUnrankedHloPatterns(&ctx, &patterns);
mhlo::PopulateTransformUnrankedHloPatterns(&ctx, &patterns);
// Apply transformation.
if (failed(
@ -537,6 +537,8 @@ struct TransformUnrankedHloPass
} // namespace
namespace mhlo {
void PopulateTransformUnrankedHloPatterns(MLIRContext *context,
OwningRewritePatternList *patterns) {
#define MAP_HLO(op) ElementwiseOpConversion<mhlo::op>
@ -565,4 +567,5 @@ std::unique_ptr<FunctionPass> createTransformUnrankedHloPass() {
return std::make_unique<TransformUnrankedHloPass>();
}
} // namespace mhlo
} // namespace mlir

View File

@ -1,4 +1,4 @@
// RUN: mlir-hlo-opt --transform-unranked-hlo --cse --split-input-file %s | FileCheck %s
// RUN: mlir-hlo-opt --mhlo-transform-unranked-hlo --cse --split-input-file %s | FileCheck %s
// Check the validity of expected IR.
// CHECK-LABEL: @sqr_transform_result