Skip to content

Commit

Permalink
Reused seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova committed Aug 15, 2022
1 parent 937b95d commit 2636030
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/nodes/interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ struct jit_uni_interpolate_kernel_f32 : public jit_uni_interpolate_kernel, publi
inline void emit_load(Xbyak::Reg64 reg_src, Vmm vmm_src, Precision src_prc, Precision dst_prc, const int elt_num, const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[load_emitter_params(src_prc, dst_prc, elt_num).hash()].reset(
new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
emitters[seed].reset(new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
}

emitters[seed]->emit_code({static_cast<size_t>(reg_src.getIdx()), static_cast<size_t>(offset)},
Expand All @@ -284,8 +283,7 @@ struct jit_uni_interpolate_kernel_f32 : public jit_uni_interpolate_kernel, publi
inline void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
const auto seed = store_emitter_params(Precision::FP32, jcp_.dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[store_emitter_params(Precision::FP32, jcp_.dst_prc, elt_num).hash()].reset(
new jit_store_emitter(this, isa, Precision::FP32, jcp_.dst_prc, elt_num));
emitters[seed].reset(new jit_store_emitter(this, isa, Precision::FP32, jcp_.dst_prc, elt_num));
}

// for cases when Store emitter need 2 aux vmm we can use vmm_dst as second aux vmm
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/nodes/roi_align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ struct jit_uni_roi_align_kernel_f32 : public jit_uni_roi_align_kernel, public ji
inline void emit_load(Xbyak::Reg64 reg_src, Vmm vmm_src, Precision src_prc, Precision dst_prc, const int elt_num, const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[load_emitter_params(src_prc, dst_prc, elt_num).hash()].reset(
new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
emitters[seed].reset(new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
}

emitters[seed]->emit_code({static_cast<size_t>(reg_src.getIdx()), static_cast<size_t>(offset)},
Expand All @@ -192,8 +191,7 @@ struct jit_uni_roi_align_kernel_f32 : public jit_uni_roi_align_kernel, public ji
inline void emit_store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, Precision src_prc, Precision dst_prc, const int elt_num, const int offset = 0) {
const auto seed = store_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[store_emitter_params(src_prc, dst_prc, elt_num).hash()].reset(
new jit_store_emitter(this, isa, src_prc, dst_prc, elt_num));
emitters[seed].reset(new jit_store_emitter(this, isa, src_prc, dst_prc, elt_num));
}

// for cases when Store emitter need 2 aux vmm we can use vmm_dst as second aux vmm
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/nodes/topk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ struct jit_uni_topk_kernel_f32 : public jit_uni_topk_kernel, public jit_generato
inline void emit_load(Xbyak::Reg64 reg_src, Vmm vmm_src, Precision src_prc, Precision dst_prc, const int elt_num, const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[load_emitter_params(src_prc, dst_prc, elt_num).hash()].reset(
new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
emitters[seed].reset(new jit_load_emitter(this, isa, src_prc, dst_prc, elt_num));
}

emitters[seed]->emit_code({static_cast<size_t>(reg_src.getIdx()), static_cast<size_t>(offset)},
Expand All @@ -262,8 +261,7 @@ struct jit_uni_topk_kernel_f32 : public jit_uni_topk_kernel, public jit_generato
inline void emit_store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, Precision src_prc, Precision dst_prc, const int elt_num, const int offset = 0) {
const auto seed = store_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[store_emitter_params(src_prc, dst_prc, elt_num).hash()].reset(
new jit_store_emitter(this, isa, src_prc, dst_prc, elt_num));
emitters[seed].reset(new jit_store_emitter(this, isa, src_prc, dst_prc, elt_num));
}

// for cases when Store emitter need 2 aux vmm we can use vmm_dst as second aux vmm
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/utils/jit_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,7 @@ void jit_kernel::load(const variable<DstT[N]> & dst, const variable<SrcT> & src,

const auto key = load_emitter_params(src_prc, dst_prc, length).hash();
if (!_emitters[key]) {
_emitters[load_emitter_params(src_prc, dst_prc, length).hash()].reset(
new jit_load_emitter(this, internal::get_current_isa(), src_prc, dst_prc, length));
_emitters[key].reset(new jit_load_emitter(this, internal::get_current_isa(), src_prc, dst_prc, length));
}
_emitters[key]->emit_code(
{ static_cast<size_t>(static_cast<const Xbyak::Operand&>(src).getIdx()) },
Expand Down Expand Up @@ -792,8 +791,7 @@ void jit_kernel::store(const variable<DstT> & dst, const variable<SrcT[N]> & src

const auto key = store_emitter_params(src_prc, dst_prc, length).hash();
if (!_emitters[key]) {
_emitters[store_emitter_params(src_prc, dst_prc, length).hash()].reset(
new jit_store_emitter(this, internal::get_current_isa(), src_prc, dst_prc, length));
_emitters[key].reset(new jit_store_emitter(this, internal::get_current_isa(), src_prc, dst_prc, length));
}
_emitters[key]->emit_code(
{ static_cast<size_t>(static_cast<const Xbyak::Operand&>(src).getIdx()) },
Expand Down

0 comments on commit 2636030

Please sign in to comment.