fix(spblas): return the MKL sparse status from the DAAL wrappers #4054
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 481 lines diff across 6 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.370
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4054"
general
weight: 0.35
icfaust
Description
The DAAL sparse BLAS wrappers (
cpp/daal/src/externals/service_spblas_mkl.h) ignored everysparse_status_t. Whenmkl_sparse_?_create_csr,mkl_sparse_?_mm,_mvor_spmmdfailed, for example on an allocation failure, the output buffer was left unset and the algorithm returned it as a valid result.No associated issue. No documentation or benchmark PR is needed.
Change
xxcsrmm,xcsrmvandxcsrmultdreturn aservices::Statusand are marked[[nodiscard]], so a caller that drops the status fails the-Werrorbuilds:-
SPARSE_STATUS_ALLOC_FAILEDmaps toErrorMemoryAllocationFailed;- any other failure maps to
ErrorIncorrectInternalFunctionParameter.No new error ids. Handles are released on every path, and an earlier failure is kept over the release status.
SpBlasfacade forwards the status.- k-means Lloyd training (
kmeans_lloyd_impl.i) and the final CSR assignment (kmeans_lloyd_postprocessing.h), throughSafeStatusinside the threaded loops. The per-thread buffers of the final assignment are released before the status is checked;- the k-means batch kernel (
kmeans_lloyd_batch_impl.i) checks the final assignment and the exact objective, and returns a failed training iteration instead of running the postprocessing on unwritten centroids;- k-means|| init (
kmeans_plusplus_init_impl.i,callGemm);- covariance CSR (
updateCSRCrossProductAndSumsincovariance_impl.i).xcsrmmwrapper is removed from all three headers.Test. New private suite
//cpp/oneapi/dal/algo/kmeans:internal_tests(test/internal_spblas.cpp) calls the wrappers directly:SPARSE_STATUS_INVALID_VALUE, and all three wrappers report the failure.- It is skipped on the reference backend, which does not validate its arguments.
- Without the change it does not compile, because the wrappers return
void.There is no deterministic way to make MKL fail an allocation inside an algorithm, so the end-to-end path is covered only by the existing algorithm tests, which still pass.
Checks:
bazel test --config=hostfor kmeans (includinginternal_tests), kmeans_init and covariance pass.//:releasebuilds with GCC.No public API or ABI changes.
---
<details>
<summary>Checklist:</summary>
Completeness and readability
Testing
Performance
</details>
🤖 Generated with Claude Code