From bed07c4e67b5d62f47cf04c778b2e9f45220ba5a Mon Sep 17 00:00:00 2001 From: luoyu-intel Date: Mon, 20 Nov 2023 18:10:20 +0800 Subject: [PATCH] fix UT warning on windows --- onnxruntime/test/contrib_ops/matmul_nbits.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/onnxruntime/test/contrib_ops/matmul_nbits.cc b/onnxruntime/test/contrib_ops/matmul_nbits.cc index ac30d700d8cea..23c68083e4ae5 100644 --- a/onnxruntime/test/contrib_ops/matmul_nbits.cc +++ b/onnxruntime/test/contrib_ops/matmul_nbits.cc @@ -45,7 +45,7 @@ void MlasJblasQ4Test(int64_t M, int64_t N, int64_t K, int block_size, bool is_as size_t kblks = K / block_size; std::vector input1_vals(N * K / 2); - for (size_t i = 0; i < N * K / 2; i++) { + for (size_t i = 0; i < input1_vals.size(); i++) { input1_vals[i] = uint8_t(i); } std::vector input2_vals(N * kblks, 0.002f); @@ -59,8 +59,8 @@ void MlasJblasQ4Test(int64_t M, int64_t N, int64_t K, int block_size, bool is_as for (size_t i = 0; i < N * kblks; i += 2) { input3_vals[i / 2] = uint8_t(i + 1); } - for (size_t i = 0; i < K; i += 2) { - for (size_t j = 0; j < N; j++) { + for (int64_t i = 0; i < K; i += 2) { + for (int64_t j = 0; j < N; j++) { auto srcv = input1_vals[j * K / 2 + i / 2]; auto koff = i % (block_size * 2); auto zpv = input3_vals[j * kblks / 2 + i / block_size / 2]; @@ -74,8 +74,8 @@ void MlasJblasQ4Test(int64_t M, int64_t N, int64_t K, int block_size, bool is_as } } } else { - for (size_t i = 0; i < K; i += 2) { - for (size_t j = 0; j < N; j++) { + for (int64_t i = 0; i < K; i += 2) { + for (int64_t j = 0; j < N; j++) { auto srcv = input1_vals[j * K / 2 + i / 2]; auto src0 = (srcv & 0xf) - 8; auto src1 = ((srcv & 0xf0) >> 4) - 8;