From 5cc551dd4f22b6d602bd458063895c1dc2cc8026 Mon Sep 17 00:00:00 2001 From: Andi Drebes Date: Tue, 9 Nov 2021 10:14:28 +0100 Subject: [PATCH] fix(compiler): JIT unit tests: Don't compare expressions of different signedness Fix compiler warnings in `end_to_end_jit_clear_tensor.cc` and `end_to_end_jit_encrypted_tensor.cc` due to the comparison of integer expressions of different signedness. --- compiler/tests/unittest/end_to_end_jit_clear_tensor.cc | 8 ++++---- .../tests/unittest/end_to_end_jit_encrypted_tensor.cc | 8 ++++---- compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc b/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc index c142a04bd..0251c4b8a 100644 --- a/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc +++ b/compiler/tests/unittest/end_to_end_jit_clear_tensor.cc @@ -222,8 +222,8 @@ func @main(%t: tensor<2x10xi64>, %i: index, %j: index) -> i64 { mlir::zamalang::IntLambdaArgument> arg(tensor2D, shape2D); - for (size_t i = 0; i < dims[0]; i++) { - for (size_t j = 0; j < dims[1]; j++) { + for (int64_t i = 0; i < dims[0]; i++) { + for (int64_t j = 0; j < dims[1]; j++) { auto pos = i * dims[1] + j; mlir::zamalang::IntLambdaArgument argi(i); mlir::zamalang::IntLambdaArgument argj(j); @@ -251,7 +251,7 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { ASSERT_EXPECTED_SUCCESS(res); - ASSERT_EQ(res->size(), 1 * 5); + ASSERT_EQ(res->size(), (size_t)1 * 5); // Check the sub slice for (size_t j = 0; j < 5; j++) { @@ -279,7 +279,7 @@ func @main(%t: tensor<2x10xi64>) -> tensor<1x5xi64> { ASSERT_EXPECTED_SUCCESS(res); - ASSERT_EQ(res->size(), 1 * 5); + ASSERT_EQ(res->size(), (size_t)1 * 5); // Check the sub slice for (size_t j = 0; j < 5; j++) { diff --git a/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc b/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc index 5524092ad..2a0ed278e 100644 --- a/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc +++ b/compiler/tests/unittest/end_to_end_jit_encrypted_tensor.cc @@ -53,8 +53,8 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>, %i: index, %j: index) -> mlir::zamalang::IntLambdaArgument> arg(tensor2D, shape2D); - for (size_t i = 0; i < dims[0]; i++) { - for (size_t j = 0; j < dims[1]; j++) { + for (int64_t i = 0; i < dims[0]; i++) { + for (int64_t j = 0; j < dims[1]; j++) { auto pos = i * dims[1] + j; mlir::zamalang::IntLambdaArgument argi(i); mlir::zamalang::IntLambdaArgument argj(j); @@ -81,7 +81,7 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { ASSERT_EXPECTED_SUCCESS(res); - ASSERT_EQ(res->size(), 1 * 5); + ASSERT_EQ(res->size(), (size_t)1 * 5); // Check the sub slice for (size_t j = 0; j < 5; j++) { @@ -109,7 +109,7 @@ func @main(%t: tensor<2x10x!HLFHE.eint<6>>) -> tensor<1x5x!HLFHE.eint<6>> { ASSERT_EXPECTED_SUCCESS(res); - ASSERT_EQ(res->size(), 1 * 5); + ASSERT_EQ(res->size(), (size_t)1 * 5); // Check the sub slice for (size_t j = 0; j < 5; j++) { diff --git a/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc b/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc index 0ae6ba2a7..055eb2279 100644 --- a/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc +++ b/compiler/tests/unittest/end_to_end_jit_hlfhelinalg.cc @@ -31,7 +31,7 @@ TEST(End2EndJit_HLFHELinalg, add_eint_int_term_to_term) { ASSERT_EXPECTED_SUCCESS(res); - ASSERT_EQ(res->size(), 4); + ASSERT_EQ(res->size(), (size_t)4); for (size_t i = 0; i < 4; i++) { EXPECT_EQ((*res)[i], a0[i] + a1[i]);