Skip to content

Commit

Permalink
tests: gtests: move test_brgemm to internal
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsafo committed Oct 30, 2021
1 parent a32d24a commit 0f69f8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion tests/gtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ if(DNNL_TARGET_ARCH STREQUAL "X64" AND NOT DNNL_CPU_RUNTIME STREQUAL "NONE")
test_isa_mask.cpp
test_isa_hints.cpp
test_isa_iface.cpp
test_brgemm.cpp
)
foreach(TEST_FILE ${X64_PRIM_TEST_CASES_SRC})
list(APPEND PRIM_TEST_CASES_SRC "${TEST_FILE}")
Expand Down
7 changes: 6 additions & 1 deletion tests/gtests/internals/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#===============================================================================
# Copyright 2020 Intel Corporation
# Copyright 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,4 +24,9 @@ endif()
file(GLOB TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test_*.cpp)
list(APPEND TEST_SOURCES ${MAIN_SRC_GTEST})

# Remove X64-specific tests
if(NOT DNNL_TARGET_ARCH STREQUAL "X64" OR DNNL_CPU_RUNTIME STREQUAL "NONE")
list(REMOVE_ITEM TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test_brgemm.cpp)
endif()

register_exe(${TEST_EXE} "${TEST_SOURCES}" "test" "dnnl_gtest")
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ class brgemm_test_t : public ::testing::TestWithParam<brgemm_params_t> {
void SetUp() override {
const auto &p = GetParam();

SKIP_IF(get_test_engine_kind() == engine::kind::gpu,
"Brgemm is unimplemented on gpu.");
SKIP_IF(engine::get_count(engine::kind::cpu) == 0,
"Brgemm requires cpu.");
eng_ = std::make_shared<engine>(engine::kind::cpu, 0);

SKIP_IF(!impl::cpu::platform::has_data_type_support(p.dt_a),
"Engine does not support this data type.");
Expand Down Expand Up @@ -162,9 +163,8 @@ class brgemm_test_t : public ::testing::TestWithParam<brgemm_params_t> {
size_t sizeA, sizeB, sizeC;
get_matrix_size(p, sizeA, sizeB, sizeC);

engine eng = get_test_engine();
b_mem_reordered_ = std::make_shared<test_memory>(
get_matrix_md<b_dt>(sizeB, p.off.b), eng);
get_matrix_md<b_dt>(sizeB, p.off.b), *eng_);
auto B_reordered = map_memory<b_dt>(*b_mem_reordered_);

reorder_B(p, B, B_reordered);
Expand Down Expand Up @@ -219,8 +219,7 @@ class brgemm_test_t : public ::testing::TestWithParam<brgemm_params_t> {
template <typename a_dt, typename b_dt, typename c_dt>
void test_brgemm(const brgemm_params_t &p) {
gemm_data_ = {};
engine eng = get_test_engine();
prepare_data_for_gemm_testing<a_dt, b_dt, c_dt>(p, gemm_data_, eng);
prepare_data_for_gemm_testing<a_dt, b_dt, c_dt>(p, gemm_data_, *eng_);

dnnl_status_t status = run_brgemm<a_dt, b_dt, c_dt>(p);

Expand Down Expand Up @@ -264,6 +263,7 @@ class brgemm_test_t : public ::testing::TestWithParam<brgemm_params_t> {

test_gemm_data gemm_data_;
std::shared_ptr<test_memory> b_mem_reordered_;
std::shared_ptr<engine> eng_;
};

TEST_P(brgemm_test_t, TestsBRGEMM) {}
Expand Down

0 comments on commit 0f69f8e

Please sign in to comment.