Skip to content

Commit

Permalink
cpu: rnn: disable packed optimization for threadpool
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarukin committed Dec 20, 2021
1 parent 2458105 commit 6799040
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/cpu/rnn/rnn_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,23 @@ bool init_conf(rnn_conf_t &rnn, const rnn_desc_t &rd,
|| rnn.is_int8() || is_bf16)
: false;

#if DNNL_CPU_RUNTIME == DNNL_RUNTIME_THREADPOOL
// XXX: Threadpool runtime may use different number of threads at execute
// and create stages. GEMM packed API is not aware of number of threads as
// of now. In order to synchronize all layers, GEMM pack API should be
// modified to accept number of threads instead of taking it from
// `dnnl_get_max_threads()`, and rnn_packed_desc_t should be updated with
// `nthr` member to pass this information between different parts of packed
// API, since `get_size` call happens on RNN side, while packing happens
// on reorder side. Consider enabling later.
// `test_iface_runtime_attr` was disabled for RNN with threadpool due to
// this is the only working approach for int8 computations in RNN for now.
// Consider enabling it once resolved.
rnn.use_layer_packed_gemm = false;
rnn.use_iter_packed_gemm = false;
rnn.use_projection_packed_gemm = false;
#endif

/* Set packed gemm sizes */
/* TODO: investigate the benefit of mixing packed and non-packed weights parts */
const auto set_pack_sizes
Expand Down
6 changes: 5 additions & 1 deletion tests/gtests/test_iface_runtime_attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,14 @@ CPU_TEST_F(runtime_attr_test_t, TestReorder) {

TEST_F(runtime_attr_test_t, TestRNN) {
SKIP_IF_CUDA(true, "RNN primitive not supported for CUDA");

// Int8 RNN relies on packed API solely which is available only for X64.
#if !DNNL_X64
return;
#endif
// XXX: Threadpool doesn't work correctly with packed API which is the only
// working mechanism for int8 computations. Disable it for now.
SKIP_IF(DNNL_CPU_RUNTIME == DNNL_RUNTIME_THREADPOOL,
"Threadpool does not have working packed API");

memory::dim n = 1, t = 1, l = 10, c = 8, g = 4, d = 1;
memory::desc src_layer_md {{t, n, c}, data_type::u8, tag::tnc};
Expand Down

0 comments on commit 6799040

Please sign in to comment.