Skip to content

Fallback unsupported cuml.accel PCA and KernelRidge cases to CPU - #8290

Merged
rapids-bot[bot] merged 5 commits into
NVIDIA:mainfrom
csadorf:fix/accel-unsupported-fallbacks
Jun 25, 2026
Merged

Fallback unsupported cuml.accel PCA and KernelRidge cases to CPU#8290
rapids-bot[bot] merged 5 commits into
NVIDIA:mainfrom
csadorf:fix/accel-unsupported-fallbacks

Conversation

@csadorf

@csadorf csadorf commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This updates cuml.accel to fall back to CPU for two sklearn-compatible cases that are unsupported on GPU: PCA(n_components=0) and KernelRidge with non-string sklearn kernels. The PCA(n_components=0) behavior could be emulated in cuML in a follow-up, but the practical benefit is likely small since it is mainly an edge-case parity behavior. This also documents the new fallback limitations.

Contributes to #8180

@csadorf
csadorf requested a review from a team as a code owner June 24, 2026 20:10
@csadorf csadorf added the bug Something isn't working label Jun 24, 2026
@csadorf
csadorf requested a review from viclafargue June 24, 2026 20:10
@csadorf csadorf added the non-breaking Non-breaking change label Jun 24, 2026
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e43effc5-7698-4854-ab84-7b466a1a1196

📥 Commits

Reviewing files that changed from the base of the PR and between 83a391f and c3b1eca.

📒 Files selected for processing (1)
  • python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml
💤 Files with no reviewable changes (1)
  • python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated GPU handling for PCA to reject n_components=0, while preserving CPU fallback behavior.
    • Improved KernelRidge GPU interop to require a string kernel; non-string (e.g., callable) kernels now trigger CPU fallback instead of attempting GPU execution.
  • Tests
    • Added integration coverage for PCA(n_components=0) to confirm zero-dimensional outputs and learned attribute shapes.
    • Added integration coverage for KernelRidge with a scikit-learn kernel to verify finite predictions and expected fitted attributes.
  • Documentation
    • Updated cuml.accel limitations documentation to reflect the new CPU-fallback conditions for PCA and KernelRidge.

Walkthrough

The PR adds CPU-fallback checks for PCA when n_components=0 and KernelRidge when kernel is not a string, and updates the limitations docs and integration tests for both cases.

Changes

CPU fallback checks for PCA and KernelRidge

Layer / File(s) Summary
PCA GPU fallback guard
python/cuml/cuml/decomposition/pca.pyx, docs/source/cuml-accel/limitations.rst, python/cuml/cuml_accel_tests/integration/test_pca.py, python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-list.yaml
PCA._params_from_cpu raises UnsupportedOnGPU for n_components=0, and the limitations text, integration test, and xfail list updates cover that case.
KernelRidge CPU fallback guard
python/cuml/cuml/kernel_ridge/kernel_ridge.py, docs/source/cuml-accel/limitations.rst, python/cuml/cuml_accel_tests/integration/test_kernel_ridge.py
KernelRidge._params_from_cpu raises UnsupportedOnGPU when kernel is not a string, and the limitations text and integration test cover that path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

cuml-accel, improvement

Suggested reviewers

  • jcrist
  • gforsyth
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding CPU fallbacks for unsupported PCA and KernelRidge cases in cuml.accel.
Description check ✅ Passed The description accurately describes the new CPU fallbacks and documentation updates in this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Comment thread python/cuml/cuml/accel/_overrides/sklearn/decomposition.py Outdated
Comment thread python/cuml/cuml_accel_tests/integration/test_kernel_ridge.py Outdated
Comment thread python/cuml/cuml/kernel_ridge/kernel_ridge.py Outdated
@csadorf
csadorf force-pushed the fix/accel-unsupported-fallbacks branch from f4255e0 to 2b2d574 Compare June 24, 2026 21:50
@csadorf
csadorf force-pushed the fix/accel-unsupported-fallbacks branch from 2b2d574 to 83a391f Compare June 24, 2026 21:51
@csadorf
csadorf requested a review from jcrist June 24, 2026 21:51
@csadorf

csadorf commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit e93fc90 into NVIDIA:main Jun 25, 2026
273 of 280 checks passed
@csadorf
csadorf deleted the fix/accel-unsupported-fallbacks branch June 25, 2026 22:39
rapids-bot Bot pushed a commit that referenced this pull request Jun 26, 2026
This PR removes xfail markers that caused failures in nightly test: https://github.com/rapidsai/cuml/actions/runs/28229406180/job/83629207110

These tests pass now because of the following PRs merged yesterday:
- #8290: Fixed `plot_pca_vs_fa_model_selection` and `plot_compare_gpr_krr` because it adds CPU fallbacks
- #8291: Fixed `plot_forest_iris`

Authors:
  - Jinsol Park (https://github.com/jinsolp)

Approvers:
  - Divye Gala (https://github.com/divyegala)
  - Jim Crist-Harif (https://github.com/jcrist)

URL: #8297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cython / Python Cython or Python issue non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants