Skip to content

Forward merge release/26.06 into main - #8119

Closed
jcrist wants to merge 7 commits into
NVIDIA:mainfrom
jcrist:main-merge-release/26.06
Closed

Forward merge release/26.06 into main#8119
jcrist wants to merge 7 commits into
NVIDIA:mainfrom
jcrist:main-merge-release/26.06

Conversation

@jcrist

@jcrist jcrist commented May 15, 2026

Copy link
Copy Markdown
Member

No description provided.

This is required to import `libcuml`, but wasn't explicitly listed as a dependency. The parent main user-facing package (`cuml`) does have a `rmm` dependency, which in turn depends on `librmm`, so everything would be installed properly normally anyway. Just adding an explicit link here for tidyness.

Part of NVIDIA#7845.

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

URL: NVIDIA#8110
@jcrist jcrist self-assigned this May 15, 2026
@jcrist jcrist added the improvement Improvement / enhancement to an existing function label May 15, 2026
@jcrist
jcrist requested a review from a team as a code owner May 15, 2026 17:53
@jcrist jcrist added the non-breaking Non-breaking change label May 15, 2026
@jcrist
jcrist requested a review from jameslamb May 15, 2026 17:53
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label May 15, 2026
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Improved GPU acceleration to better support scikit-learn Pipelines, ColumnTransformer, and FeatureUnion across mixed components.
    • Accelerator can be enabled via an environment variable to transparently accelerate third‑party apps at interpreter startup.
  • Documentation

    • Added a guide and examples for accelerating third‑party applications and diagnosing GPU dispatch/fallbacks.
  • Chores

    • Updated runtime dependencies: NumPy minimum raised to 1.26 and an RMM runtime dependency added.

Walkthrough

Adds librmm to libcuml runtime and raises NumPy minimum to 1.26 across packaging and CI; patches cuml.accel to handle sklearn ColumnTransformer/FeatureUnion/Pipeline with numpy output, adds docs and tests for third‑party acceleration, and updates internal CuPy PTDS, validation, materialization, and related tests.

Changes

Dependencies and NumPy pins

Layer / File(s) Summary
Add librmm runtime dependency & bump NumPy
dependencies.yaml, python/libcuml/pyproject.toml, python/cuml/pyproject.toml, conda/..., conda/recipes/cuml/recipe.yaml
Add depends_on_librmm, add librmm==26.8.*,>=0.0.0a0 to libcuml pyproject, and raise NumPy minimum to >=1.26 (pin oldest test matrix to numpy==1.26).

cuml.accel: sklearn patches, docs, and tests

