Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/mlir/unittests/ExecutionEngine/BrgemmRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
#include <cstdlib>
#include <cstring>

// manually include xbyak header here to avoid no-exception compile issue
#define XBYAK_NO_EXCEPTION
#include <cpu/x64/xbyak/xbyak.h> // NOLINT
#undef XBYAK_NO_EXCEPTION

#include "gc/ExecutionEngine/CPURuntime/Microkernel/BrgemmInterface.h"
#include <cpu/x64/cpu_isa_traits.hpp>

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

using namespace dnnl::impl::cpu::x64;

inline void testBrgemmRuntimeInt(int batch, int M, int N, int K, int LDA,
int LDB, int LDC, int strideA, int strideB,
float beta) {
Expand Down Expand Up @@ -138,6 +146,11 @@ inline void testBrgemmRuntimeInt(int batch, int M, int N, int K, int LDA,
TEST(ExecutionEngine, TestBrgemmRuntimeF32) {
gc_runtime_keep_alive = 0;

bool supported_platform =
mayiuse(avx512_core_amx) || mayiuse(avx512_core) || mayiuse(avx2);
if (!supported_platform)
GTEST_SKIP();

srand(static_cast<unsigned>(time(nullptr)));

constexpr int batch = 4;
Expand All @@ -154,6 +167,11 @@ TEST(ExecutionEngine, TestBrgemmRuntimeF32) {
TEST(ExecutionEngine, TestBrgemmRuntimeBF16) {
gc_runtime_keep_alive = 0;

bool supported_platform = mayiuse(avx512_core_amx) ||
mayiuse(avx512_core_bf16) || mayiuse(avx2_vnni_2);
if (!supported_platform)
GTEST_SKIP();

srand(static_cast<unsigned>(time(nullptr)));

constexpr int batch = 4;
Expand All @@ -170,6 +188,12 @@ TEST(ExecutionEngine, TestBrgemmRuntimeBF16) {
TEST(ExecutionEngine, TestBrgemmRuntimeU8S8) {
gc_runtime_keep_alive = 0;

bool supported_platform = mayiuse(avx512_core_amx) ||
mayiuse(avx512_core_vnni) || mayiuse(avx512_core) ||
mayiuse(avx2_vnni_2) || mayiuse(avx2_vnni);
if (!supported_platform)
GTEST_SKIP();

srand(static_cast<unsigned>(time(nullptr)));

constexpr int batch = 4;
Expand Down
4 changes: 4 additions & 0 deletions test/mlir/unittests/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ add_mlir_unittest(GCExecutionEngineTests
BrgemmRuntime.cpp
)

get_property(GC_DNNL_INCLUDES GLOBAL PROPERTY GC_DNNL_INCLUDES)
target_include_directories(GCExecutionEngineTests PRIVATE ${GC_DNNL_INCLUDES})

target_link_libraries(GCExecutionEngineTests
PRIVATE
GcJitWrapper
GcCpuRuntime)