← Back to Pull requests

fix(basic_statistics): skip GPU block-merge writes to unallocated results #4092

Open
unknown opened this pull request with 325 lines diff across 4 files
View on GitHub
unknown unknown commented on Dec 04, 2026 17:24 UTC
Author

Description

On GPU, a dense basic statistics compute with only mean and/or variance requested writes through a null pointer once the input has 5000+ rows, and the device is lost.

At that size the rows are split into blocks and combined by merge_blocks_kernel, which wrote rsum and rsum2cent for any mean or variance request. Outside SPMD those arrays are allocated only when sum / sum_squares_centered are requested (local_result::empty), so the kernel wrote to address 0. The SPMD allocation conditions already covered these writes.

User-visible impact: scikit-learn-intelex KMeans.fit on GPU computes its tolerance with result_options="variance", so every GPU fit with the default tol and 5000+ rows crashed the process or lost the device. After a device loss, later GPU calls in the same process fail too.

Changes:

  • Guard the two writes with the same conditions local_result::empty uses to allocate. Behaviour is unchanged in SPMD mode and for any request that includes sum / sum_squares_centered.

  • Re-enable the mean | variance case in the dense batch test. It was commented out as "fails for large datasets"; that failure was this crash.
  • Testing on an Intel GPU:

  • //cpp/oneapi/dal/algo/basic_statistics:test_batch_dpc aborts without the kernel change (Segmentation fault from GPU at 0x0 ... access: 1 (Write)) and passes with it.

  • //cpp/oneapi/dal/algo/basic_statistics:test_online_dpc passes.
  • No performance change expected: the change removes stores to buffers that are never read.

    ---

    <details>
    <summary>Checklist:</summary>

    Completeness and readability

  • I have commented my code, particularly in hard-to-understand areas.

  • I have updated the documentation to reflect the changes or created a separate PR with updates and provided its number in the description, if necessary. (not needed)

  • Git commit message contains an appropriate signed-off-by string _(see CONTRIBUTING.md for details)_.

  • I have resolved any merge conflicts that might occur with the base branch.
  • Testing

  • I have run it locally and tested the changes extensively.

  • All CI jobs are green or I have provided justification why they aren't.

  • I have extended testing suite if new functionality was introduced in this PR.
  • Performance

  • I have provided justification why performance and/or quality metrics have changed or why changes are not expected.
  • </details>

    🤖 Generated with Claude Code

    Diff: 325 lines (+243 / -82) across 4 files Reviewer: napetrov Review duration: 669m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 325 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.346
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4092"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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% (MEDIUM) · Higher = larger blast radius
    42%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 22.4% · Safe to merge
    22.4%