Skip to content

Commit 61361c2

Browse files
author
Haixin Huang
authored
[UT] Skip BrgemmRuntime UT under unsupported platform (#275)
1 parent 4f771d5 commit 61361c2

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

test/mlir/unittests/ExecutionEngine/BrgemmRuntime.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
#include <cstdlib>
1111
#include <cstring>
1212

13+
// manually include xbyak header here to avoid no-exception compile issue
14+
#define XBYAK_NO_EXCEPTION
15+
#include <cpu/x64/xbyak/xbyak.h> // NOLINT
16+
#undef XBYAK_NO_EXCEPTION
17+
1318
#include "gc/ExecutionEngine/CPURuntime/Microkernel/BrgemmInterface.h"
19+
#include <cpu/x64/cpu_isa_traits.hpp>
1420

1521
extern "C" {
1622
extern int gc_runtime_keep_alive;
@@ -103,6 +109,8 @@ template <typename T> inline bool compareDataInt(T *ref, T *dst, size_t size) {
103109
return true;
104110
}
105111

112+
using namespace dnnl::impl::cpu::x64;
113+
106114
inline void testBrgemmRuntimeInt(int batch, int M, int N, int K, int LDA,
107115
int LDB, int LDC, int strideA, int strideB,
108116
float beta) {
@@ -138,6 +146,11 @@ inline void testBrgemmRuntimeInt(int batch, int M, int N, int K, int LDA,
138146
TEST(ExecutionEngine, TestBrgemmRuntimeF32) {
139147
gc_runtime_keep_alive = 0;
140148

149+
bool supported_platform =
150+
mayiuse(avx512_core_amx) || mayiuse(avx512_core) || mayiuse(avx2);
151+
if (!supported_platform)
152+
GTEST_SKIP();
153+
141154
srand(static_cast<unsigned>(time(nullptr)));
142155

143156
constexpr int batch = 4;
@@ -154,6 +167,11 @@ TEST(ExecutionEngine, TestBrgemmRuntimeF32) {
154167
TEST(ExecutionEngine, TestBrgemmRuntimeBF16) {
155168
gc_runtime_keep_alive = 0;
156169

170+
bool supported_platform = mayiuse(avx512_core_amx) ||
171+
mayiuse(avx512_core_bf16) || mayiuse(avx2_vnni_2);
172+
if (!supported_platform)
173+
GTEST_SKIP();
174+
157175
srand(static_cast<unsigned>(time(nullptr)));
158176

159177
constexpr int batch = 4;
@@ -170,6 +188,12 @@ TEST(ExecutionEngine, TestBrgemmRuntimeBF16) {
170188
TEST(ExecutionEngine, TestBrgemmRuntimeU8S8) {
171189
gc_runtime_keep_alive = 0;
172190

191+
bool supported_platform = mayiuse(avx512_core_amx) ||
192+
mayiuse(avx512_core_vnni) || mayiuse(avx512_core) ||
193+
mayiuse(avx2_vnni_2) || mayiuse(avx2_vnni);
194+
if (!supported_platform)
195+
GTEST_SKIP();
196+
173197
srand(static_cast<unsigned>(time(nullptr)));
174198

175199
constexpr int batch = 4;

test/mlir/unittests/ExecutionEngine/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ add_mlir_unittest(GCExecutionEngineTests
33
BrgemmRuntime.cpp
44
)
55

6+
get_property(GC_DNNL_INCLUDES GLOBAL PROPERTY GC_DNNL_INCLUDES)
7+
target_include_directories(GCExecutionEngineTests PRIVATE ${GC_DNNL_INCLUDES})
8+
69
target_link_libraries(GCExecutionEngineTests
710
PRIVATE
811
GcJitWrapper
912
GcCpuRuntime)
13+

0 commit comments

Comments
 (0)