Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/FBGEMM.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoung Jin Kim <youki@microsoft.com>2020-09-30 03:08:50 +0300
committerGitHub <noreply@github.com>2020-09-30 03:08:50 +0300
commit64888200cbc9e9c287601f23c58b4088cdf51cba (patch)
tree9ae958265be97ffa1e1e563f7f633a12c27e79fa
parent055d2a099c829563aff1fffdeb4594ad8cfe5d99 (diff)
Fix unit test errors - skip unnecessary acc16 test for VNNI CPUs (#9)
-rw-r--r--test/PackedRequantizeAcc16Test.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/PackedRequantizeAcc16Test.cc b/test/PackedRequantizeAcc16Test.cc
index 8978150..147d60f 100644
--- a/test/PackedRequantizeAcc16Test.cc
+++ b/test/PackedRequantizeAcc16Test.cc
@@ -4,6 +4,7 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
+#include <cpuinfo.h>
#include <algorithm>
#include <chrono>
#include <cmath>
@@ -97,6 +98,12 @@ static vector<vector<int>> GetShapes_() {
* accumulation. Output processing: requantization -> nothing
*/
TEST_P(fbgemmu8s8acc16WithQuantGranularityTest, Test) {
+ cpuinfo_initialize();
+ if (fbgemmHasAvx512VnniSupport()) {
+ // No need to use acc16 if VNNI is available
+ return;
+ }
+
vector<vector<int>> shapes(GetShapes_());
matrix_op_t atrans, btrans;
bool test_ld;
@@ -338,6 +345,12 @@ TEST_P(fbgemmu8s8acc16WithQuantGranularityTest, Test) {
* accumulation. Output processing: spmdm -> requantization -> nothing
*/
TEST_P(fbgemmu8s8acc16WithQuantGranularityTest, SpMDMTest) {
+ cpuinfo_initialize();
+ if (fbgemmHasAvx512VnniSupport()) {
+ // No need to use acc16 if VNNI is available
+ return;
+ }
+
vector<vector<int>> shapes(GetShapes_());
matrix_op_t atrans, btrans;
bool test_ld;
@@ -664,6 +677,12 @@ TEST_P(fbgemmu8s8acc16WithQuantGranularityTest, SpMDMTest) {
* accumulation. Output processing: nothing
*/
TEST_P(fbgemmu8s8acc16Test, NoRequantizeTest) {
+ cpuinfo_initialize();
+ if (fbgemmHasAvx512VnniSupport()) {
+ // No need to use acc16 if VNNI is available
+ return;
+ }
+
vector<vector<int>> shapes(GetShapes_());
matrix_op_t atrans, btrans;
bool test_ld;
@@ -876,7 +895,7 @@ TEST_P(fbgemmPackUnpackAcc16Test, TestPackUnpack) {
// Sanity check
for (int i = 0; i < k; i++) {
for (int j = 0; j < n_adjusted; j++) {
- EXPECT_EQ(Bint8.data()[i * n + j], unpack_buf.data()[i * n + j])
+ EXPECT_EQ(unpack_buf.data()[i * n + j], Bint8.data()[i * n + j])
<< "Pack/Unpack results differ at index (" << i << ", " << j
<< ", Reference: " << static_cast<int>(Bint8.data()[i * n + j])
<< ", Pack-Unpacked: "