Fixing nondeterminism in pattern application.

The ReduceRegion* patterns are matching on the same ops as the PointwiseToLinalg*
patterns and on certain toolchains (MSVC) the order can be wrong. If the pointwise
runs first then it converts the op *within* the reduction before the reduction one
runs, leading to nested linalg op weirdness.

PiperOrigin-RevId: 373848269
This commit is contained in:
Ben Vanik 2021-05-14 12:56:46 -07:00 committed by TensorFlow MLIR Team
parent a361253e4f
commit b06baae910
1 changed files with 2 additions and 1 deletions

View File

@ -2354,7 +2354,8 @@ void populateHLOToLinalgConversionPattern(MLIRContext* context,
ReduceRegionXLAOpConversion<mhlo::OrOp>,
ReduceRegionXLAOpConversion<mhlo::SelectOp>,
ReduceRegionXLAOpConversion<mhlo::CompareOp>,
ReduceRegionReturnOpConversion>(context);
ReduceRegionReturnOpConversion>(context,
PatternBenefit(1000));
}
std::unique_ptr<OperationPass<FuncOp>> createLegalizeHloToLinalgPass() {