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
1521extern " C" {
1622extern 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+
106114inline 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,
138146TEST (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) {
154167TEST (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) {
170188TEST (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 ;
0 commit comments