message: Handle associativity in the gelu erf multiplications.
  Summary: Ref T52832
  Reviewers: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, georgep
  Maniphest Tasks: T52832
diff: @@ -118,6 +118,38 @@ static const std::vector<HloMatcherPattern> patterns = {
  {HloOpcode::kConstant, NodeOperands({}), IsConstantF(0.70710678118f)},
  })),
  + HloMatcherPattern(
  + PatternType("gelu_erf"),
  + PatternReplaceFn([](const HloMatcherMatched& matched) ->
  + StatusOr<PatternInstructionOutputs> {
  + auto inputs = matched.GetInputs();
  + if (inputs.size() != 1) {
  + return InternalError("GeluErf accepts only one argument");
  + }
  +
  + return PatternInstructionOutputs{
  + matched.computation->AddInstruction(CreateGeluErf(inputs[0]))
  + };
  + }),
  + PatternMetaTarget(0),
  + PatternInputs({3}),
  + PatternOutputs({0}),
  + Pattern({
  + {HloOpcode::kMultiply, NodeOperands({3, 1})},
  + {HloOpcode::kMultiply, NodeOperands({5, 2})},
  + {HloOpcode::kBroadcast, NodeOperands({4})},
  + {HloMatcherOpcode::kAnyOpcode, NodeOperands({}), IsF16OrF32},
  + {HloOpcode::kConstant, NodeOperands({}), IsConstantF(0.5f)},
  + {HloOpcode::kAdd, NodeOperands({6, 7})},
  + {HloOpcode::kCustomCall, NodeOperands({9}),
  + IsPoplarInstruction(PoplarOp::Erf)},
  + {HloOpcode::kBroadcast, NodeOperands({8})},
  + {HloOpcode::kConstant, NodeOperands({}), IsConstantF(1.0f)},
  + {HloOpcode::kMultiply, NodeOperands({3, 10})},
  + {HloOpcode::kBroadcast, NodeOperands({11})},
  + {HloOpcode::kConstant, NodeOperands({}), IsConstantF(0.70710678118f)},
  + })),
  +
  HloMatcherPattern(
  PatternType("relu"),
  PatternReplaceFn([](const HloMatcherMatched& matched)
  