message: Add test case that shows TopK cannot handle minimum int value correctly.
diff: @@ -14,6 +14,9 @@ limitations under the License.
  ==============================================================================*/
  #include "tensorflow/compiler/xla/client/lib/sorting.h"
  +
  +#include <limits>
  +
  #include "tensorflow/compiler/xla/client/xla_builder.h"
  #include "tensorflow/compiler/xla/test.h"
  #include "tensorflow/compiler/xla/tests/client_library_test_base.h"
  @@ -41,6 +44,28 @@ XLA_TEST_F(SortingTest, TopK3From8Indices) {
  ComputeAndCompareR1<int>(&builder, {0, 1, 2}, {});
  }
  +// TODO(b/119930279): enable this test.
  +XLA_TEST_F(SortingTest, DISABLED_TopKFullSortMinInt) {
  + XlaBuilder builder(TestName());
  + auto x_rev = ConstantR1<int>(&builder, {std::numeric_limits<int>::min(),
  + std::numeric_limits<int>::min() + 1,
  + std::numeric_limits<int>::max()});
  + xla::GetTupleElement(xla::TopK(x_rev, 3), 1);
  + ComputeAndCompareR1<int>(&builder, {2, 1, 0}, {});
  +}
  +
  +XLA_TEST_F(SortingTest, NOT_TopKFullSortMinInt) {
  + XlaBuilder builder(TestName());
  + auto x_rev = ConstantR1<int>(&builder, {std::numeric_limits<int>::min(),
  + std::numeric_limits<int>::min() + 1,
  + std::numeric_limits<int>::max()});
  + xla::GetTupleElement(xla::TopK(x_rev, 3), 1);
  + // TopK currently negates the keys, which doesn't work correctly for
  + // std::numeric_limits<int>::min(). Therefore, it will sort this key to the
  + // front instead of to the back.
  + ComputeAndCompareR1<int>(&builder, {0, 2, 1}, {});
  +}
  +
  XLA_TEST_F(SortingTest, TopKFullSort) {
  XlaBuilder builder(TestName());
  const int kSize = 16;
  