Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Good First Issue] [ARM] [Debug Caps] : Implement register prints in just-in-time Kernels #27715

Open
a-sidorova opened this issue Nov 25, 2024 · 0 comments
Labels
category: CPU OpenVINO CPU plugin good first issue Good for newcomers platform: arm OpenVINO on ARM / ARM64

Comments

@a-sidorova
Copy link
Contributor

Context

The CPU Plugin in OpenVINO uses optimized just-in-time (JIT) kernels to efficiently execute operations. For example, the kernel for Elementwise operation consists of several JIT Emitters.
While writing the JIT emitter or kernel, a developer sometimes needs to know content of registers to find root cause of a some bug. The JIT source code execution debugging might be slow and difficult due to disassemble view. To accelerate the debugging process, there can be implemented the debug capabilities - the ability to print register content.

Prerequisites

Recommended to use ARM CPU based platform for development (e.g. Mac, Raspberry Pi etc). The cross-compilation with an emulator (e.g. QEMU) using is still option: cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/arm64.toolchain.cmake ...

What needs to be done?

  • Create the class RegPrints in new file src/plugins/intel_cpu/src/emitters/plugin/aarch64/debug_capabilities.hpp. This class should provide the ability to print the contents of general-purpose and vector registers during JIT kernel execution on ARM64 SIMD platforms. It means that the class RegPrints should have only two public methods print: for general-purpose and vector registers.
  • To print the content of the registers, there might be implemented binary call - call static C++ method which prints content of registers which are passed as arguments of this method.
  • The class should have description - how the developed functionality can be used for debugging.
  • For the better understanding, please see the implementation of the same class RegPrints for x64 platforms.

Tests

Tests are disabled in default build, so ensure to add -DENABLE_TESTS=ON into cmake command.
GoogleTest is used for testing. CPU functional test target is ov_cpu_func_tests.

At the moment, we don't have test infrastructure to validate single JIT emitter or single small JIT kernel if they're not mapped to OpenVINO operation. However, there are still options to validate the developed functionality of RegPrints:

  • To verify the functionality for vector register, we can print content of source vector registers before compute_eltwise_op (elementwise op execution) and result vector register after the method call in jit_uni_eltwise_generic_kernel. It will be easy to verify with your eyes the developed functionality for vector registers of RegPrint and implementation of the emitter if you know what the emitter should process.
  • To verify the functionality for general-purpose register, we can print the content of the register reg_work_amount in the same kernel. This register contain work amount of the loop. On each loop iteration the value in register should decrease in loop_step.

Then we can launch any test with the OpenVINO operation which is executed using this JIT kernel. The list of elementwise operations which are supportd by JIT Kernel is here. For example, to launch tests with Add operation we can call the following command line:

./bin/[platform]/[build_type]/ov_cpu_func_tests --gtest_filter="*smoke*Eltwise*Add*"

Examples

  • The implementation of the class RegPrints for x64 platforms - link. The implementation uses binary call - execute the instruction call for register with stored pointer to static method which prints the content of registers.
  • The JIT emitter implementation of Power operation which calls std::powf during execution - link.

Helpful AArch64 documentation

Resources

Contact points

@a-sidorova, @dmitry-gorokhov

@a-sidorova a-sidorova added good first issue Good for newcomers category: CPU OpenVINO CPU plugin platform: arm OpenVINO on ARM / ARM64 labels Nov 25, 2024
@github-project-automation github-project-automation bot moved this to Contributors Needed in Good first issues Nov 25, 2024
amanmogal added a commit to amanmogal/openvino that referenced this issue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin good first issue Good for newcomers platform: arm OpenVINO on ARM / ARM64
Projects
Status: Contributors Needed
Development

No branches or pull requests

1 participant