@@ -830,20 +830,26 @@ template <prop_kind_t aprop, data_type_t src_type, data_type_t weights_type,
830
830
rnn_matmul_sig ((_ref_rnn_common_t <aprop, src_type, weights_type,
831
831
acc_type>::execute_matmul)) {
832
832
833
- engine_t *engine = ctx.stream ()->engine ();
833
+ // Service engine is just a global classic CPU engine that is used
834
+ // when it's required to create memory_t objects for classic CPU
835
+ // engine regardless of the CPU runtime. For example, SYCL CPU engine
836
+ // cannot be used to create such objects.
837
+ engine_t *service_engine = get_service_engine ();
834
838
constexpr auto mem_flag = memory_flags_t ::use_runtime_ptr;
835
839
840
+ // a_, b_ and c_ are regular, raw CPU pointers that can only be used with
841
+ // memory_t objects created for the classic CPU engine.
836
842
std::unique_ptr<memory_t , memory_deleter_t > src_mem;
837
843
CHECK (safe_ptr_assign (src_mem,
838
- new memory_t (engine , matmul_prim->pd ()->src_md (), mem_flag,
844
+ new memory_t (service_engine , matmul_prim->pd ()->src_md (), mem_flag,
839
845
(void *)(a_))));
840
846
std::unique_ptr<memory_t , memory_deleter_t > wei_mem;
841
847
CHECK (safe_ptr_assign (wei_mem,
842
- new memory_t (engine , matmul_prim->pd ()->weights_md (), mem_flag ,
843
- (void *)(b_))));
848
+ new memory_t (service_engine , matmul_prim->pd ()->weights_md (),
849
+ mem_flag, (void *)(b_))));
844
850
std::unique_ptr<memory_t , memory_deleter_t > dst_mem;
845
851
CHECK (safe_ptr_assign (dst_mem,
846
- new memory_t (engine , matmul_prim->pd ()->dst_md (), mem_flag,
852
+ new memory_t (service_engine , matmul_prim->pd ()->dst_md (), mem_flag,
847
853
(void *)(c_))));
848
854
849
855
exec_args_t matmul_args;
0 commit comments