Layer / File(s) Summary
Patch sklearn compose & pipeline and register
python/cuml/cuml/accel/_patches/sklearn/compose.py, python/cuml/cuml/accel/_patches/sklearn/pipeline.py, python/cuml/cuml/accel/core.py
Add ColumnTransformer patch module; extend Pipeline patches to FeatureUnion; register sklearn.compose for patching.
Docs and accel tests
docs/source/cuml-accel/examples/*, python/cuml/cuml_accel_tests/*
Add third-party-apps.rst docs, update index, add tests exercising ColumnTransformer/FeatureUnion inside Pipeline, and remove related xfail entry.

Internals: PTDS, validation, materialization, and tests

Layer / File(s) Summary
PTDS activation and reflect changes
python/cuml/cuml/internals/outputs.py, python/cuml/tests/test_reflection.py
Enter internal contexts within cupy.cuda.Stream.ptds and run reflect-return conversions inside an internal context; add test asserting PTDS is active for decorated call paths.
Validation dtype.kind and NumPy 2.0 shim
python/cuml/cuml/internals/validation.py, python/cuml/tests/test_validation.py
Replace many np.isdtype checks with dtype.kind checks and add np_asarray compatibility shim for NumPy >=2.0; update related tests.
Array materialization and removed syncs
python/cuml/cuml/linear_model/*.pyx, python/cuml/cuml/preprocessing/label.py, python/cuml/tests/test_prims.py
Switch F-order materialization to cp.array, remove explicit Stream.null.synchronize() calls from code and tests.
Tests: guards, thresholds, and minor changes
python/cuml/tests/explainer/*, python/cuml/tests/test_mbsgd_regressor.py
Add pytest.importorskip('numpy', minversion='2.0') guards, relax one R² assertion, and update file header year.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • rapidsai/cuml#8110: Adds the same depends_on_librmm inclusion and librmm pyproject entry.
  • rapidsai/cuml#8118: Shares NumPy-compat work and related validation/pyx/test changes (NumPy bumped to >=1.26).
  • rapidsai/cuml#8038: Related changes to validation helpers and check_y/type gating.

Suggested labels

conda

Suggested reviewers

  • jameslamb
  • divyegala
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess whether it relates to the changeset. A description would help explain the scope and rationale of this forward merge. Add a pull request description explaining the purpose of this forward merge, key changes included, and any breaking/non-breaking impacts.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary purpose: merging a release branch into main, which matches the extensive changeset covering dependency updates, new documentation, and bug fixes across multiple files.
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 and usage tips.

jcrist and others added 6 commits May 15, 2026 18:36
Our pipeline data transfer optimization didn't work if any of the steps were other compositional metaestimators that wrapped accelerated estimators (since these could then accidentally use the accelerated versions, resulting in a mix of `cupy` and `numpy` results).

This PR patches the other two compositional estimators (`FeatureUnion` and `ColumnTransformer`) so they always run within a `numpy` output-type context.

Fixes NVIDIA#8112.
Fixes a few sklearn examples as well (yay!)

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Simon Adorf (https://github.com/csadorf)

URL: NVIDIA#8115
This configures cupy to use the per-thread default stream (PTDS) for _most_ operations. This avoids usage of the default legacy stream in more of the codebase, allowing for improved parallelism when running across multiple threads.

**This is a breaking change.**

Previously any cupy operations in `cuml` ran in cupy's default stream (the legacy stream). We didn't synchronize the stream before returning, but that didn't matter due to the synchronization behavior of the legacy stream.

With this PR we've moved to running (most) cupy operations in the PTDS. Depending on the operation, we may not synchronize the PTDS before returning.

**Most users shouldn't notice a difference and should have no issues.**

Users not using threads, custom streams, or only working with host memory (e.g. numpy in/numpy out) should see no difference. Likewise any users that only use cupy's default stream (the legacy stream) in their code should see no issues.

Users doing tricky things with custom streams or threads may run into issues and require a manual sync of the PTDS (can be done with `cupy.cuda.Stream.ptds.synchronize()`. For example, the following workflow _may_ run into issues:

- Run a cuml operation based on cupy in thread A, returning a cupy array
- Consume that output in thread B as a cupy array using a stream other than the legacy stream (e.g. a different PTDS or a custom stream)

For safety, you probably want to add a call to `cupy.cuda.Stream.ptds.synchronize()` in thread A before returning to ensure the output array is fully populated before consuming it in thread B.

Fixes NVIDIA#7909.

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Simon Adorf (https://github.com/csadorf)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: NVIDIA#8086
This adds to the cuml.accel documentation and documents the "third party application" use-case.

Authors:
  - Tim Head (https://github.com/betatim)

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

URL: NVIDIA#8094
This:

- Bumps our minimum supported `numpy` version to 1.26, to match that of `cudf`. Since `cudf` is a required dependency, we were effectively pinned at that already.
- Adds `numpy` to our oldest deps test runs. This also effectively adds `cupy==13.6`, since `cupy==14` requires `numpy>=2.0`. Explicitly specifying `cupy==13.6` in an oldest-deps run is tricky since the pypi packages require cuda suffixes as well. I'm skipping that for now.
- Fixes a few incompatibilities with numpy 1.x

Authors:
  - Jim Crist-Harif (https://github.com/jcrist)

Approvers:
  - Gil Forsyth (https://github.com/gforsyth)
  - Simon Adorf (https://github.com/csadorf)

URL: NVIDIA#8118
Closes NVIDIA#8121

Proposes slightly reducing the threshold in the R-squared check for `MBSGDRegressor` tests.

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Simon Adorf (https://github.com/csadorf)

URL: NVIDIA#8122
@jcrist
jcrist force-pushed the main-merge-release/26.06 branch from 0b07bab to 5a20033 Compare May 18, 2026 14:31
@jcrist
jcrist requested a review from a team as a code owner May 18, 2026 14:31
@jcrist
jcrist requested a review from divyegala May 18, 2026 14:31
@github-actions github-actions Bot added the conda conda issue label May 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cuml/cuml_accel_tests/test_pipeline.py`:
- Around line 363-409: Both tests currently only call pipe.fit; add explicit
assertions that transformed outputs are numpy arrays to enforce the numpy-output
contract. In test_column_transfomer_in_pipeline_works call ct.fit_transform(X,
y) and/or pipe.named_steps["ct"].transform(X) and assert the result is an
instance of numpy.ndarray and has the expected shape, and also assert
pipe.predict(X) (or pipe.named_steps["ridge"].predict after fit) returns a
numpy.ndarray. Do the analogous checks in test_feature_union_in_pipeline_works
using union.fit_transform(X) and pipe.predict(X) (or union.transform and
ridge.predict), asserting numpy.ndarray types and appropriate shapes for both
intermediate transformer outputs and final pipeline predictions.

In `@python/cuml/cuml/accel/_patches/sklearn/pipeline.py`:
- Line 15: The exported names in the module's __all__ are not lexicographically
ordered; update the __all__ tuple (currently containing "Pipeline" and
"FeatureUnion") so entries are sorted alphabetically (e.g., place "FeatureUnion"
before "Pipeline") to satisfy the RUF022 lint rule.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b2d78a56-dced-4aee-a81c-2010416b9f05

📥 Commits

Reviewing files that changed from the base of the PR and between 0b07bab and 5a20033.

📒 Files selected for processing (26)
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-132_arch-aarch64.yaml
  • conda/environments/all_cuda-132_arch-x86_64.yaml
  • conda/recipes/cuml/recipe.yaml
  • dependencies.yaml
  • docs/source/cuml-accel/examples/index.rst
  • docs/source/cuml-accel/examples/third-party-apps.rst
  • docs/source/cuml-accel/index.rst
  • python/cuml/cuml/accel/_patches/sklearn/compose.py
  • python/cuml/cuml/accel/_patches/sklearn/pipeline.py
  • python/cuml/cuml/accel/core.py
  • python/cuml/cuml/internals/outputs.py
  • python/cuml/cuml/internals/validation.py
  • python/cuml/cuml/linear_model/linear_regression.pyx
  • python/cuml/cuml/linear_model/ridge.pyx
  • python/cuml/cuml/preprocessing/label.py
  • python/cuml/cuml_accel_tests/test_pipeline.py
  • python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-examples.yaml
  • python/cuml/pyproject.toml
  • python/cuml/tests/explainer/test_gpu_treeshap.py
  • python/cuml/tests/test_mbsgd_regressor.py
  • python/cuml/tests/test_prims.py
  • python/cuml/tests/test_reflection.py
  • python/cuml/tests/test_validation.py
  • python/libcuml/pyproject.toml
💤 Files with no reviewable changes (3)
  • python/cuml/cuml_accel_tests/upstream/scikit-learn/xfail-examples.yaml
  • python/cuml/tests/test_prims.py
  • python/cuml/cuml/preprocessing/label.py
✅ Files skipped from review due to trivial changes (6)
  • conda/environments/all_cuda-132_arch-x86_64.yaml
  • conda/environments/all_cuda-132_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • docs/source/cuml-accel/examples/index.rst
  • python/cuml/cuml/accel/core.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/libcuml/pyproject.toml

Comment thread python/cuml/cuml_accel_tests/test_pipeline.py
Comment thread python/cuml/cuml/accel/_patches/sklearn/pipeline.py
@jcrist jcrist closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conda conda issue Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants