[CPU][x64] Drop exec_prc from the remaining node-based eltwise emitter constructors #40068
build_jenkins
Can we use get_arithmetic_binary_exec_precision(node) here, as the aarch64 and riscv64 select emitters do? The supported precisions are all-f32 or all-i32, so PropagatePrecision converts the condition too and the input precisions are equal at this point. If it is not the case, please add a comment explaining why the output type is used.
: jit_emitter(host, host_isa, get_arithmetic_binary_exec_precision(node)) {}
Can we take the precision from the node here, as the aarch64 emitters do, instead of the f32 literal? The emitter supports only f32, so the value is the same, but the node stays the single source of the precision: a hidden f32 is what hid the SquaredDifference bug. This comment is actual for all the f32-only emitters in this file.
jit_floor_emitter::jit_floor_emitter(x64::jit_generator_t* host,
x64::cpu_isa_t host_isa,
const std::shared_ptr<ov::Node>& node)
: jit_emitter(host, host_isa, get_arithmetic_binary_exec_precision(node)) {}
Can we also drop exec_prc from the node constructors in jit_dnnl_ext_emitters.hpp (Relu, Sigmoid, Tanh, Elu, Swish, HSwish, HSigmoid, Gelu erf/tanh, Round)? They are x64 eltwise emitters created by from_node() as well and still default exec_prc to f32, which jit_dnnl_emitter only forwards to the base class. Otherwise "remaining" in the description is not accurate. A follow-up is fine too.
Thanks for the suggestion. I’ve updated the Select emitter to use get_arithmetic_binary_exec_precision(node), consistent with the aarch64 and riscv64 emitters.
At this point, the inputs have equal precision due to PropagatePrecision, so the helper returns the same precision as the output type. The previous output-type special case therefore wasn’t needed, and I didn’t add a comment. This is included in commit 90ce391.
Done in this PR rather than a follow-up, so the “remaining” wording in the title and description is now accurate. All 10 node constructors in jit_dnnl_ext_emitters.hpp no longer take exec_prc; they now get the precision from the node via get_arithmetic_binary_exec_precision(n) as well.
Done. I’ve applied this to all the f32-only emitters in the file, not just Floor — 18 constructors in total, including erf, now taking the precision from get_arithmetic_binary_exec_precision(node).
I also removed [[maybe_unused]] from the affected node parameters since they’re used now.
build_jenkins
Thank you for the contribution!
@v-Golubev
Hi, thanks for reviewing and approving #40068.
I have relied a lot on AI for my PRs so far, which I have disclosed in them. I have been learning OpenVINO and have been trying to understand the code myself.
I do understand what I am doing at a high level while working on issues (thanks to GPT and Claude), but I still find reading the code hard.
I have done some competitive programming in C++ and have a good grasp of ML, DL, transformers, and language models.
I would really appreciate it if you could point me to a relatively easy issue in the CPU plugin where I can work end to end and raise the PR myself.
My goal is to learn the code properly and use AI only when I get stuck.
v-Golubev
arshil42
Details:
- Follow-up to #39683, as discussed in its review: the remaining x64 eltwise emitter constructors that take a node no longer take an
exec_prcdefaulting tof32. That default is how the node's precision was ignored in theSquaredDifferencebug fixed by #39683.- The
f32-only emitters (Floor,Ceiling,FloorMod,Mod,PowerDynamic,PowerStatic,LogicalAnd/Or/Xor/Not,PRelu,Sqrt,Negative,Exp,Erf,SoftSign,ErfInv,IsInf) passf32explicitly;f32is the only precision each of them supports.-
jit_bitwise_and/or/xor/not_emittertake the precision from the node throughget_arithmetic_binary_exec_precision().jit_select_emittertakes the node's output type, because its condition input is boolean and the helper requires equal input precisions.- No behavior change is expected: on x64 these constructors are only called through
EmitterFactory::from_node(), which never passed a precision, and none of these emitters readsexec_prc_when generating code. The precision-only constructors used by theEltwisenode are unchanged.Validation:
Run on Windows with an Intel Core i5-12450HX (AVX2, no AVX-512), using a local Release build.
-
ov_cpu_func_testsfiltered to Snippets,Select,IsInf, activation,EltwiseChain, eltwise and bitwise tests: 10345 ran, 7599 passed, the rest skipped by configuration, 0 failed.- clang-format clean.
Tickets:
- N/A
AI Assistance:
- AI assistance used: yes
- An AI coding agent was used to find the remaining constructors, check their call sites and supported precisions, make the change and draft this description.
- Validation performed: the local build and tests listed above, run on my machine.