Skip to content

Commit

Permalink
[Fix] [Feature] Apply WA to remove gemm legacy on avx512.
Browse files Browse the repository at this point in the history
[FORK][FEATURE] cpu: remove gemm legacy on avx512.
  • Loading branch information
luweizhou2016 committed Nov 10, 2023
1 parent 9861b36 commit a82ed83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cpu/rnn/ref_rnn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,17 @@ struct _ref_rnn_common_t : public primitive_t {
(rnn_.is_bf16_conf() || rnn_.is_f32_conf()));

if (!ok) return status::unimplemented;

#if !__BUILD_GEMM_AVX512
// WA: enable gru brgemm on avx512 f32 to avoid dien.xml regression when removing gemm legacy on avx512.
const auto enable_brgemm_gru = mayiuse(avx512_core) && rnn_.is_cell_dt_f32();
#else
const auto enable_brgemm_gru = false;
#endif
// Support for GRU / AUGRU cell in BRGEMM-based implementation is
// limited by forward_inference pass for now, all_f32 is disabled
// due to performance degradation.
// due to performance degradation except the case GEMM legacy is removed on avx512 core.
// TODO: Improve GRU / AUGRU coverage in BRGEMM-based implementation
ok = IMPLICATION(rnn_.is_orig_gru,
ok = IMPLICATION(rnn_.is_orig_gru && !enable_brgemm_gru,
this->desc()->prop_kind == forward_inference
&& !rnn_.is_cell_dt_f32());
if (!ok) return status::unimplemented;
Expand Down
1 change: 1 addition & 0 deletions src/cpu/x64/gemm/gemm_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ void gemm_info_t<a_t, b_t, c_t>::jit_init(void) {
static std::once_flag initialized;
static std::atomic<dnnl_status_t> st(dnnl_success);
std::call_once(initialized, [&, um] {
MAYBE_UNUSED(um);
#if __BUILD_GEMM_AVX512
const bool b_is_s8 = data_traits<b_t>::data_type == data_type::s8;
#endif
Expand Down

0 comments on commit a82ed83

Please sign in to comment.