← Back to Pull requests

[CPU][x64] Fix i8/u8 SquaredDifference returning zeros in Snippets #39683

Closed
unknown closed this pull request without merging on Nov 19, 2026 10:44 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 11:27 UTC
Author

Details:


- On x64, an i8/u8 SquaredDifference returned zeros. For example, SquaredDifference([7, 3, 1, 5], [2, 0, 6, 5]) with i8 inputs gives [0, 0, 0, 0] instead of [25, 9, 25, 0]. i16 and i32 are correct, because those run through the Eltwise node, while i8/u8 run as a Snippets Subgraph (jit_avx2_i8).
- Snippets converts the 8-bit inputs to i32 for this emitter, but the node constructor of jit_squared_difference_emitter ignored the node and kept the default f32 execution precision, so it ran subps/mulps on integer data. It now takes the precision from the node through get_arithmetic_binary_exec_precision(), as the other arithmetic emitters (and the comparison emitters since #39444) do. ARM64 and RISC-V already do this.
- In EltwiseChainTest with parameter inputs, the first operation used the first parameter for both of its inputs, the last parameter was unused, and all inputs were generated with the same seed. A SquaredDifference in the chain therefore always computed (x - x)^2 = 0 and could not catch this. The parameters are now paired as for constant inputs (the first one starts the chain, the next ones are the second inputs), and each input gets its own seed.
- New x64 instance smoke_EltwiseChain_SquaredDifference_8bit: i8 and u8 over all chain shapes. The inputs are in [10, 20), so the result stays in the 8-bit range.

Validation:


Run on Windows with an Intel Core i5-12450HX (AVX2, no AVX-512), using a local Release build.
- New instance: all 18 cases fail without the change to jit_eltwise_emitters.cpp and pass with it. Also passes with ONEDNN_MAX_CPU_ISA=SSE41 and under Intel SDE -spr (AVX-512).
- All EltwiseChain suites with the test changes: 267/267 pass (249/249 without the emitter change, apart from the 18 new cases).
- ov_cpu_func_tests filtered to eltwise tests: 7132 ran, 4794 passed, 2338 skipped by configuration, 0 failed. Filtered to Snippets and SquaredDifference tests: 6570 ran, 3920 passed, 2650 skipped, 0 failed.

Found while comparing the CPU plugin with constant folding and numpy on small integer inputs. The same comparison showed that an i8/u8 Clamp with fractional bounds (e.g. min 1.5) uses 1 instead of 2 on x64 while i32 is correct; that is left for a separate change.

Tickets:


- N/A

AI Assistance:


- AI assistance used: yes
- An AI coding agent was used to find the issue with a differential test, trace the cause, write the fix and test, and draft this description.
- Validation performed: the local build, tests and ISA checks listed above, run on my machine.

Diff: 328 lines (+246 / -82) across 4 files Reviewer: v-Golubev Review duration: 12917m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 328 lines diff across 4 files
0.42
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.347
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #39683"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.1% (MEDIUM) · Higher = larger blast radius
42.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.6% · Safe to merge
16.6%