diff --git a/onnxruntime/core/mlas/lib/mlasi.h b/onnxruntime/core/mlas/lib/mlasi.h index bd8a0effcf..05171f9d6b 100644 --- a/onnxruntime/core/mlas/lib/mlasi.h +++ b/onnxruntime/core/mlas/lib/mlasi.h @@ -170,7 +170,7 @@ void size_t CountM, size_t CountK, int32_t* RowSumVector, - uint16_t offb + int16_t offb ); typedef MLAS_GEMM_U8U8_COPY_PACKA_ROUTINE* PMLAS_GEMM_U8U8_COPY_PACKA_ROUTINE; @@ -184,7 +184,7 @@ void size_t CountN, size_t CountK, int32_t* ColumnSumVector, - uint16_t offa + int16_t offa ); typedef MLAS_GEMM_U8U8_COPY_PACKB_ROUTINE* PMLAS_GEMM_U8U8_COPY_PACKB_ROUTINE; diff --git a/onnxruntime/core/mlas/lib/qgemm.cpp b/onnxruntime/core/mlas/lib/qgemm.cpp index 5a7b9d8c9e..c5d07da984 100644 --- a/onnxruntime/core/mlas/lib/qgemm.cpp +++ b/onnxruntime/core/mlas/lib/qgemm.cpp @@ -36,7 +36,7 @@ MlasGemmU8U8CopyPackASse( size_t CountM, size_t CountK, int32_t* RowSumVector, - uint16_t offb + int16_t offb ) /*++ @@ -165,7 +165,7 @@ MlasGemmU8U8CopyPackBSse( size_t CountN, size_t CountK, int32_t* ColumnSumVector, - uint16_t offa + int16_t offa ) /*++ @@ -558,7 +558,7 @@ MlasQgemm( CountN = N - n; } - MlasPlatform.GemmU8U8CopyPackBRoutine(PanelB, B + n + k * ldb, ldb, CountN, CountK, ColumnSumVector, offa); + MlasPlatform.GemmU8U8CopyPackBRoutine(PanelB, B + n + k * ldb, ldb, CountN, CountK, ColumnSumVector, -int16_t(offa)); size_t CountM; @@ -570,7 +570,7 @@ MlasQgemm( CountM = M - m; } - MlasPlatform.GemmU8U8CopyPackARoutine(PanelA, A + k + m * lda, lda, CountM, CountK, RowSumVector, offb); + MlasPlatform.GemmU8U8CopyPackARoutine(PanelA, A + k + m * lda, lda, CountM, CountK, RowSumVector, -int16_t(offb)); int16_t* pa = PanelA; int32_t* c = C + n + m * ldc; diff --git a/onnxruntime/test/mlas/unittest.cpp b/onnxruntime/test/mlas/unittest.cpp index f932d7f8f4..64690d8ee7 100644 --- a/onnxruntime/test/mlas/unittest.cpp +++ b/onnxruntime/test/mlas/unittest.cpp @@ -528,7 +528,7 @@ private: int32_t sum = 0; for (size_t k = 0; k < K; k++) { - sum += ((*b + offb) * (*a + offa)); + sum += ((int32_t(*b) - offb) * (int32_t(*a) - offa)); b += ldb; a += 1; }