[Good First Issue] [ARM] [Debug Caps] : Implement register prints in just-in-time Kernels
#27,715 opened on 2024年11月25日
Repository metrics
- Stars
- (10,286 stars)
- PR merge metrics
- (平均マージ 14d 3h) (30d で 305 merged PRs)
説明
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
RegPrintsin new filesrc/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 classRegPrintsshould have only two public methodsprint: 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
RegPrintsfor 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
RegPrintand 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_amountin the same kernel. This register contain work amount of the loop. On each loop iteration the value in register should decrease inloop_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
RegPrintsfor x64 platforms - link. The implementation uses binary call - execute the instructioncallfor register with stored pointer to static method which prints the content of registers. - The JIT emitter implementation of Power operation which calls
std::powfduring execution - link.
Helpful AArch64 documentation
- AArch64 -- Base Instructions
- AArch64 -- SIMD and Floating-point Instructions
- AArch64 -- Procedure Call Standard
Resources
- Contribution guide - start here!
- What is OpenVINO?
- CPU plugin JIT emitters
- Blog post on contributing to OpenVINO
- User documentation
- Intel DevHub Discord channel - engage in discussions, ask questions and talk to OpenVINO developers
- How to link your Pull Request to an issue
Contact points
@aobolensk