Skip to content

Commit

Permalink
add lock for static variable operation (openvinotoolkit#22423)
Browse files Browse the repository at this point in the history
* add lock for static variable operation

* initialize properties through lamda function

* fix code style

---------

Co-authored-by: Chen Peter <[email protected]>
  • Loading branch information
xufang-lisa and peterchen-intel authored Feb 2, 2024
1 parent c47ded6 commit 75ee009
Showing 1 changed file with 51 additions and 46 deletions.
97 changes: 51 additions & 46 deletions src/plugins/intel_cpu/src/nodes/conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,53 +332,58 @@ ov::element::Type Convolution::fusedEltwisePrecision(const NodePtr& fusingNode)
}

const std::vector<impl_desc_type>& Convolution::getDefaultImplPriority() {
static std::vector<impl_desc_type> priorities = {
impl_desc_type::unknown,
impl_desc_type::dw_acl,
impl_desc_type::winograd_acl,
impl_desc_type::gemm_acl,
impl_desc_type::acl,
impl_desc_type::brgconv_avx512_amx_1x1,
impl_desc_type::brgconv_avx512_amx,
impl_desc_type::jit_avx512_amx_dw,
impl_desc_type::jit_avx512_amx_1x1,
impl_desc_type::jit_avx512_amx,
impl_desc_type::brgconv_avx512_1x1,
impl_desc_type::brgconv_avx512,
impl_desc_type::jit_uni_dw,
impl_desc_type::jit_uni_1x1,
impl_desc_type::jit_uni,
impl_desc_type::jit_avx512_dw,
impl_desc_type::jit_avx512_1x1,
impl_desc_type::jit_avx512,
impl_desc_type::brgconv_avx2_1x1,
impl_desc_type::brgconv_avx2,
impl_desc_type::jit_avx2_dw,
impl_desc_type::jit_avx2_1x1,
impl_desc_type::jit_avx2,
impl_desc_type::jit_avx_dw,
impl_desc_type::jit_avx_1x1,
impl_desc_type::jit_avx,
impl_desc_type::jit_sse42_dw,
impl_desc_type::jit_sse42_1x1,
impl_desc_type::jit_sse42,
impl_desc_type::gemm_any,
impl_desc_type::gemm_blas,
impl_desc_type::gemm_avx512,
impl_desc_type::gemm_avx2,
impl_desc_type::gemm_avx,
impl_desc_type::gemm_sse42,
impl_desc_type::jit_gemm,
impl_desc_type::ref_any,
impl_desc_type::ref,
};
static const auto priorities = [] {
std::vector<impl_desc_type> priorities = {
impl_desc_type::unknown,
impl_desc_type::dw_acl,
impl_desc_type::winograd_acl,
impl_desc_type::gemm_acl,
impl_desc_type::acl,
impl_desc_type::brgconv_avx512_amx_1x1,
impl_desc_type::brgconv_avx512_amx,
impl_desc_type::jit_avx512_amx_dw,
impl_desc_type::jit_avx512_amx_1x1,
impl_desc_type::jit_avx512_amx,
impl_desc_type::brgconv_avx512_1x1,
impl_desc_type::brgconv_avx512,
impl_desc_type::jit_uni_dw,
impl_desc_type::jit_uni_1x1,
impl_desc_type::jit_uni,
impl_desc_type::jit_avx512_dw,
impl_desc_type::jit_avx512_1x1,
impl_desc_type::jit_avx512,
impl_desc_type::brgconv_avx2_1x1,
impl_desc_type::brgconv_avx2,
impl_desc_type::jit_avx2_dw,
impl_desc_type::jit_avx2_1x1,
impl_desc_type::jit_avx2,
impl_desc_type::jit_avx_dw,
impl_desc_type::jit_avx_1x1,
impl_desc_type::jit_avx,
impl_desc_type::jit_sse42_dw,
impl_desc_type::jit_sse42_1x1,
impl_desc_type::jit_sse42,
impl_desc_type::gemm_any,
impl_desc_type::gemm_blas,
impl_desc_type::gemm_avx512,
impl_desc_type::gemm_avx2,
impl_desc_type::gemm_avx,
impl_desc_type::gemm_sse42,
impl_desc_type::jit_gemm,
impl_desc_type::ref_any,
impl_desc_type::ref,
};
if (!isBrgConvAvailable()) {
priorities.erase(std::remove_if(priorities.begin(),
priorities.end(),
[](impl_desc_type type) {
return type & impl_desc_type::brgconv;
}),
priorities.end());
}

priorities.erase(std::remove_if(priorities.begin(),
priorities.end(),
[](impl_desc_type type) {
return !isBrgConvAvailable() && (type & impl_desc_type::brgconv);
}),
priorities.end());
return priorities;
}();

return priorities;
}
Expand Down

0 comments on commit 75ee009

Please sign in to comment.