Skip to content

Commit

Permalink
updated src/plugins/intel_cpu/src/emitters/plugin/aarch64/debug_capab…
Browse files Browse the repository at this point in the history
…ilities.hpp
  • Loading branch information
amanmogal committed Dec 6, 2024
1 parent 4d850ef commit 61cf09e
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@

class RegPrints {
public:
// Print general-purpose registers
static void print_gpr(const uint64_t& reg_value, const char* reg_name) {
std::cout << "Register " << reg_name << ": " << std::hex << reg_value << std::endl;
static void print_gpr(jit_generator &gen, const uint64_t &reg_value, const char *reg_name) {
// Emit JIT code to print general-purpose register during runtime
gen.mov(gen.rdi, reg_value); // Move register value into rdi
gen.mov(gen.rsi, reinterpret_cast<uint64_t>(reg_name)); // Pass register name as argument
gen.call(reinterpret_cast<void(*)(const char*, uint64_t)>(print_runtime_gpr)); // Call runtime function
}

// Print vector registers (SIMD)
static void print_simd(const float32x4_t& reg_value, const char* reg_name) {
float values[4];
vst1q_f32(values, reg_value); // Store SIMD register into an array
std::cout << "SIMD Register " << reg_name << ": ["
<< ov::util::join(values, values + 4, ", ") << "]" << std::endl;
static void print_simd(jit_generator &gen, const float32x4_t &reg_value, const char *reg_name) {
// Emit JIT code to handle SIMD printing during runtime
gen.mov(gen.rdi, reinterpret_cast<uint64_t>(&reg_value)); // Move SIMD value into rdi
gen.mov(gen.rsi, reinterpret_cast<uint64_t>(reg_name)); // Pass register name as argument
gen.call(reinterpret_cast<void(*)(const char*, const float*)>(print_runtime_simd)); // Call runtime function
}

private:
// Runtime functions to print the registers
static void print_runtime_gpr(const char *reg_name, uint64_t value) {
std::cout << "Register " << reg_name << ": " << std::hex << value << std::endl;
}

static void print_runtime_simd(const char *reg_name, const float *values) {
std::cout << "SIMD Register " << reg_name << ": ["
<< values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3] << "]" << std::endl;
}
};

Expand Down

0 comments on commit 61cf09e

Please sign in to comment.