← Back to Pull requests

[CPU][ARM] Round ACL requantization zero points #40056

Merged
alvoron merged 2 files (122 lines) on Nov 24, 2026 14:26 UTC
View on GitHub
alvoron alvoron commented on Nov 19, 2026 10:52 UTC
Author

Details:


- Round the destination zero point to the nearest integer before ACL signed-domain normalization. Truncation can turn a value just below an integer into a one-bin output error.

Tickets:


- CVS-190469

AI Assistance:


- AI assistance used: no / yes
- If yes, summarize how AI was used and what human validation was performed (build/tests/manual checks).

Diff: 122 lines (+88 / -34) across 2 files Reviewer: v-Golubev Review duration: 7414m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.33) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 122 lines diff across 2 files
0.33
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.85 · 5 substantive comment(s)
0.85
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
88%
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.288
Real PR Conversation Timeline
13 items
copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 19, 2026 10:55 UTC
Reviewer

<!-- ccr-overview-v2 -->

🟢 Approval recommended

No active review issues are recorded for the destination zero-point rounding change.

No open issues 🎉

<details>
<summary><strong>What changed in this PR</strong></summary>

This PR corrects destination zero-point rounding in the CPU plugin’s Arm Compute Library (ACL) requantization path, preventing truncation from causing a one-bin output error.

