[MLIR][HLO] Remove duplicate `PopulateTransformUnrankedHloPatterns`
PiperOrigin-RevId: 359046173
This commit is contained in:
		
							parent
							
								
									2df1bb3d6b
								
							
						
					
					
						commit
						ac0552f127
					
				|  | @ -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()"; | ||||
| } | ||||
|  |  | |||
|  | @ -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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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.
 | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue