feat: sparse support for online oneDAL BasicStatistics #3723
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 608 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.384
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3723"
general
weight: 0.35
avolkov-intel
Summary
Enables
partial_compute+finalize_computeoncsr_tableinputs for thebasic_statisticsalgorithm on both CPU and GPU. Previously onlymethod::densewas wired through the online path;
method::sparsewas batch-only, so sklearnexIncrementalBasicStatisticsfell back to the dense path on sparse inputs.The partial-result schema is unchanged (same six fields as dense:
partial_n_rows,partial_min,partial_max,partial_sum,partial_sum_squares,partial_sum_squares_centered). For CSR:sum/sum_squaresover the stored NNZ values equal the same reductions overthe implicit densified matrix (missing entries are zeros).
sum_squares_centeredis recovered exactly at finalize time viasum2cent = sum_squares - sum^2 / n, so the intermediate carries no sparsityinformation and the dense finalize math is reused as-is.
min/maxalready clamp against implicit zeros in the existing CSR batchkernel, so the per-batch partial values are already correct against a dense
view.
Changes
CPU (routes through the existing DAAL
fastCSRonline kernel)cpp/oneapi/dal/algo/basic_statistics/backend/cpu/partial_compute_kernel_csr.cpp— new.Dispatches to
daal_lom::internal::LowOrderMomentsOnlineKernel<Float, fastCSR, Cpu>with
is_online = true; carries the previous partial state in when present.Rejects per-row weights (
unimplemented) because the DAAL fastCSR onlinesignature has no weighted overload.
cpp/oneapi/dal/algo/basic_statistics/backend/cpu/finalize_compute_kernel_csr.cpp— new.Same DAAL finalize call as the dense CPU path but reading the CSR partials.
cpp/daal/src/algorithms/low_order_moments/low_order_moments_csr_fast_online_fpt_cpu.cpp—added
DAAL_EXPORTon the explicitLowOrderMomentsOnlineKernel<..., fastCSR, ...>instantiation so the symbol is visible to
libonedal.so(matches the patternin other
*_fpt_cpu.cppfiles whose kernels are called from oneAPI backends).GPU (reuses the dense GPU compute + finalize)
cpp/oneapi/dal/algo/basic_statistics/backend/gpu/partial_compute_kernel_csr_dpc.cpp— new.Runs the existing GPU CSR batch kernel per partial then merges into the accumulated
partial (elementwise
min/max/sum); builds a trimmed per-batch descriptorthat only asks for
min/max/sum/sum_squaresso higher-order results arederived once at finalize time.
cpp/oneapi/dal/algo/basic_statistics/backend/gpu/finalize_compute_kernel_csr_dpc.cpp— new.One-line delegation to
finalize_compute_kernel_dense_impl(same six-fieldlayout ⇒ identical finalize math).
Dispatch
detail/{partial,finalize}_compute_ops{,_dpc}.cpp— addedINSTANTIATE(float/double, method::sparse, task::compute)next to the existingdense instantiations.
---
<!--
PR should start as a draft, then move to ready for review state
after CI is passed and all applicable checkboxes are closed.
This approach ensures that reviewers don't spend extra time asking for regular requirements.
You can remove a checkbox as not applicable only if it doesn't relate to this PR in any way.
For example, a PR with docs update doesn't require checkboxes for performance
while a PR with any change in actual code should list checkboxes and
justify how this code change is expected to affect performance (or justification should be self-evident).
-->
<details>
<summary>Checklist:</summary>
Completeness and readability
Testing
Performance
</details>