diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp index 17558dcd01d1b6..b0172670a829ca 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp @@ -13,6 +13,10 @@ #include +#ifdef SNIPPETS_DEBUG_CAPS +#include "emitters/verbose.hpp" +#endif + namespace ov { namespace intel_cpu { @@ -29,6 +33,10 @@ struct emitter_params { }; class jit_emitter : public ov::snippets::Emitter { +#ifdef SNIPPETS_DEBUG_CAPS +friend class jit_debug_emitter; +#endif + public: jit_emitter(dnnl::impl::cpu::x64::jit_generator* host, dnnl::impl::cpu::x64::cpu_isa_t host_isa, ov::element::Type exec_prc = ov::element::f32, emitter_in_out_map in_out_type = emitter_in_out_map::vec_to_vec) @@ -51,6 +59,14 @@ class jit_emitter : public ov::snippets::Emitter { */ static std::set> get_supported_precisions(const std::shared_ptr& node = nullptr); +#ifdef SNIPPETS_DEBUG_CAPS + const char *info() const { + if (!info_.is_initialized()) + info_.init(this); + return info_.c_str(); + } +#endif + protected: virtual size_t aux_gprs_count() const; @@ -124,14 +140,6 @@ class jit_emitter : public ov::snippets::Emitter { entry_map_.insert(std::make_pair(key, te)); } - void push_entries_of(const table_t &t) { - for (auto it = t.begin(); it != t.end(); it++) { - auto key = (*it).first; - auto te = (*it).second; // copy values from table - push_arg_entry_of(key, te.val, te.bcast); - } - } - void internal_call_preamble() const; void internal_call_postamble() const; // align stack on 16-byte as ABI reqiures @@ -139,6 +147,10 @@ class jit_emitter : public ov::snippets::Emitter { void internal_call_rsp_align() const; void internal_call_rsp_restore() const; +#ifdef SNIPPETS_DEBUG_CAPS + mutable jit_emitter_info_t info_; +#endif + private: mutable std::vector preserved_vec_idxs; mutable std::vector preserved_gpr_idxs; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp index 817d2ad0152a48..404a5eb1159a69 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp @@ -33,11 +33,14 @@ #ifdef SNIPPETS_DEBUG_CAPS #include "emitters/snippets/x64/jit_perf_count_chrono_emitters.hpp" #include "emitters/snippets/x64/jit_perf_count_rdtsc_emitters.hpp" +#include "emitters/snippets/x64/jit_debug_emitter.hpp" +#include "emitters/snippets/x64/jit_segfault_detector_emitter.hpp" #include "transformations/snippets/x64/op/perf_count_rdtsc.hpp" #endif namespace ov { +#ifndef SNIPPETS_DEBUG_CAPS #define CREATE_SNIPPETS_EMITTER(e_type) { \ [this](const snippets::lowered::ExpressionPtr& expr) -> std::shared_ptr { \ return std::make_shared(h.get(), isa, expr); \ @@ -46,6 +49,45 @@ namespace ov { return e_type::get_supported_precisions(n); \ } \ } +#else +#define CREATE_SNIPPETS_EMITTER(e_type) { \ + [this](const snippets::lowered::ExpressionPtr& expr) -> std::shared_ptr { \ + auto emitter = std::make_shared(h.get(), isa, expr); \ + if (custom_segfault_detector) { \ + std::string type = #e_type; \ + if (type.find("jit_load_memory_emitter") != std::string::npos || \ + type.find("jit_load_broadcast_emitter") != std::string::npos || \ + type.find("jit_load_convert_emitter") != std::string::npos) { \ + auto segfault_emitter = \ + std::make_shared(h.get(), isa, emitter.get(), true, false, expr->get_node()->get_friendly_name()); \ + return std::make_shared(emitter, segfault_emitter); \ + } else if (type.find("jit_store_memory_emitter") != std::string::npos || \ + type.find("jit_store_convert_emitter") != std::string::npos) { \ + auto segfault_emitter = \ + std::make_shared(h.get(), isa, emitter.get(), false, true, expr->get_node()->get_friendly_name()); \ + return std::make_shared(emitter, segfault_emitter); \ + } else if (type.find("jit_brgemm_emitter") != std::string::npos || \ + type.find("jit_brgemm_copy_b_emitter") != std::string::npos || \ + type.find("jit_kernel_emitter") != std::string::npos) { \ + auto segfault_emitter = \ + std::make_shared(h.get(), isa, emitter.get(), false, false, expr->get_node()->get_friendly_name()); \ + return std::make_shared(emitter, segfault_emitter); \ + } else { \ + return emitter; \ + /* use below jit_debug_emitter if want enable segfault detector for all other non-typical memory access emitters */ \ + /* auto segfault_emitter = */ \ + /* std::make_shared(h.get(), isa, emitter.get(), false, false, expr->get_node()->get_friendly_name()); */ \ + /* return std::make_shared(emitter, segfault_emitter); */ \ + } \ + } else { \ + return emitter; \ + } \ + }, \ + [](const std::shared_ptr& n) -> std::set> { \ + return e_type::get_supported_precisions(n); \ + } \ +} +#endif #define CREATE_CPU_EMITTER(e_type) { \ [this](const snippets::lowered::ExpressionPtr& expr) -> std::shared_ptr { \ diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.cpp index 43c7b18ea5fb04..c0f3279fc9fe94 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.cpp @@ -66,11 +66,6 @@ jit_brgemm_copy_b_emitter::jit_brgemm_copy_b_emitter(jit_generator* h, cpu_isa_t const bool isAMXSupported = mayiuse(avx512_core_amx); const auto use_amx = isAMXSupported && m_brgemm_prc_in0 != ov::element::f32 && (m_K % m_brgemmVNNIFactor == 0) && (m_N % m_brgemmVNNIFactor == 0); init_brgemm_copy(m_kernel, leading_dimension, m_N_blk, m_N_tail, m_LDB, m_K - m_K_tail, use_amx, dt_in0, dt_in1); -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, false, false, brgemm_repack->get_friendly_name())); -#endif } void jit_brgemm_copy_b_emitter::init_brgemm_copy(std::unique_ptr& kernel, @@ -112,10 +107,6 @@ void jit_brgemm_copy_b_emitter::init_brgemm_copy(std::unique_ptr& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == cpu::x64::avx512_core) { Xbyak::Reg64 src(static_cast(in[0])); Xbyak::Reg64 dst(static_cast(out[0])); diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.hpp index 16c098742e42fd..4a4d6883fe524a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_copy_b_emitter.hpp @@ -8,10 +8,6 @@ #include -#ifdef SNIPPETS_DEBUG_CAPS -#include "jit_segfault_detector_emitter.hpp" -#endif - namespace ov { namespace intel_cpu { @@ -52,8 +48,7 @@ class jit_brgemm_copy_b_emitter : public jit_emitter { size_t m_comp_offset = 0lu; #ifdef SNIPPETS_DEBUG_CAPS - friend class jit_uni_segfault_detector_emitter; - std::shared_ptr segfault_detector_emitter = nullptr; + friend std::string init_info_jit_brgemm_copy_b_emitter(const jit_brgemm_copy_b_emitter *emitter); #endif }; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.cpp index c38c16a43f88e0..d0defff82b5e9a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.cpp @@ -125,12 +125,6 @@ jit_brgemm_emitter::jit_brgemm_emitter(jit_generator* h, cpu_isa_t isa, const ov m_store_offset_c = brgemm_node->get_offset_c(); if (m_with_scratch) m_load_offset_scratch = brgemm_node->get_offset_scratch(); - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, false, false, brgemm_node->get_friendly_name())); -#endif } std::set> jit_brgemm_emitter::get_supported_precisions(const std::shared_ptr& node) { @@ -184,10 +178,6 @@ void jit_brgemm_emitter::validate_arguments(const std::vector &in, const void jit_brgemm_emitter::emit_impl(const std::vector& in, const std::vector& out) const { validate_arguments(in, out); -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == cpu::x64::avx512_core) { Xbyak::Reg64 input_0(static_cast(in[0])); Xbyak::Reg64 input_1(static_cast(in[1])); diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.hpp index f0fbb36e591778..b097dcb3152220 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_brgemm_emitter.hpp @@ -8,10 +8,6 @@ #include -#ifdef SNIPPETS_DEBUG_CAPS -#include "jit_segfault_detector_emitter.hpp" -#endif - namespace ov { namespace intel_cpu { @@ -60,8 +56,7 @@ class jit_brgemm_emitter : public jit_emitter { std::vector io_data_size {}; #ifdef SNIPPETS_DEBUG_CAPS - friend class jit_uni_segfault_detector_emitter; - std::shared_ptr segfault_detector_emitter = nullptr; + friend std::string init_info_jit_brgemm_emitter(const jit_brgemm_emitter *emitter); #endif }; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.cpp new file mode 100644 index 00000000000000..f18db13bb63198 --- /dev/null +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.cpp @@ -0,0 +1,97 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#ifdef SNIPPETS_DEBUG_CAPS + +#include "jit_debug_emitter.hpp" +#include +#include "utils/general_utils.h" + +using namespace dnnl::impl::cpu; +using namespace dnnl::impl; +using namespace Xbyak; + +namespace ov { +namespace intel_cpu { + +size_t jit_debug_emitter::get_inputs_num() const { + return m_target_emitter->get_inputs_num(); +} + +size_t jit_debug_emitter::get_max_vecs_count() const { + return m_target_emitter->get_max_vecs_count(); +} + +size_t jit_debug_emitter::get_vec_length() const { + return m_target_emitter->get_vec_length(); +} + +void jit_debug_emitter::push_vec(const Xbyak::Address &addr, size_t vec_idx) const { + m_target_emitter->push_vec(addr, vec_idx); +} + +void jit_debug_emitter::pop_vec(size_t vec_idx, const Xbyak::Address &addr) const { + m_target_emitter->pop_vec(vec_idx, addr); +} + +size_t jit_debug_emitter::aux_vecs_count() const { + return m_target_emitter->aux_vecs_count(); +} + +emitter_in_out_map jit_debug_emitter::get_in_out_type() const { + return m_target_emitter->get_in_out_type(); +} + +size_t jit_debug_emitter::aux_gprs_count() const { + return m_target_emitter->aux_gprs_count(); +} + +std::set> jit_debug_emitter::get_supported_precisions(const std::shared_ptr& node) { + return jit_emitter::get_supported_precisions(node); +} + +void jit_debug_emitter::emitter_preamble(const std::vector &in_idxs, const std::vector &out_idxs, + const std::vector &pool_vec_idxs, const std::vector &pool_gpr_idxs) const { + m_target_emitter->emitter_preamble(in_idxs, out_idxs, pool_vec_idxs, pool_gpr_idxs); +} + +void jit_debug_emitter::emitter_postamble() const { + m_target_emitter->emitter_postamble(); +} + +void jit_debug_emitter::emit_data() const { + m_target_emitter->emit_data(); +} + +void jit_debug_emitter::prepare_table() { + m_target_emitter->prepare_table(); +} + +void jit_debug_emitter::emit_code(const std::vector &in_idxs, const std::vector &out_idxs, + const std::vector &pool_vec_idxs, const std::vector &pool_gpr_idxs) const { + m_decorator_emitter->emit_code(in_idxs, out_idxs, pool_vec_idxs, pool_gpr_idxs); + + m_target_emitter->emit_code(in_idxs, out_idxs, pool_vec_idxs, pool_gpr_idxs); +} + +void jit_debug_emitter::internal_call_preamble() const { + m_target_emitter->internal_call_preamble(); +} + +void jit_debug_emitter::internal_call_postamble() const { + m_target_emitter->internal_call_postamble(); +} + +void jit_debug_emitter::internal_call_rsp_align() const { + m_target_emitter->internal_call_rsp_align(); +} + +void jit_debug_emitter::internal_call_rsp_restore() const { + m_target_emitter->internal_call_rsp_restore(); +} + +} // namespace intel_cpu +} // namespace ov + +#endif \ No newline at end of file diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp new file mode 100644 index 00000000000000..6ec43fa85b49ff --- /dev/null +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp @@ -0,0 +1,111 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#ifdef SNIPPETS_DEBUG_CAPS + +#pragma once + +#include "emitters/plugin/x64/jit_emitter.hpp" + +namespace ov { +namespace intel_cpu { + +class jit_debug_emitter : public jit_emitter { +public: + jit_debug_emitter(const std::shared_ptr& target_emitter, const std::shared_ptr& decorator_emitter) + : jit_emitter(target_emitter->h, target_emitter->host_isa_), + m_target_emitter(target_emitter), m_decorator_emitter(decorator_emitter) {} + + void emit_code(const std::vector &in_idxs, const std::vector &out_idxs, + const std::vector &pool_vec_idxs = {}, const std::vector &pool_gpr_idxs = {}) const override; + void emit_data() const override; + + size_t get_inputs_num() const override; + size_t aux_vecs_count() const override; + emitter_in_out_map get_in_out_type() const; + + /** + * @brief Returns supported precisions. + * Precisions are ordered, the first bigger bitness precision with the same type will be selected. + * Empty collection means the emitter supports any input precisions. + */ + static std::set> get_supported_precisions(const std::shared_ptr& node = nullptr); + +protected: + size_t aux_gprs_count() const override; + + size_t get_max_vecs_count() const; + size_t get_vec_length() const; + + void prepare_table() override; + void register_table_entries() override { + m_target_emitter->register_table_entries(); + } + + void load_table_addr() const { m_target_emitter->load_table_addr(); } + + mutable Xbyak::Reg64 p_table; + mutable std::shared_ptr l_table; + + + void emit_impl(const std::vector &in_idxs, const std::vector &out_idxs) const override { + m_target_emitter->emit_impl(in_idxs, out_idxs); + } + + void emitter_preamble(const std::vector &in_idxs, const std::vector &out_idxs, + const std::vector &pool_vec_idxs, const std::vector &pool_gpr_idxs) const override; + void emitter_postamble() const override; + + emitter_in_out_map in_out_type_; + + mutable std::vector aux_vec_idxs; + mutable std::vector aux_gpr_idxs; + + Xbyak::Address table_val(std::string key, size_t key_off_val_shift = 0) const { + return m_target_emitter->table_val(key, key_off_val_shift); + } + + using table_t = std::multimap; + using mapped_table_t = std::multimap; + + mapped_table_t entry_map_; + + void push_arg_entry_of(const std::string key, const table_entry_val_t val, const bool broadcast) { + m_target_emitter->push_arg_entry_of(key, val, broadcast); + } + + // void push_entries_of(const table_t &t) { + // const table_t& table = t; + // m_target_emitter->push_entries_of(table); + // } + + void internal_call_preamble() const; + void internal_call_postamble() const; + // align stack on 16-byte as ABI reqiures + // callee is responsible to save and restore rbx. rbx must not be changed after call callee. + void internal_call_rsp_align() const; + void internal_call_rsp_restore() const; + +private: + mutable std::vector preserved_vec_idxs; + mutable std::vector preserved_gpr_idxs; + + void push_vec(const Xbyak::Address &addr, size_t vec_idx) const; + void pop_vec(size_t vec_idx, const Xbyak::Address &addr) const; + + size_t table_off(std::string& key, size_t key_off_val_shift = 0) const { + return m_target_emitter->table_off(key, key_off_val_shift); + } + void validate_arguments(const std::vector& arg0, const std::vector& arg1) const override { + m_target_emitter->validate_arguments(arg0, arg1); + } + + const std::shared_ptr m_target_emitter; + const std::shared_ptr m_decorator_emitter; +}; + +} // namespace intel_cpu +} // namespace ov + +#endif \ No newline at end of file diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.cpp index 72b6b455f8d259..244beb5c3a6758 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.cpp @@ -119,21 +119,11 @@ jit_kernel_emitter::jit_kernel_emitter(jit_generator* h, cpu_isa_t isa, const ov gpr_map_pool.second.push_back(reg_indexes_idx); gpr_map_pool.second.push_back(reg_const_params_idx); map_abstract_registers(gpr_map_pool, vec_map_pool, general_exprs); - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, false, false, kernel->get_friendly_name())); -#endif } void jit_kernel_emitter::emit_code(const std::vector &in, const std::vector &out, const std::vector &pool_vec_idx, const std::vector &pool_gpr_idxs) const { validate_arguments(in, out); -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif emit_impl(in, out); } diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.hpp index f6b8bd62fd44ad..5a93fbeac2659a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_kernel_emitter.hpp @@ -8,10 +8,6 @@ #include "jit_container_emitter.hpp" -#ifdef SNIPPETS_DEBUG_CAPS -#include "jit_segfault_detector_emitter.hpp" -#endif - namespace ov { namespace intel_cpu { @@ -82,8 +78,7 @@ class jit_kernel_emitter : public jit_container_emitter { const size_t reg_const_params_idx; #ifdef SNIPPETS_DEBUG_CAPS - friend class jit_uni_segfault_detector_emitter; - std::shared_ptr segfault_detector_emitter = nullptr; + friend std::string init_info_jit_kernel_emitter(const jit_kernel_emitter *emitter); #endif }; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.cpp index f152a47c1c608d..6968583d467ad6 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.cpp @@ -38,20 +38,11 @@ jit_load_memory_emitter::jit_load_memory_emitter(jit_generator* h, cpu_isa_t isa byte_offset = load->get_offset(); in_out_type_ = emitter_in_out_map::gpr_to_vec; load_emitter.reset(new jit_load_emitter(h, isa, src_prc, dst_prc, count)); - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, true, false, load->get_friendly_name())); -#endif } void jit_load_memory_emitter::emit_impl(const std::vector& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif + h->int_(11); if (host_isa_ == dnnl::impl::cpu::x64::sse41) { emit_isa(in, out); } else if (host_isa_ == dnnl::impl::cpu::x64::avx2) { @@ -85,20 +76,10 @@ jit_load_broadcast_emitter::jit_load_broadcast_emitter(jit_generator* h, cpu_isa const auto broadcast_load = std::dynamic_pointer_cast(expr->get_node()); byte_offset = broadcast_load->get_offset(); in_out_type_ = emitter_in_out_map::gpr_to_vec; - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, true, false, broadcast_load->get_friendly_name())); -#endif } void jit_load_broadcast_emitter::emit_impl(const std::vector& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == dnnl::impl::cpu::x64::sse41) { emit_isa(in, out); } else if (host_isa_ == dnnl::impl::cpu::x64::avx2) { @@ -134,20 +115,10 @@ jit_load_convert_emitter::jit_load_convert_emitter(jit_generator* h, cpu_isa_t i byte_offset = load->get_offset(); in_out_type_ = emitter_in_out_map::gpr_to_vec; load_emitter.reset(new jit_load_emitter(h, isa, src_prc, dst_prc, count)); - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, true, false, load->get_friendly_name())); -#endif } void jit_load_convert_emitter::emit_impl(const std::vector& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == dnnl::impl::cpu::x64::sse41) { emit_isa(in, out); } else if (host_isa_ == dnnl::impl::cpu::x64::avx2) { @@ -182,20 +153,10 @@ jit_store_memory_emitter::jit_store_memory_emitter(jit_generator* h, cpu_isa_t i byte_offset = store->get_offset(); in_out_type_ = emitter_in_out_map::vec_to_gpr; store_emitter.reset(new jit_store_emitter(h, isa, src_prc, dst_prc, count)); - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, false, true, store->get_friendly_name())); -#endif } void jit_store_memory_emitter::emit_impl(const std::vector& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == dnnl::impl::cpu::x64::sse41) { emit_isa(in, out); } else if (host_isa_ == dnnl::impl::cpu::x64::avx2) { @@ -230,20 +191,10 @@ jit_store_convert_emitter::jit_store_convert_emitter(jit_generator* h, cpu_isa_t } else if (ov::is_type(expr->get_node())) { store_emitter.reset(new jit_store_emitter(h, isa, src_prc, dst_prc, count, arithmetic_mode::saturation)); } - -#ifdef SNIPPETS_DEBUG_CAPS - DebugCapsConfig debugCaps; - if (!debugCaps.snippets_segfault_detector.empty()) - segfault_detector_emitter.reset(new jit_uni_segfault_detector_emitter(h, isa, this, false, true, store->get_friendly_name())); -#endif } void jit_store_convert_emitter::emit_impl(const std::vector& in, const std::vector& out) const { -#ifdef SNIPPETS_DEBUG_CAPS - if (segfault_detector_emitter != nullptr) - segfault_detector_emitter->emit_code(in, out); -#endif if (host_isa_ == dnnl::impl::cpu::x64::sse41) { emit_isa(in, out); } else if (host_isa_ == dnnl::impl::cpu::x64::avx2) { diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.hpp index c29873f805037b..f26249b2add11a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_memory_emitters.hpp @@ -7,10 +7,6 @@ #include "emitters/plugin/x64/jit_emitter.hpp" #include "emitters/plugin/x64/jit_load_store_emitters.hpp" -#ifdef SNIPPETS_DEBUG_CAPS -#include "jit_segfault_detector_emitter.hpp" -#endif - namespace ov { namespace intel_cpu { @@ -26,8 +22,7 @@ class jit_memory_emitter : public jit_emitter { size_t count = 0; size_t byte_offset = 0; #ifdef SNIPPETS_DEBUG_CAPS - friend class jit_uni_segfault_detector_emitter; - std::shared_ptr segfault_detector_emitter = nullptr; + friend std::string init_info_jit_memory_emitter(const jit_memory_emitter *emitter); #endif }; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp index 00185030daf714..109950dd3a668e 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp @@ -6,11 +6,6 @@ #include "jit_segfault_detector_emitter.hpp" -#include "jit_memory_emitters.hpp" -#include "jit_brgemm_emitter.hpp" -#include "jit_brgemm_copy_b_emitter.hpp" -#include "jit_kernel_emitter.hpp" - using namespace dnnl::impl::utils; using namespace dnnl::impl; using namespace dnnl::impl::cpu::x64; @@ -33,6 +28,10 @@ jit_uni_segfault_detector_emitter::jit_uni_segfault_detector_emitter(dnnl::impl: size_t jit_uni_segfault_detector_emitter::get_inputs_num() const { return 1; } +const jit_emitter* jit_uni_segfault_detector_emitter::get_target_emitter() const { + return m_target_emitter; +} + void jit_uni_segfault_detector_emitter::emit_impl(const std::vector& in_vec_idxs, const std::vector& out_vec_idxs) const { save_target_emitter(); if (is_target_use_load_emitter) { @@ -68,6 +67,8 @@ void jit_uni_segfault_detector_emitter::memory_track(size_t gpr_idx_for_mem_addr h->cmp(h->qword[h->r15], 0); h->jne(label_set_address_current); h->mov(h->qword[h->r15], Xbyak::Reg64(gpr_idx_for_mem_address)); + h->mov(h->r15, reinterpret_cast(¤t_address)); + h->mov(h->qword[h->r15], Xbyak::Reg64(gpr_idx_for_mem_address)); h->jmp(label_set_address_end); h->L(label_set_address_current); { @@ -81,115 +82,6 @@ void jit_uni_segfault_detector_emitter::memory_track(size_t gpr_idx_for_mem_addr h->pop(h->r15); } -std::string jit_uni_segfault_detector_emitter::get_target_emitter_type_name(const jit_emitter* emitter) { - std::string name = typeid(*emitter).name(); -#ifndef _WIN32 - int status; - std::unique_ptr demangled_name( - abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status), - std::free); - name = demangled_name.get(); -#endif - return name; -} - -template -std::string join(const T& v, const std::string& sep = ", ") { - std::ostringstream ss; - size_t count = 0; - for (const auto& x : v) { - if (count++ > 0) { - ss << sep; - } - ss << x; - } - return ss.str(); -} - -template -std::string vector_to_string(const T& v) { - std::ostringstream os; - os << "[ " << ov::util::join(v) << " ]"; - return os.str(); -} - -void jit_uni_segfault_detector_emitter::print() { - auto print_memory_emitter_info = [&](jit_memory_emitter *memory_emitter) { - std::cerr << "detailed emitter info is, src precision:" << memory_emitter->src_prc << ", dst precision:" << memory_emitter->dst_prc - << ", load/store element number:" << memory_emitter->count - << ", byte offset" << memory_emitter->byte_offset << std::endl; - // more memory address info tracked in detector_emitter. - std::cerr << "start_address:" << start_address - << ", current_address:" << current_address - << ", iteration:" << iteration << "\n"; - }; - auto print_brgemm_emitter_info = [&](jit_brgemm_emitter* brgemm_emitter) { - std::cerr << "detailed emitter info is, m_ctx.M:" << brgemm_emitter->m_ctx.M - << " m_ctx.K:" << brgemm_emitter->m_ctx.K - << " m_ctx.N:" << brgemm_emitter->m_ctx.N - << " m_ctx.LDA:" << brgemm_emitter->m_ctx.LDA - << " m_ctx.LDB:" << brgemm_emitter->m_ctx.LDB - << " m_ctx.LDC:" << brgemm_emitter->m_ctx.LDC - << " m_ctx.dt_in0:" << brgemm_emitter->m_ctx.dt_in0 - << " m_ctx.dt_in1:" << brgemm_emitter->m_ctx.dt_in1 - << " m_ctx.palette:" << brgemm_emitter->m_ctx.palette - << " m_ctx.is_with_amx:" << brgemm_emitter->m_ctx.is_with_amx - << " m_ctx.is_with_comp:" << brgemm_emitter->m_ctx.is_with_comp - << " m_ctx.beta:" << brgemm_emitter->m_ctx.beta - << " m_load_offset_a:" << brgemm_emitter->m_load_offset_a - << " m_load_offset_b:" << brgemm_emitter->m_load_offset_b - << " m_load_offset_scratch:" << brgemm_emitter->m_load_offset_scratch - << " m_store_offset_c:" << brgemm_emitter->m_store_offset_c - << " m_with_scratch:" << brgemm_emitter->m_with_scratch - << " m_with_comp:" << brgemm_emitter->m_with_comp << "\n"; - }; - auto print_brgemm_copy_emitter_info = [&](jit_brgemm_copy_b_emitter* brgemm_copy_emitter) { - std::cerr << "detailed emitter info is, m_LDB:" << brgemm_copy_emitter->m_LDB - << " m_K:" << brgemm_copy_emitter->m_K - << " m_K_blk:" << brgemm_copy_emitter->m_K_blk - << " m_K_tail:" << brgemm_copy_emitter->m_K_tail - << " m_N:" << brgemm_copy_emitter->m_N - << " m_N_blk:" << brgemm_copy_emitter->m_N_blk - << " m_N_tail:" << brgemm_copy_emitter->m_N_tail - << " m_brgemm_prc_in0:" << brgemm_copy_emitter->m_brgemm_prc_in0 - << " m_brgemm_prc_in1:" << brgemm_copy_emitter->m_brgemm_prc_in1 - << " m_brgemmVNNIFactor:" << brgemm_copy_emitter->m_brgemmVNNIFactor - << " m_with_comp:" << brgemm_copy_emitter->m_with_comp - << " m_in_offset:" << brgemm_copy_emitter->m_in_offset - << " m_out_offset:" << brgemm_copy_emitter->m_out_offset - << " m_comp_offset:" << brgemm_copy_emitter->m_comp_offset << "\n"; - }; - auto print_kernel_emitter_info = [&](jit_kernel_emitter* kernel_emitter) { - std::cerr << "detailed emitter info is, jcp.parallel_executor_ndims:"<< kernel_emitter->jcp.parallel_executor_ndims - << " gp_regs_pool:"<< vector_to_string(kernel_emitter->gp_regs_pool) - << " master_shape:" << vector_to_string(kernel_emitter->master_shape) - << " num_inputs:" << kernel_emitter->num_inputs - << " num_outputs:" << kernel_emitter->num_outputs - << " num_unique_buffers:" << kernel_emitter->num_unique_buffers - << " io_data_sizes:" << vector_to_string(kernel_emitter->io_data_sizes) - << " data_ptr_regs_idx:" << vector_to_string(kernel_emitter->data_ptr_regs_idx) - << " vec_regs_pool:" << vector_to_string(kernel_emitter->vec_regs_pool) - << " reg_indexes_idx:" << kernel_emitter->reg_indexes_idx - << " reg_const_params_idx:" << kernel_emitter->reg_const_params_idx << "\n"; - for (size_t i = 0; i < kernel_emitter->io_data_layouts.size(); ++i) - std::cerr << "io_data_layouts for " << i << " is:"<< vector_to_string(kernel_emitter->io_data_layouts[i]) << "\n"; - for (size_t i = 0; i < kernel_emitter->io_shapes.size(); ++i) - std::cerr << "io_shapes for " << i << " is:"<< vector_to_string(kernel_emitter->io_shapes[i]) << "\n"; - }; - - std::cerr << "Node name:" << m_target_node_name << std::endl; - std::cerr << "Emitter type name:" << get_target_emitter_type_name(m_target_emitter) << std::endl; - if (auto *memory_emitter = dynamic_cast(m_target_emitter)) { - print_memory_emitter_info(memory_emitter); - } else if (auto *brgemm_emitter = dynamic_cast(m_target_emitter)) { - print_brgemm_emitter_info(brgemm_emitter); - } else if (auto *brgemm_copy_emitter = dynamic_cast(m_target_emitter)) { - print_brgemm_copy_emitter_info(brgemm_copy_emitter); - } else if (auto *kernel_emitter = dynamic_cast(m_target_emitter)) { - print_kernel_emitter_info(kernel_emitter); - } -} - } // namespace intel_cpu } // namespace ov diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.hpp index 8ffe55c80562c6..e0c933e374e230 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.hpp @@ -10,10 +10,6 @@ #include "emitters/plugin/x64/jit_emitter.hpp" #include "openvino/runtime/threading/thread_local.hpp" -#ifndef _WIN32 -#include -#endif - using namespace ov::threading; namespace ov { @@ -29,7 +25,7 @@ class jit_uni_segfault_detector_emitter : public jit_emitter { size_t get_inputs_num() const override; - void print(); + const jit_emitter* get_target_emitter() const; private: // emit code is to save "this" pointer(jit_uni_segfault_detector_emitter) to global handler, then print info w/ it's target_emitter. @@ -48,6 +44,8 @@ class jit_uni_segfault_detector_emitter : public jit_emitter { mutable size_t start_address = 0; mutable size_t current_address = 0; mutable size_t iteration = 0; + + friend std::string init_info_jit_uni_segfault_detector_emitter(const jit_uni_segfault_detector_emitter *emitter); }; } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/emitters/verbose.cpp b/src/plugins/intel_cpu/src/emitters/verbose.cpp new file mode 100644 index 00000000000000..1e4e1104bb0fe1 --- /dev/null +++ b/src/plugins/intel_cpu/src/emitters/verbose.cpp @@ -0,0 +1,195 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#ifdef SNIPPETS_DEBUG_CAPS + +#include "verbose.hpp" +#include "snippets/x64/jit_segfault_detector_emitter.hpp" +#include "snippets/x64/jit_memory_emitters.hpp" +#include "snippets/x64/jit_brgemm_emitter.hpp" +#include "snippets/x64/jit_brgemm_copy_b_emitter.hpp" +#include "snippets/x64/jit_kernel_emitter.hpp" + +namespace ov { +namespace intel_cpu { + +template +std::string join(const T& v, const std::string& sep = ", ") { + std::ostringstream ss; + size_t count = 0; + for (const auto& x : v) { + if (count++ > 0) { + ss << sep; + } + ss << x; + } + return ss.str(); +} + +template +std::string vector_to_string(const T& v) { + std::ostringstream os; + os << "[ " << ov::util::join(v) << " ]"; + return os.str(); +} + +std::string init_info_jit_memory_emitter(const jit_memory_emitter *emitter) { + std::stringstream ss; + ss << " src_precision:" << emitter->src_prc + << " dst_precision:" << emitter->dst_prc + << " load/store_element_number:" << emitter->count + << " byte_offset:" << emitter->byte_offset; + return ss.str(); +} + +static std::string init_info_jit_load_memory_emitter(const jit_load_memory_emitter *emitter) { + std::stringstream ss; + std::string memory_emitter_info = init_info_jit_memory_emitter(emitter); + ss << "Emitter_type_name:jit_load_memory_emitter" + << memory_emitter_info; + return ss.str(); +} + +static std::string init_info_jit_load_broadcast_emitter(const jit_load_broadcast_emitter *emitter) { + std::stringstream ss; + std::string memory_emitter_info = init_info_jit_memory_emitter(emitter); + ss << "Emitter_type_name:jit_load_broadcast_emitter" + << memory_emitter_info; + return ss.str(); +} + +static std::string init_info_jit_load_convert_emitter(const jit_load_convert_emitter *emitter) { + std::stringstream ss; + std::string memory_emitter_info = init_info_jit_memory_emitter(emitter); + ss << "Emitter_type_name:jit_load_convert_emitter" + << memory_emitter_info; + return ss.str(); +} + +static std::string init_info_jit_store_memory_emitter(const jit_store_memory_emitter *emitter) { + std::stringstream ss; + std::string memory_emitter_info = init_info_jit_memory_emitter(emitter); + ss << "Emitter_type_name:jit_store_memory_emitter" + << memory_emitter_info; + return ss.str(); +} + +static std::string init_info_jit_store_convert_emitter(const jit_store_convert_emitter *emitter) { + std::stringstream ss; + std::string memory_emitter_info = init_info_jit_memory_emitter(emitter); + ss << "Emitter_type_name:jit_store_convert_emitter" + << memory_emitter_info; + return ss.str(); +} + +std::string init_info_jit_brgemm_emitter(const jit_brgemm_emitter *emitter) { + std::stringstream ss; + ss << "Emitter_type_name:jit_brgemm_emitter" + << " m_ctx.M:" << emitter->m_ctx.M + << " m_ctx.K:" << emitter->m_ctx.K + << " m_ctx.N:" << emitter->m_ctx.N + << " m_ctx.LDA:" << emitter->m_ctx.LDA + << " m_ctx.LDB:" << emitter->m_ctx.LDB + << " m_ctx.LDC:" << emitter->m_ctx.LDC + << " m_ctx.dt_in0:" << emitter->m_ctx.dt_in0 + << " m_ctx.dt_in1:" << emitter->m_ctx.dt_in1 + << " m_ctx.palette:" << emitter->m_ctx.palette + << " m_ctx.is_with_amx:" << emitter->m_ctx.is_with_amx + << " m_ctx.is_with_comp:" << emitter->m_ctx.is_with_comp + << " m_ctx.beta:" << emitter->m_ctx.beta + << " m_load_offset_a:" << emitter->m_load_offset_a + << " m_load_offset_b:" << emitter->m_load_offset_b + << " m_load_offset_scratch:" << emitter->m_load_offset_scratch + << " m_store_offset_c:" << emitter->m_store_offset_c + << " m_with_scratch:" << emitter->m_with_scratch + << " m_with_comp:" << emitter->m_with_comp; + + return ss.str(); +} + +std::string init_info_jit_brgemm_copy_b_emitter(const jit_brgemm_copy_b_emitter *emitter) { + std::stringstream ss; + ss << "Emitter_type_name:jit_brgemm_copy_b_emitter" + << " m_LDB:" << emitter->m_LDB + << " m_K:" << emitter->m_K + << " m_K_blk:" << emitter->m_K_blk + << " m_K_tail:" << emitter->m_K_tail + << " m_N:" << emitter->m_N + << " m_N_blk:" << emitter->m_N_blk + << " m_N_tail:" << emitter->m_N_tail + << " m_brgemm_prc_in0:" << emitter->m_brgemm_prc_in0 + << " m_brgemm_prc_in1:" << emitter->m_brgemm_prc_in1 + << " m_brgemmVNNIFactor:" << emitter->m_brgemmVNNIFactor + << " m_with_comp:" << emitter->m_with_comp + << " m_in_offset:" << emitter->m_in_offset + << " m_out_offset:" << emitter->m_out_offset + << ",m_comp_offset:" << emitter->m_comp_offset; + + return ss.str(); +} + +std::string init_info_jit_kernel_emitter(const jit_kernel_emitter *emitter) { + std::stringstream ss; + ss << "Emitter_type_name:jit_kernel_emitter" + << " jcp.parallel_executor_ndims:" << emitter->jcp.parallel_executor_ndims + << " gp_regs_pool:"<< vector_to_string(emitter->gp_regs_pool) + << " master_shape:" << vector_to_string(emitter->master_shape) + << " num_inputs:" << emitter->num_inputs + << " num_outputs:" << emitter->num_outputs + << " num_unique_buffers:" << emitter->num_unique_buffers + << " io_data_sizes:" << vector_to_string(emitter->io_data_sizes) + << " data_ptr_regs_idx:" << vector_to_string(emitter->data_ptr_regs_idx) + << " vec_regs_pool:" << vector_to_string(emitter->vec_regs_pool) + << " reg_indexes_idx:" << emitter->reg_indexes_idx + << " reg_const_params_idx:" << emitter->reg_const_params_idx; + for (size_t i = 0; i < emitter->io_data_layouts.size(); ++i) + ss << " io_data_layouts for " << i << " is:" << vector_to_string(emitter->io_data_layouts[i]); + for (size_t i = 0; i < emitter->io_shapes.size(); ++i) + ss << " io_shapes for " << i << " is: "<< vector_to_string(emitter->io_shapes[i]); + return ss.str(); +} + +std::string init_info_jit_uni_segfault_detector_emitter(const jit_uni_segfault_detector_emitter *emitter) { + std::stringstream ss; + ss << "Node_name:" << emitter->m_target_node_name + << " use_load_emitter:"<< emitter->is_target_use_load_emitter + << " use_store_emitter:"<< emitter->is_target_use_store_emitter; + if (emitter->is_target_use_load_emitter || emitter->is_target_use_store_emitter) { + ss << " start_address:" << emitter->start_address + << " current_address:" << emitter->current_address + << " iteration:" << emitter->iteration; + } + return ss.str(); +} + +void jit_emitter_info_t::init(const jit_emitter *emitter) { + if (is_initialized_) return; + + std::string emitter_name = typeid(*emitter).name(); + if (emitter_name.find("jit_load_memory_emitter") != std::string::npos) { + str_ = init_info_jit_load_memory_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_load_broadcast_emitter") != std::string::npos) { + str_ = init_info_jit_load_broadcast_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_load_convert_emitter") != std::string::npos) { + str_ = init_info_jit_load_convert_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_store_memory_emitter") != std::string::npos) { + str_ = init_info_jit_store_memory_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_store_convert_emitter") != std::string::npos) { + str_ = init_info_jit_store_convert_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_brgemm_copy_b_emitter") != std::string::npos) { + str_ = init_info_jit_brgemm_copy_b_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_brgemm_emitter") != std::string::npos) { + str_ = init_info_jit_brgemm_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_kernel_emitter") != std::string::npos) { + str_ = init_info_jit_kernel_emitter(dynamic_cast(emitter)); + } else if (emitter_name.find("jit_uni_segfault_detector_emitter") != std::string::npos) { + str_ = init_info_jit_uni_segfault_detector_emitter(dynamic_cast(emitter)); + } + is_initialized_ = true; +} + +} // namespace intel_cpu +} // namespace ov + +#endif \ No newline at end of file diff --git a/src/plugins/intel_cpu/src/emitters/verbose.hpp b/src/plugins/intel_cpu/src/emitters/verbose.hpp new file mode 100644 index 00000000000000..840ae871b5a293 --- /dev/null +++ b/src/plugins/intel_cpu/src/emitters/verbose.hpp @@ -0,0 +1,37 @@ +// Copyright (C) 2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#ifdef SNIPPETS_DEBUG_CAPS + +#pragma once + +#include + +namespace ov { +namespace intel_cpu { +class jit_emitter; +struct jit_emitter_info_t { + jit_emitter_info_t() = default; + jit_emitter_info_t(const jit_emitter_info_t &rhs) + : str_(rhs.str_), is_initialized_(rhs.is_initialized_) {} + jit_emitter_info_t &operator=(const jit_emitter_info_t &rhs) { + is_initialized_ = rhs.is_initialized_; + str_ = rhs.str_; + return *this; + } + + const char *c_str() const { return str_.c_str(); } + bool is_initialized() const { return is_initialized_; } + + void init(const jit_emitter *emitter); + +private: + std::string str_; + bool is_initialized_ = false; +}; + +} // namespace intel_cpu +} // namespace ov + +#endif \ No newline at end of file diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/subgraph.cpp index 7c090c7b5435b0..b0635aab288ef6 100644 --- a/src/plugins/intel_cpu/src/nodes/subgraph.cpp +++ b/src/plugins/intel_cpu/src/nodes/subgraph.cpp @@ -518,8 +518,12 @@ void Snippet::SnippetJitExecutor::segfault_detector() { if (enable_segfault_detector) { __sighandler_t signal_handler = [](int signal) { std::lock_guard guard(err_print_lock); - if (auto segfault_detector_emitter = ov::intel_cpu::g_custom_segfault_handler->local()) - segfault_detector_emitter->print(); + if (auto segfault_detector_emitter = ov::intel_cpu::g_custom_segfault_handler->local()) { + std::cout << segfault_detector_emitter->info() << std::endl; + if (auto target_e = segfault_detector_emitter->get_target_emitter()) { + std::cout << target_e->info() << std::endl; + } + } auto tid = parallel_get_thread_num(); OPENVINO_THROW("Segfault was caught by the signal handler in subgraph node execution on thread " + std::to_string(tid)); };