Skip to content

Add EQUAL_ELTWISE support for eltwise test and kernel #30877

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

madhurthareja
Copy link

Details:

Implement CPU plugin just-in-time emitter for Equal operation

Tickets:
30257

@madhurthareja madhurthareja requested review from a team as code owners June 5, 2025 17:43
@madhurthareja madhurthareja requested review from mlukasze and removed request for a team June 5, 2025 17:43
@github-actions github-actions bot added category: IE Tests OpenVINO Test: plugins and common category: CPU OpenVINO CPU plugin no-match-files labels Jun 5, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Jun 5, 2025
@a-sidorova a-sidorova added the platform: risc-v OpenVINO on RISC-V label Jun 6, 2025
@a-sidorova a-sidorova self-assigned this Jun 6, 2025
@a-sidorova a-sidorova added this to the 2025.3 milestone Jun 6, 2025
Copy link
Author

@madhurthareja madhurthareja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed.

@madhurthareja
Copy link
Author

Hi @a-sidorova . I made the changes as you suggested. Could you please check? I was able to get all the test cases passed.

Copy link
Contributor

@a-sidorova a-sidorova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madhurthareja please apply the comments, build the tests and launch them. Please check that all of them are passed and send the screenshot with them 😊

@@ -80,7 +80,7 @@ std::vector<EltwiseTypes> eltwise_op_types = {
EltwiseTypes::FLOOR_MOD,
EltwiseTypes::SQUARED_DIFF,
EltwiseTypes::POWER,
EltwiseTypes::MOD
EltwiseTypes::MOD,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: please remove extra comma

@@ -593,7 +594,8 @@ std::set<std::vector<element::Type>> eltwise_precision_helper::get_supported_pre
OV_CASE(Algorithm::EltwiseRelu, jit_relu_emitter),
OV_CASE(Algorithm::EltwiseSigmoid, jit_sigmoid_emitter),
OV_CASE(Algorithm::EltwiseSqrt, jit_sqrt_emitter),
OV_CASE(Algorithm::EltwiseSubtract, jit_subtract_emitter));
OV_CASE(Algorithm::EltwiseSubtract, jit_subtract_emitter),
OV_CASE(Algorithm::EltwiseEqual, jit_equal_emitter));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You moved EltwiseEqual to right place only in first registration list, what's about this one? :) Could you please fix it here too?