Changes:

  • Round the destination zero point before signed-domain normalization.

  • Add an ARM64 smoke regression test that checks quantized convolution precision and output values.
  • | File | Description |
    | ---- | ----------- |
    | src/​plugins/​intel_cpu/​tests/​functional/​custom/​subgraph_tests/​src/​arm/​conv_fq.cpp | Adds regression coverage for ACL requantization zero-point rounding. |
    | src/​plugins/​intel_cpu/​src/​nodes/​executors/​acl/​acl_utils.hpp | Uses std::round before converting the destination zero point to an integer. |
    </details>

    <sub>Review effort: Balanced</sub>

    v-Golubev v-Golubev commented on code on Nov 19, 2026 11:03 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {
    +    const Shape shape{1, 4, 4, 4};
    +    const auto input = std::make_shared<op::v0::Parameter>(element::f32, shape);
    +    const auto quantize = [](const Output<Node>& data, float low, float high) {
    +        const auto lower = op::v0::Constant::create(element::f32, {}, {low});
    +        const auto upper = op::v0::Constant::create(element::f32, {}, {high});
    +        return std::make_shared<op::v0::FakeQuantize>(data, lower, upper, lower, upper, 256);
    +    };
    +    const auto activation = quantize(input->output(0), 0.0F, 0.64194745F);
    +    const auto weights =
    +        op::v0::Constant::create(element::i8, {4, 4, 1, 1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
    +    const auto weight_scales = op::v0::Constant::create(element::f32, {4, 1, 1, 1}, {0.012F, 0.011F, 0.014F, 0.017F});
    +    const auto scaled_weights =
    +        std::make_shared<op::v1::Multiply>(std::make_shared<op::v0::Convert>(weights, element::f32), weight_scales);
    +    const auto convolution = std::make_shared<op::v1::Convolution>(activation,
    +                                                                   scaled_weights,
    +                                                                   Strides{1, 1},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   Strides{1, 1});
    +    const auto bias = op::v0::Constant::create(element::f32, {1, 4, 1, 1}, {0.012F, -0.018F, 0.032F, -0.041F});
    +    const auto sum = std::make_shared<op::v1::Add>(convolution, bias);
    +    constexpr float output_low = -0.78389084F;

    Let's add a short comment on how these ranges were chosen: it's not clear that they give a dst zero point just below an integer (the case std::round fixes), and the expected quantized_bias values below can't be checked without recomputing it.

    v-Golubev v-Golubev commented on code on Nov 19, 2026 11:07 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {
    +    const Shape shape{1, 4, 4, 4};
    +    const auto input = std::make_shared<op::v0::Parameter>(element::f32, shape);
    +    const auto quantize = [](const Output<Node>& data, float low, float high) {
    +        const auto lower = op::v0::Constant::create(element::f32, {}, {low});
    +        const auto upper = op::v0::Constant::create(element::f32, {}, {high});
    +        return std::make_shared<op::v0::FakeQuantize>(data, lower, upper, lower, upper, 256);
    +    };
    +    const auto activation = quantize(input->output(0), 0.0F, 0.64194745F);
    +    const auto weights =
    +        op::v0::Constant::create(element::i8, {4, 4, 1, 1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
    +    const auto weight_scales = op::v0::Constant::create(element::f32, {4, 1, 1, 1}, {0.012F, 0.011F, 0.014F, 0.017F});
    +    const auto scaled_weights =
    +        std::make_shared<op::v1::Multiply>(std::make_shared<op::v0::Convert>(weights, element::f32), weight_scales);
    +    const auto convolution = std::make_shared<op::v1::Convolution>(activation,
    +                                                                   scaled_weights,
    +                                                                   Strides{1, 1},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   Strides{1, 1});
    +    const auto bias = op::v0::Constant::create(element::f32, {1, 4, 1, 1}, {0.012F, -0.018F, 0.032F, -0.041F});
    +    const auto sum = std::make_shared<op::v1::Add>(convolution, bias);
    +    constexpr float output_low = -0.78389084F;
    +    constexpr float output_high = 0.77776670F;
    +    const auto output = quantize(sum->output(0), output_low, output_high);
    +
    +    Core core;
    +    auto compiled = core.compile_model(std::make_shared<Model>(OutputVector{output}, ParameterVector{input}),
    +                                       ov::test::utils::DEVICE_CPU);
    +    bool found_convolution = false;
    +    for (const auto& node : compiled.get_runtime_model()->get_ordered_ops()) {
    +        const auto& info = node->get_rt_info();
    +        if (info.at(ov::exec_model_info::LAYER_TYPE).as<std::string>() == "Convolution") {
    +            EXPECT_EQ(info.at(ov::exec_model_info::RUNTIME_PRECISION).as<element::Type>(), element::u8);
    +            found_convolution = true;
    +        }
    +    }
    +    ASSERT_TRUE(found_convolution);

    Let's use GetNodesWithTypes from ov_subgraph.hpp instead of the manual runtime-model traversal: it also makes the found_convolution flag unnecessary.

        const auto convolutions = GetNodesWithTypes(compiled.get_runtime_model(), {"Convolution"});
        ASSERT_EQ(convolutions.size(), 1u);
        EXPECT_EQ(convolutions.front()->get_rt_info().at(ov::exec_model_info::RUNTIME_PRECISION).as<element::Type>(),
                  element::u8);
    

    v-Golubev v-Golubev commented on code on Nov 19, 2026 11:08 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {

    Can we cover this case with a ConvAndFQ instance (FQ ranges that give the fractional zero point) instead of a standalone TEST? This reuses the model builder, the reference comparison and checkConvolutionPrecision. If abs_threshold is too loose to catch a one-bin error, it can be tightened for this instance.

    alvoron alvoron commented on code on Nov 20, 2026 09:24 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {
    +    const Shape shape{1, 4, 4, 4};
    +    const auto input = std::make_shared<op::v0::Parameter>(element::f32, shape);
    +    const auto quantize = [](const Output<Node>& data, float low, float high) {
    +        const auto lower = op::v0::Constant::create(element::f32, {}, {low});
    +        const auto upper = op::v0::Constant::create(element::f32, {}, {high});
    +        return std::make_shared<op::v0::FakeQuantize>(data, lower, upper, lower, upper, 256);
    +    };
    +    const auto activation = quantize(input->output(0), 0.0F, 0.64194745F);
    +    const auto weights =
    +        op::v0::Constant::create(element::i8, {4, 4, 1, 1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
    +    const auto weight_scales = op::v0::Constant::create(element::f32, {4, 1, 1, 1}, {0.012F, 0.011F, 0.014F, 0.017F});
    +    const auto scaled_weights =
    +        std::make_shared<op::v1::Multiply>(std::make_shared<op::v0::Convert>(weights, element::f32), weight_scales);
    +    const auto convolution = std::make_shared<op::v1::Convolution>(activation,
    +                                                                   scaled_weights,
    +                                                                   Strides{1, 1},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   Strides{1, 1});
    +    const auto bias = op::v0::Constant::create(element::f32, {1, 4, 1, 1}, {0.012F, -0.018F, 0.032F, -0.041F});
    +    const auto sum = std::make_shared<op::v1::Add>(convolution, bias);
    +    constexpr float output_low = -0.78389084F;

    Added a comment

    alvoron alvoron commented on code on Nov 20, 2026 09:24 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {
    +    const Shape shape{1, 4, 4, 4};
    +    const auto input = std::make_shared<op::v0::Parameter>(element::f32, shape);
    +    const auto quantize = [](const Output<Node>& data, float low, float high) {
    +        const auto lower = op::v0::Constant::create(element::f32, {}, {low});
    +        const auto upper = op::v0::Constant::create(element::f32, {}, {high});
    +        return std::make_shared<op::v0::FakeQuantize>(data, lower, upper, lower, upper, 256);
    +    };
    +    const auto activation = quantize(input->output(0), 0.0F, 0.64194745F);
    +    const auto weights =
    +        op::v0::Constant::create(element::i8, {4, 4, 1, 1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
    +    const auto weight_scales = op::v0::Constant::create(element::f32, {4, 1, 1, 1}, {0.012F, 0.011F, 0.014F, 0.017F});
    +    const auto scaled_weights =
    +        std::make_shared<op::v1::Multiply>(std::make_shared<op::v0::Convert>(weights, element::f32), weight_scales);
    +    const auto convolution = std::make_shared<op::v1::Convolution>(activation,
    +                                                                   scaled_weights,
    +                                                                   Strides{1, 1},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   CoordinateDiff{0, 0},
    +                                                                   Strides{1, 1});
    +    const auto bias = op::v0::Constant::create(element::f32, {1, 4, 1, 1}, {0.012F, -0.018F, 0.032F, -0.041F});
    +    const auto sum = std::make_shared<op::v1::Add>(convolution, bias);
    +    constexpr float output_low = -0.78389084F;
    +    constexpr float output_high = 0.77776670F;
    +    const auto output = quantize(sum->output(0), output_low, output_high);
    +
    +    Core core;
    +    auto compiled = core.compile_model(std::make_shared<Model>(OutputVector{output}, ParameterVector{input}),
    +                                       ov::test::utils::DEVICE_CPU);
    +    bool found_convolution = false;
    +    for (const auto& node : compiled.get_runtime_model()->get_ordered_ops()) {
    +        const auto& info = node->get_rt_info();
    +        if (info.at(ov::exec_model_info::LAYER_TYPE).as<std::string>() == "Convolution") {
    +            EXPECT_EQ(info.at(ov::exec_model_info::RUNTIME_PRECISION).as<element::Type>(), element::u8);
    +            found_convolution = true;
    +        }
    +    }
    +    ASSERT_TRUE(found_convolution);

    Switched the precision check to GetNodesWithTypes

    alvoron alvoron commented on code on Nov 20, 2026 09:24 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -184,6 +193,64 @@ TEST_P(ConvAndFQ, CompareWithRefs) {
         CheckPluginRelatedResults(compiledModel, "Convolution");
     }
     
    +#if defined(OPENVINO_ARCH_ARM64)
    +TEST(smoke_ConvAndFQ_CPU, RoundsACLRequantizationZeroPoint) {

    Moved the regression into a parameterized ConvAndFQ

    v-Golubev v-Golubev commented on code on Nov 20, 2026 17:25 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -24,6 +27,8 @@ struct QuantizationParams {
         std::vector<size_t> fqConstShapes;                // fq constant shapes
         element::Type expectedPrecision;                  // convolution expected precision
         bool perChannelWeightsScale;                      // use per-channel scale on weights
    +    double absoluteThreshold = 1e-2;
    +    std::vector<float> biasOnlyValues{};

    biasOnlyValues.empty() switches the weights, scales, bias, MatMul tail, rel_threshold and the inputs in six places, while the name says it holds only the bias values. Let's extract a common model builder that takes these values explicitly (weights, scales, bias, MatMul tail on/off) and reuse it in ConvAndFQ and in a derived test class for this case. The derived class should stay simple: it reuses ConvAndFQTestParams and overrides only what differs (the inputs).

    v-Golubev v-Golubev commented on code on Nov 20, 2026 17:32 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -64,7 +69,10 @@ class ConvAndFQ : public testing::WithParamInterface<ConvAndFQTestParams>,
         void SetUp() override {
             const auto& [inputShape, inputPrecision, quantizationParams, withBias, withSwish, targetName] =
                 this->GetParam();
    -        abs_threshold = 1e-2f;
    +        abs_threshold = quantizationParams.absoluteThreshold;
    +        if (!quantizationParams.biasOnlyValues.empty()) {
    +            rel_threshold = 0.0;

    Could you please explain why rel_threshold = 0.0 is needed here? abs_threshold = 1e-3 is already below one output bin (~0.0061), so the default relative tolerance wouldn't hide the error this test targets.

    alvoron alvoron commented on code on Nov 23, 2026 09:57 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -64,7 +69,10 @@ class ConvAndFQ : public testing::WithParamInterface<ConvAndFQTestParams>,
         void SetUp() override {
             const auto& [inputShape, inputPrecision, quantizationParams, withBias, withSwish, targetName] =
                 this->GetParam();
    -        abs_threshold = 1e-2f;
    +        abs_threshold = quantizationParams.absoluteThreshold;
    +        if (!quantizationParams.biasOnlyValues.empty()) {
    +            rel_threshold = 0.0;

    It's not really needed, removed it.

    alvoron alvoron commented on code on Nov 23, 2026 09:57 UTC
    Code Review
    src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/arm/conv_fq.cpp:1
    @@ -24,6 +27,8 @@ struct QuantizationParams {
         std::vector<size_t> fqConstShapes;                // fq constant shapes
         element::Type expectedPrecision;                  // convolution expected precision
         bool perChannelWeightsScale;                      // use per-channel scale on weights
    +    double absoluteThreshold = 1e-2;
    +    std::vector<float> biasOnlyValues{};

    Extracted a builder

    v-Golubev v-Golubev approved these changes on Nov 23, 2026 10:20 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    alvoron alvoron
    Labels
    risk: low confidence: 88.6% 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: 33.2% (LOW) · Higher = larger blast radius
    33.2%
    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: 88.6% · Lower = rushed or shallow review
    88.6%
    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: 3.8% · Safe to merge
    3.8%