message: [XLA] Consistently pick convolution algorithms with WRONG_RESULT as commented.
diff: @@ -517,13 +517,17 @@ StatusOr<AutotuneResult> CudnnConvAlgorithmPicker::PickBestAlgorithmNoCache(
  }
  }
  - // Choose the fastest convolution that doesn't produce a REDZONE_MODIFIED
  - // error.
  - //
  // For now, we ignore WRONG_RESULT failures because false-positives are
  // possible (e.g. perhaps the reference algorithm is the one that's
  // incorrect!). But we don't ignore REDZONE_MODIFIED failures because they're
  // quite severe and can be detected with high accuracy.
  + auto has_failure = [](const AutotuneResult& r) {
  + return r.has_failure() &&
  + r.failure().kind() != AutotuneResult::WRONG_RESULT;
  + };
  +
  + // Choose the fastest convolution that doesn't produce a REDZONE_MODIFIED
  + // error.
  //
  // TODO(jlebar): We ought to be able to detect redzone reads by noticing NaNs
  // in the output of the conv and skip those.
  @@ -531,9 +535,9 @@ StatusOr<AutotuneResult> CudnnConvAlgorithmPicker::PickBestAlgorithmNoCache(
  // The successful one should have a smaller key, since we are doing
  // min_element. If they are both unsuccessful, keep the earlier one in
  // the vector by comparing pointers.
  - auto result_comparison_key = [](const AutotuneResult& r) {
  + auto result_comparison_key = [&has_failure](const AutotuneResult& r) {
  return std::make_tuple(
  - r.has_failure() && r.failure().kind() != AutotuneResult::WRONG_RESULT,
  + has_failure(r),
  tensorflow::proto_utils::FromDurationProto(r.run_time()));
  };
  const auto& best_result = absl::c_min_element(
  @@ -542,7 +546,7 @@ StatusOr<AutotuneResult> CudnnConvAlgorithmPicker::PickBestAlgorithmNoCache(
  return result_comparison_key(lhs) < result_comparison_key(rhs);
  });
  - if (best_result != profile_results.end() && !best_result->has_failure()) {
  + if (best_result != profile_results.end() && !has_failure(*best_result)) {
  return *best_result;
  }
  