Comment on lines +225 to +227
size_t jit_equal_emitter::aux_fp_gprs_count() const {
return 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see definition of the method aux_fp_gprs_count() here but I don't see the method declaration in the header. Please add it to the header.

jit_equal_emitter::jit_equal_emitter(ov::intel_cpu::riscv64::jit_generator* host,
ov::intel_cpu::riscv64::cpu_isa_t host_isa,
const std::shared_ptr<ov::Node>& node)
: jit_emitter(host, host_isa, get_arithmetic_binary_exec_precision(node)) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you use constants from the table (register_table_entries()), you need to call prepare_table() in constructors. Please see example in jit_exp_emitter.

h->vmv_v_x(dst, zero); // set dst to 0
h->vfeq_vv(mask_vreg(), src0, src1); // compare, result in mask
h->vfadd_vf(dst, dst, one, VM::masked); // set 1.0 where mask is true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra }

@madhurthareja
Copy link
Author

@madhurthareja please apply the comments, build the tests and launch them. Please check that all of them are passed and send the screenshot with them 😊

Yes, I'll do it. Thanks for your guidance. I'm a little naive in OC contributions, but loving them now with the help you and fellow contributors are providing.

@t-jankowski t-jankowski self-requested a review June 6, 2025 08:29
@madhurthareja
Copy link
Author

Hi! I've made the changes as discussed. Here are a few screenshots for the tests done. Please let me know if there's something I'm missing.

Screenshot 2025-06-06 at 2 34 34 PM Screenshot 2025-06-06 at 2 34 53 PM Screenshot 2025-06-06 at 2 22 32 PM

@a-sidorova
Copy link
Contributor

he 11th test is taking a lot of time to run, and I get some segmentation faults in tensorflow related tests. Could you let me know what should I look forward to?

In general you don't need to launch all existing tests in OV - only ov_cpu_func_tests are needed (as described in the task #30257):

# If you use xuantie-gnu-toolchain:
<xuantie_install_path>/bin/qemu-riscv64 -cpu rv64,x-v=true,vext_spec=v1.0 ./bin/[platform]/[build_type]/ov_cpu_func_tests --gtest_filter="*smoke*Comparison*Equal*"

# If you use riscv-gnu-toolchain:
<riscv_install_path>/bin/qemu-riscv64 -cpu rv64,v=true,vext_spec=v1.0 ./bin/[platform]/[build_type]/ov_cpu_func_tests --gtest_filter="*smoke*Comparison*Equal*"

I believe that some tests might be failed due to missed packages/models/installed frontends. This is OK. Please pay attention only on ov_cpu_func_tests with --gtest_filter="*smoke*Comparison*Equal*" 😊

Copy link
Contributor

@a-sidorova a-sidorova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madhurthareja your changes look better now, thanks! I left a few comments + I launched CI jobs. Please take a look at the failed code-style jobs and apply suggested changes 😃

@github-actions github-actions bot removed the category: IE Tests OpenVINO Test: plugins and common label Jun 6, 2025
@madhurthareja
Copy link
Author

@madhurthareja your changes look better now, thanks! I left a few comments + I launched CI jobs. Please take a look at the failed code-style jobs and apply suggested changes 😃

I made the required changes, but the issues with CI jobs seems to be regarding some permissions. Would I have to set it up or would that be done from the admin side?

@a-sidorova
Copy link
Contributor

@madhurthareja your changes look better now, thanks! I left a few comments + I launched CI jobs. Please take a look at the failed code-style jobs and apply suggested changes 😃

I made the required changes, but the issues with CI jobs seems to be regarding some permissions. Would I have to set it up or would that be done from the admin side?

Anybody can open reports of GHA jobs. Please take a look at them and apply suggestions from this job (I see that you haven't made it yet):

src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:216:-        prepare_table();
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:217:-    }
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:216:+    prepare_table();
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:217:+}
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:223:-        prepare_table();
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:224:-    }
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:223:+    prepare_table();
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:224:+}
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:241:-void jit_equal_emitter::emit_impl(const std::vector<size_t>& in_vec_idxs, const std::vector<size_t>& out_vec_idxs) const {
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:241:+void jit_equal_emitter::emit_impl(const std::vector<size_t>& in_vec_idxs,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:242:+                                  const std::vector<size_t>& out_vec_idxs) const {
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:251:-void jit_equal_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs, const std::vector<size_t>& out_vec_idxs) const {
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:252:+void jit_equal_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:253:+                                 const std::vector<size_t>& out_vec_idxs) const {
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:258:-    h->vmv_v_x(dst, zero); // set dst to 0
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:259:-    h->vfeq_vv(mask_vreg(), src0, src1); // compare, result in mask
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:260:-    h->vfadd_vf(dst, dst, one, VM::masked); // set 1.0 where mask is true   
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:260:+    h->vmv_v_x(dst, zero);                   // set dst to 0
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:261:+    h->vfeq_vv(mask_vreg(), src0, src1);     // compare, result in mask
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.cpp:262:+    h->vfadd_vf(dst, dst, one, VM::masked);  // set 1.0 where mask is true
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:103:-                     ov::intel_cpu::riscv64::cpu_isa_t host_isa,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:104:-                     const ov::element::Type exec_prc = ov::element::f32);
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:103:+                      ov::intel_cpu::riscv64::cpu_isa_t host_isa,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:104:+                      const ov::element::Type exec_prc = ov::element::f32);
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:106:-                     ov::intel_cpu::riscv64::cpu_isa_t host_isa,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:107:-                     const std::shared_ptr<ov::Node>& node);
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:106:+                      ov::intel_cpu::riscv64::cpu_isa_t host_isa,
src/plugins/intel_cpu/src/emitters/plugin/riscv64/jit_eltwise_emitters.hpp:107:+                      const std::shared_ptr<ov::Node>& node);
src/tests/test_utils/common_test_utils/src/node_builders/eltwise.cpp:15:-#include "openvino/op/erf.hpp"
src/tests/test_utils/common_test_utils/src/node_builders/eltwise.cpp:16:+#include "openvino/op/erf.hpp"

As for launching CI job, only Intel-workers can do it (like me). So when you apply code-style suggestions, please let me know - I will relaunch CI 😊

@madhurthareja
Copy link
Author

@a-sidorova I checked the reports and found that:

The GitHub Actions token used by the workflow does not have permission to post review comments on the PR.

Diff in eltwise.cpp: This is a no-op change (removing and re-adding the same line). It is likely a formatting artifact and does not affect functionality.

I'm not sure why is it failing. Is there due to formatting issues? Maybe some spaces or extra tabs?

Please let me know if I'm unable to understand the issue. I'll retry to understand them.

@a-sidorova
Copy link
Contributor

@a-sidorova I checked the reports and found that:

The GitHub Actions token used by the workflow does not have permission to post review comments on the PR.

Diff in eltwise.cpp: This is a no-op change (removing and re-adding the same line). It is likely a formatting artifact and does not affect functionality.

I'm not sure why is it failing. Is there due to formatting issues? Maybe some spaces or extra tabs?

Please let me know if I'm unable to understand the issue. I'll retry to understand them.

Hi!

The GitHub Actions token used by the workflow does not have permission to post review comments on the PR.

I think this is internal error and it come up only when there are problems with code-style. So no need to pay attention on it :)

Diff in eltwise.cpp: This is a no-op change (removing and re-adding the same line). It is likely a formatting artifact and does not affect functionality.

Code-style suggester suggests to swap lines with includes - please note that the difference between lines - number of lines. But this error is outdated - you reverted changes from the file src/tests/test_utils/common_test_utils/src/node_builders/eltwise.cpp. So you need to just fix all remaining errors from jit_eltwise_emitters.hpp and jit_eltwise_emitters.cpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin ExternalPR External contributor platform: risc-v OpenVINO on RISC-V
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Good First Issue] [RISCV64]: Implement CPU plugin just-in-time emitter for Equal operation
4 participants