Skip to content

Adopt nvForest for random forest inference - #8048

Merged
rapids-bot[bot] merged 60 commits into
NVIDIA:release/26.06from
chyunsu3:adopt_nvforest
May 21, 2026
Merged

Adopt nvForest for random forest inference#8048
rapids-bot[bot] merged 60 commits into
NVIDIA:release/26.06from
chyunsu3:adopt_nvforest

Conversation

@chyunsu3

@chyunsu3 chyunsu3 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Adopts nvForest for cuML random forest inference, removes the in-tree FIL implementation, and keeps a deprecated cuml.fil compatibility layer that directs users to nvforest.ForestInference.

This also wires nvForest into the C++ and Python build paths, updates packaging dependencies, and preserves the existing cuml.fil.ForestInference entry point with deprecation warnings for users migrating from FIL.

Checklist

  • Update dependencies.yaml
  • Update CMakeLists.txt to build with nvForest
  • Delete all C++ files from FIL
  • Update RF gtest to use nvForest
  • Update RF Cython module to use nvForest
  • Update cuml.fil.ForestInference to throw a warning; direct users to use nvforest.ForestInference instead.
  • Update pytests

@chyunsu3
chyunsu3 requested review from a team as code owners May 5, 2026 05:01
@chyunsu3
chyunsu3 marked this pull request as draft May 5, 2026 05:01
@github-actions github-actions Bot added conda conda issue Cython / Python Cython or Python issue CMake CUDA/C++ labels May 5, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 5, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

Review Change Stack

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: ddf8d273-c1ca-4367-b7a3-4d34b382371b

📥 Commits

Reviewing files that changed from the base of the PR and between 2bdc95c and c51b0c3.

📒 Files selected for processing (7)
  • ci/build_wheel_cuml.sh
  • ci/build_wheel_libcuml.sh
  • cpp/CMakeLists.txt
  • cpp/tests/CMakeLists.txt
  • python/cuml/cuml/ensemble/randomforest_common.pyx
  • python/cuml/cuml/fil/compat.py
  • python/cuml/tests/test_random_forest.py
✅ Files skipped from review due to trivial changes (1)
  • ci/build_wheel_cuml.sh

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added nvForest integration for improved forest inference performance.
    • New as_nvforest() method for RandomForest models to create nvForest inference models.
  • Bug Fixes / Changes

    • RandomForest predict and predict_proba now use nvForest for inference.
    • FIL (Forest Inference Library) is deprecated; migrate to nvForest via as_nvforest().
  • Deprecations

    • as_fil() method deprecated; use as_nvforest() instead (removal planned in 26.10).

Walkthrough

Adds nvforest/libnvforest to CI, build, packaging, and runtime; removes C++ FIL implementation, kernels, related raft_proto helpers, tests and benchmarks; switches Python RandomForest inference to nvforest and provides a deprecated FIL-compatible shim.

Changes

nvForest integration and dependency wiring

Layer / File(s) Summary
CMake options and nvForest thirdparty
cpp/CMakeLists.txt, cpp/cmake/modules/ConfigureAlgorithms.cmake, cpp/cmake/thirdparty/get_nvforest.cmake
Adds nvForest CMake options, enables LINK_NVFOREST, narrows treelite link condition, and introduces CPM-based nvforest fetch/configure.
Dependencies, envs, recipes, CI, pyprojects, and runtime loads
dependencies.yaml, conda/environments/*, conda/recipes/*, ci/build_wheel_*.sh, python/*/pyproject.toml, python/libcuml/libcuml/load.py, docs/source/FIL.rst
Adds libnvforest/nvforest to envs, recipes, pyprojects; wires dependency groups in dependencies.yaml; excludes libnvforest++.so from auditwheel; loads libnvforest at runtime; adds FIL deprecation docs.

C++ FIL removal, benchmarks, and tests cleanup

Layer / File(s) Summary
Remove FIL docs and public API headers
cpp/include/cuml/fil/*, cpp/include/cuml/fil/Implementation.md, cpp/include/cuml/fil/README.md
Deletes FIL documentation and public headers/types/enums/constants/exceptions (e.g., tree_layout, infer_kind, postproc ops).
Remove core FIL implementation and specializations
cpp/include/cuml/fil/detail/*, cpp/include/cuml/fil/*
Removes decision forest, node, bitset, builder, postprocessor, evaluate_tree, forest wrapper, specialization macros, and treelite importer.
Remove raft_proto infra used by FIL
cpp/include/cuml/fil/detail/raft_proto/*
Eliminates device_type/device_id/device_setter, buffer/owning/non-owning, cuda_stream, copy/cuda_check, exceptions, padding/ceildiv, and related helpers.
Remove device kernels and TU instantiations
cpp/include/cuml/fil/detail/*, cpp/src/fil/*
Deletes CPU/GPU infer kernels, shared-memory helpers, device initialization, GPU introspection, and all cpp/src/fil/infer*.{cpp,cu} macro instantiation units.
Benchmarks and tests removal; Treelite integration
cpp/bench/*, cpp/tests/*, cpp/include/cuml/forest/integrations/treelite.hpp, cpp/tests/CMakeLists.txt
Removes FIL benchmark, many unit tests for FIL/raft_proto/treelite importer/traversal, deletes Treelite traversal/integration header, and conditions tests to link nvForest when enabled.

Python migration to nvForest and compatibility shims

Layer / File(s) Summary
Python build toggles and exports
python/cuml/CMakeLists.txt, python/cuml/cuml/__init__.py, python/cuml/cuml/fil/__init__.py, python/cuml/cuml/fil/CMakeLists.txt
Stops building the cuml/fil extension, updates exports to re-export from cuml.fil.compat, and removes the FIL CMake module.
Add FIL compatibility shim and remove Cython bindings
python/cuml/cuml/fil/compat.py, python/cuml/cuml/fil/*.pxd, python/cuml/cuml/fil/fil.pyx
Introduces a deprecated ForestInference wrapper using nvforest, device selection helpers, and removes Cython pxd/pyx bindings that exposed C++ FIL APIs.
RandomForest Python backend switches to nvForest
python/cuml/cuml/ensemble/*
Adds as_nvforest(), deprecates as_fil(), updates RandomForestClassifier/Regressor predict and predict_proba to use nvforest and check_inputs, and updates caching/pickling.
Benchmark helpers and registry cleanup
python/cuml/cuml/benchmark/*
Removes FIL/Treelite benchmark builders and registry entries; simplifies bench helper imports.
Python tests updates and deprecation warnings
python/cuml/tests/*
Updates tests to use nvforest flows, adjusts parametrizations and dtype/error expectations, and adds pytest filters for FIL deprecation warnings.

Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

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

@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 `@cpp/CMakeLists.txt`:
- Around line 593-594: The cuml_objs target currently always links against
nvforest::nvforest++ (seen in the target_link_libraries PUBLIC list) but
nvforest is only created when LINK_NVFOREST is enabled; update the linking so
nvforest::nvforest++ is only added when available—either wrap the library entry
in a generator expression that tests target existence (e.g.
$<TARGET_EXISTS:nvforest::nvforest++>), or surround the target_link_libraries
entry with an if(LINK_NVFOREST) ... endif() check driven by the same flag set in
ConfigureAlgorithms.cmake; ensure you modify the cuml_objs target_link_libraries
invocation (the PUBLIC list containing rapids_logger::rapids_logger rmm::rmm
raft::raft nvforest::nvforest++ ${TREELITE_LIBS} ${_cuml_cpp_public_libs}) to
conditionally include nvforest::nvforest++.

In `@cpp/tests/CMakeLists.txt`:
- Line 48: Line unconditionally links nvforest::nvforest++ causing configure
failures when LINK_NVFOREST is OFF; wrap that library in a CMake generator
expression so it's only added when LINK_NVFOREST is true. Modify the
target_link_libraries entry that currently includes nvforest::nvforest++ to use
a conditional generator expression like
$<$<BOOL:${LINK_NVFOREST}>:nvforest::nvforest++> (matching the style used for
CUFFT/MPI/RAFT_DISTRIBUTED) so the nvforest target is only linked when
LINK_NVFOREST is enabled.
🪄 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: 062cb25e-c935-4869-ba7b-bd9da7e2ba31

📥 Commits

Reviewing files that changed from the base of the PR and between 80343fe and f826bc2.

📒 Files selected for processing (115)
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-131_arch-aarch64.yaml
  • conda/environments/all_cuda-131_arch-x86_64.yaml
  • conda/environments/clang_tidy_cuda-129_arch-x86_64.yaml
  • conda/environments/clang_tidy_cuda-131_arch-x86_64.yaml
  • conda/environments/cpp_all_cuda-129_arch-x86_64.yaml
  • conda/environments/cpp_all_cuda-131_arch-x86_64.yaml
  • cpp/CMakeLists.txt
  • cpp/bench/CMakeLists.txt
  • cpp/bench/sg/fil.cu
  • cpp/cmake/modules/ConfigureAlgorithms.cmake
  • cpp/cmake/thirdparty/get_nvforest.cmake
  • cpp/include/cuml/fil/Implementation.md
  • cpp/include/cuml/fil/README.md
  • cpp/include/cuml/fil/constants.hpp
  • cpp/include/cuml/fil/decision_forest.hpp
  • cpp/include/cuml/fil/detail/bitset.hpp
  • cpp/include/cuml/fil/detail/cpu_introspection.hpp
  • cpp/include/cuml/fil/detail/decision_forest_builder.hpp
  • cpp/include/cuml/fil/detail/degenerate_trees.hpp
  • cpp/include/cuml/fil/detail/device_initialization.hpp
  • cpp/include/cuml/fil/detail/device_initialization/cpu.hpp
  • cpp/include/cuml/fil/detail/device_initialization/gpu.cuh
  • cpp/include/cuml/fil/detail/device_initialization/gpu.hpp
  • cpp/include/cuml/fil/detail/evaluate_tree.hpp
  • cpp/include/cuml/fil/detail/forest.hpp
  • cpp/include/cuml/fil/detail/gpu_introspection.hpp
  • cpp/include/cuml/fil/detail/index_type.hpp
  • cpp/include/cuml/fil/detail/infer.hpp
  • cpp/include/cuml/fil/detail/infer/cpu.hpp
  • cpp/include/cuml/fil/detail/infer/gpu.cuh
  • cpp/include/cuml/fil/detail/infer/gpu.hpp
  • cpp/include/cuml/fil/detail/infer_kernel/cpu.hpp
  • cpp/include/cuml/fil/detail/infer_kernel/gpu.cuh
  • cpp/include/cuml/fil/detail/infer_kernel/shared_memory_buffer.cuh
  • cpp/include/cuml/fil/detail/node.hpp
  • cpp/include/cuml/fil/detail/postprocessor.hpp
  • cpp/include/cuml/fil/detail/raft_proto/buffer.hpp
  • cpp/include/cuml/fil/detail/raft_proto/ceildiv.hpp
  • cpp/include/cuml/fil/detail/raft_proto/cuda_check.hpp
  • cpp/include/cuml/fil/detail/raft_proto/cuda_stream.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/const_agnostic.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/cuda_check/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/cuda_check/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_setter/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_setter/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/non_owning_buffer.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/non_owning_buffer/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/device_id.hpp
  • cpp/include/cuml/fil/detail/raft_proto/device_setter.hpp
  • cpp/include/cuml/fil/detail/raft_proto/device_type.hpp
  • cpp/include/cuml/fil/detail/raft_proto/exceptions.hpp
  • cpp/include/cuml/fil/detail/raft_proto/gpu_support.hpp
  • cpp/include/cuml/fil/detail/raft_proto/handle.hpp
  • cpp/include/cuml/fil/detail/raft_proto/padding.hpp
  • cpp/include/cuml/fil/detail/specialization_types.hpp
  • cpp/include/cuml/fil/detail/specializations/device_initialization_macros.hpp
  • cpp/include/cuml/fil/detail/specializations/forest_macros.hpp
  • cpp/include/cuml/fil/detail/specializations/infer_macros.hpp
  • cpp/include/cuml/fil/exceptions.hpp
  • cpp/include/cuml/fil/forest_model.hpp
  • cpp/include/cuml/fil/infer_kind.hpp
  • cpp/include/cuml/fil/postproc_ops.hpp
  • cpp/include/cuml/fil/tree_layout.hpp
  • cpp/include/cuml/fil/treelite_importer.hpp
  • cpp/src/fil/infer0.cpp
  • cpp/src/fil/infer0.cu
  • cpp/src/fil/infer1.cpp
  • cpp/src/fil/infer1.cu
  • cpp/src/fil/infer10.cpp
  • cpp/src/fil/infer10.cu
  • cpp/src/fil/infer11.cpp
  • cpp/src/fil/infer11.cu
  • cpp/src/fil/infer2.cpp
  • cpp/src/fil/infer2.cu
  • cpp/src/fil/infer3.cpp
  • cpp/src/fil/infer3.cu
  • cpp/src/fil/infer4.cpp
  • cpp/src/fil/infer4.cu
  • cpp/src/fil/infer5.cpp
  • cpp/src/fil/infer5.cu
  • cpp/src/fil/infer6.cpp
  • cpp/src/fil/infer6.cu
  • cpp/src/fil/infer7.cpp
  • cpp/src/fil/infer7.cu
  • cpp/src/fil/infer8.cpp
  • cpp/src/fil/infer8.cu
  • cpp/src/fil/infer9.cpp
  • cpp/src/fil/infer9.cu
  • cpp/tests/CMakeLists.txt
  • cpp/tests/sg/fil/decision_forest_builder_invalid_inputs.cpp
  • cpp/tests/sg/fil/raft_proto/buffer.cpp
  • cpp/tests/sg/fil/raft_proto/buffer.cu
  • cpp/tests/sg/fil/treelite_importer.cpp
  • cpp/tests/sg/fil/treelite_importer_invalid_inputs.cpp
  • cpp/tests/sg/forest/traversal_forest.cpp
  • cpp/tests/sg/forest/treelite_traversal.cpp
  • cpp/tests/sg/rf_test.cu
  • dependencies.yaml
  • python/cuml/pyproject.toml
  • python/libcuml/pyproject.toml
💤 Files with no reviewable changes (98)
  • cpp/include/cuml/fil/Implementation.md
  • cpp/src/fil/infer1.cpp
  • cpp/include/cuml/fil/detail/cpu_introspection.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/non_owning_buffer.hpp
  • cpp/include/cuml/fil/detail/raft_proto/device_id.hpp
  • cpp/src/fil/infer11.cpp
  • cpp/src/fil/infer11.cu
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_setter/gpu.hpp
  • cpp/include/cuml/fil/detail/device_initialization/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/device_setter.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/const_agnostic.hpp
  • cpp/include/cuml/fil/tree_layout.hpp
  • cpp/src/fil/infer7.cpp
  • cpp/src/fil/infer2.cu
  • cpp/include/cuml/fil/detail/raft_proto/cuda_stream.hpp
  • cpp/src/fil/infer10.cu
  • cpp/src/fil/infer4.cu
  • cpp/tests/sg/forest/treelite_traversal.cpp
  • cpp/include/cuml/fil/detail/evaluate_tree.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw.hpp
  • cpp/include/cuml/fil/detail/device_initialization/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/base.hpp
  • cpp/include/cuml/fil/detail/specializations/device_initialization_macros.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy/gpu.hpp
  • cpp/include/cuml/fil/detail/node.hpp
  • cpp/include/cuml/fil/detail/raft_proto/exceptions.hpp
  • cpp/include/cuml/fil/detail/gpu_introspection.hpp
  • cpp/src/fil/infer6.cu
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/gpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/cpu.hpp
  • cpp/src/fil/infer0.cu
  • cpp/include/cuml/fil/detail/infer_kernel/cpu.hpp
  • cpp/src/fil/infer10.cpp
  • cpp/src/fil/infer0.cpp
  • cpp/include/cuml/fil/detail/raft_proto/device_type.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw/cpu.hpp
  • cpp/src/fil/infer5.cpp
  • cpp/include/cuml/fil/exceptions.hpp
  • cpp/include/cuml/fil/constants.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/cuda_check/gpu.hpp
  • cpp/src/fil/infer7.cu
  • cpp/include/cuml/fil/detail/index_type.hpp
  • cpp/include/cuml/fil/detail/postprocessor.hpp
  • cpp/include/cuml/fil/detail/bitset.hpp
  • cpp/tests/sg/forest/traversal_forest.cpp
  • cpp/include/cuml/fil/detail/specialization_types.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/host_only_throw/base.hpp
  • cpp/include/cuml/fil/detail/raft_proto/ceildiv.hpp
  • cpp/include/cuml/fil/detail/forest.hpp
  • cpp/src/fil/infer3.cpp
  • cpp/include/cuml/fil/detail/specializations/forest_macros.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_id/cpu.hpp
  • cpp/bench/sg/fil.cu
  • cpp/include/cuml/fil/README.md
  • cpp/include/cuml/fil/detail/raft_proto/detail/device_setter/base.hpp
  • cpp/src/fil/infer9.cpp
  • cpp/include/cuml/fil/detail/device_initialization.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy/cpu.hpp
  • cpp/include/cuml/fil/infer_kind.hpp
  • cpp/include/cuml/fil/treelite_importer.hpp
  • cpp/tests/sg/fil/raft_proto/buffer.cpp
  • cpp/src/fil/infer5.cu
  • cpp/src/fil/infer6.cpp
  • cpp/include/cuml/fil/detail/infer/gpu.hpp
  • cpp/include/cuml/fil/detail/degenerate_trees.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/base.hpp
  • cpp/include/cuml/fil/decision_forest.hpp
  • cpp/tests/sg/fil/treelite_importer.cpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/non_owning_buffer/base.hpp
  • cpp/include/cuml/fil/postproc_ops.hpp
  • cpp/tests/sg/fil/raft_proto/buffer.cu
  • cpp/include/cuml/fil/detail/raft_proto/padding.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/copy.hpp
  • cpp/src/fil/infer4.cpp
  • cpp/src/fil/infer8.cu
  • cpp/include/cuml/fil/detail/decision_forest_builder.hpp
  • cpp/include/cuml/fil/detail/specializations/infer_macros.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/cuda_check/base.hpp
  • cpp/tests/sg/fil/treelite_importer_invalid_inputs.cpp
  • cpp/include/cuml/fil/detail/raft_proto/cuda_check.hpp
  • cpp/include/cuml/fil/detail/raft_proto/detail/owning_buffer/gpu.hpp
  • cpp/src/fil/infer2.cpp
  • cpp/include/cuml/fil/detail/device_initialization/gpu.cuh
  • cpp/tests/sg/fil/decision_forest_builder_invalid_inputs.cpp
  • cpp/include/cuml/fil/detail/infer_kernel/shared_memory_buffer.cuh
  • cpp/include/cuml/fil/detail/raft_proto/buffer.hpp
  • cpp/src/fil/infer9.cu
  • cpp/include/cuml/fil/detail/infer/gpu.cuh
  • cpp/include/cuml/fil/detail/infer_kernel/gpu.cuh
  • cpp/include/cuml/fil/detail/infer.hpp
  • cpp/src/fil/infer3.cu
  • cpp/src/fil/infer1.cu
  • cpp/include/cuml/fil/detail/raft_proto/handle.hpp
  • cpp/src/fil/infer8.cpp
  • cpp/include/cuml/fil/detail/infer/cpu.hpp
  • cpp/include/cuml/fil/detail/raft_proto/gpu_support.hpp
  • cpp/include/cuml/fil/forest_model.hpp

Comment thread cpp/CMakeLists.txt Outdated
Comment thread cpp/tests/CMakeLists.txt Outdated
@chyunsu3 chyunsu3 added improvement Improvement / enhancement to an existing function breaking Breaking change labels May 5, 2026
@chyunsu3 chyunsu3 changed the title [WIP] Replace FIL with nvForest Replace FIL with nvForest May 6, 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
python/cuml/cuml/fil/compat.py (1)

309-314: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing stacklevel=2 in deprecation warning.

The load_from_treelite_model classmethod's deprecation warning is missing stacklevel=2, unlike the other classmethods (load at line 231, load_from_sklearn at line 273). This causes the warning traceback to point to this library code rather than the user's calling code.

Suggested fix
         warnings.warn(
             "cuml.fil.ForestInference.load_from_treelite_model() is deprecated "
             "and will be removed in 26.10. "
             "Use nvforest.load_from_treelite_model() instead.",
             FutureWarning,
+            stacklevel=2,
         )
🤖 Prompt for 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.

In `@python/cuml/cuml/fil/compat.py` around lines 309 - 314, The deprecation
warning in the classmethod load_from_treelite_model
(cuml.fil.ForestInference.load_from_treelite_model) is missing stacklevel=2;
update the warnings.warn call in that method to pass stacklevel=2 so the warning
points at the user's calling code (mirror the existing usage in load and
load_from_sklearn).
🧹 Nitpick comments (1)
python/cuml/tests/test_random_forest.py (1)

754-757: ⚡ Quick win

Inconsistent array conversion between classification and regression tests.

The classification test (lines 695-697) explicitly converts the nvforest output to NumPy via cp.asnumpy(), but the regression test here passes the nvforest output directly to np.reshape() without conversion. While this may work due to array protocols, it's inconsistent with the classification test pattern and could cause issues depending on the output type.

Consider using explicit conversion for consistency:

Suggested fix
     nvforest_model = cuml_model.as_nvforest()
-    nvforest_model_preds = nvforest_model.predict(X_test)
-    nvforest_model_preds = np.reshape(nvforest_model_preds, np.shape(y_test))
+    nvforest_model_preds = cp.asnumpy(nvforest_model.predict(X_test))
+    nvforest_model_preds = np.reshape(nvforest_model_preds, np.shape(y_test))
🤖 Prompt for 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.

In `@python/cuml/tests/test_random_forest.py` around lines 754 - 757, The
regression test is inconsistently handling nvforest outputs compared to the
classification test: after calling nvforest_model.predict(X_test) convert the
result to a NumPy array (e.g., via cp.asnumpy()) before reshaping and computing
r2_score so nvforest_model_preds is the same concrete type as in the
classification test; update the nvforest_model.predict usage and subsequent
np.reshape on nvforest_model_preds to explicitly convert to NumPy prior to
evaluating nvforest_model_r2.
🤖 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.

Outside diff comments:
In `@python/cuml/cuml/fil/compat.py`:
- Around line 309-314: The deprecation warning in the classmethod
load_from_treelite_model (cuml.fil.ForestInference.load_from_treelite_model) is
missing stacklevel=2; update the warnings.warn call in that method to pass
stacklevel=2 so the warning points at the user's calling code (mirror the
existing usage in load and load_from_sklearn).

---

Nitpick comments:
In `@python/cuml/tests/test_random_forest.py`:
- Around line 754-757: The regression test is inconsistently handling nvforest
outputs compared to the classification test: after calling
nvforest_model.predict(X_test) convert the result to a NumPy array (e.g., via
cp.asnumpy()) before reshaping and computing r2_score so nvforest_model_preds is
the same concrete type as in the classification test; update the
nvforest_model.predict usage and subsequent np.reshape on nvforest_model_preds
to explicitly convert to NumPy prior to evaluating nvforest_model_r2.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 74300b27-5a68-4b92-99be-1a26975f3925

📥 Commits

Reviewing files that changed from the base of the PR and between e3975a3 and 6c360ec.

📒 Files selected for processing (5)
  • docs/source/FIL.rst
  • python/cuml/cuml/ensemble/randomforest_common.pyx
  • python/cuml/cuml/fil/compat.py
  • python/cuml/tests/test_fil.py
  • python/cuml/tests/test_random_forest.py
💤 Files with no reviewable changes (1)
  • docs/source/FIL.rst

Comment thread docs/source/FIL.rst Outdated
Comment thread python/cuml/tests/test_fil.py Outdated

@csadorf csadorf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚢 (assuming tests pass)

@csadorf
csadorf requested a review from jcrist May 21, 2026 03:18
@csadorf csadorf changed the title Replace FIL with nvForest Adopt nvForest for random forest inference May 21, 2026

@bdice bdice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional changes needed:

Comment thread ci/build_wheel_cuml.sh Outdated
Comment thread cpp/tests/CMakeLists.txt Outdated

@jcrist jcrist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The tiniest of docs nits, otherwise LGTM from a python perspective!

Comment thread python/cuml/cuml/ensemble/randomforest_common.pyx Outdated
Comment thread python/cuml/cuml/ensemble/randomforest_common.pyx Outdated
Comment thread python/cuml/cuml/ensemble/randomforest_common.pyx Outdated

@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.

♻️ Duplicate comments (1)
python/cuml/cuml/ensemble/randomforest_common.pyx (1)

407-410: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep the runtime deprecation warning aligned with the documented removal release.

The docstring now says as_fil is removed in 26.08, but the emitted FutureWarning still says 26.10. That leaves users with conflicting guidance from the same API surface.

Proposed fix
         warnings.warn(
-            "as_fil() method is deprecated and will be removed in 26.10. "
+            "as_fil() method is deprecated and will be removed in 26.08. "
             "Use the as_nvforest() method instead.",
             FutureWarning,
         )
🤖 Prompt for 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.

In `@python/cuml/cuml/ensemble/randomforest_common.pyx` around lines 407 - 410,
Update the FutureWarning emitted in the as_fil() deprecation to match the
documented removal release (26.08): locate the warnings.warn(...) call inside
the as_fil method in randomforest_common.pyx and change the message text from
"will be removed in 26.10" to "will be removed in 26.08" (while keeping the rest
of the message and FutureWarning class unchanged); also ensure any adjacent
docstring or comment in the same method mentioning as_fil/as_nvforest remains
consistent with the new release string.
🧹 Nitpick comments (1)
python/cuml/cuml/ensemble/randomforest_common.pyx (1)

680-681: ⚡ Quick win

Reuse the cached nvForest model in the OOB path.

_compute_oob_score() calls as_nvforest() directly, so oob_score=True builds a fresh inference model and immediately throws it away instead of warming _nvforest_model. Using _get_inference_nvforest_model() here avoids an extra Treelite→nvForest load on the next inference call.

Proposed fix
-        nvforest_model = self.as_nvforest()
+        nvforest_model = self._get_inference_nvforest_model()
🤖 Prompt for 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.

In `@python/cuml/cuml/ensemble/randomforest_common.pyx` around lines 680 - 681,
The OOB path in _compute_oob_score currently calls as_nvforest() which builds a
fresh nvForest model and discards it; replace that call with
_get_inference_nvforest_model() so the code reuses and warms the cached
_nvforest_model (when oob_score=True) and avoids an extra Treelite→nvForest load
on subsequent inferences.
🤖 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.

Duplicate comments:
In `@python/cuml/cuml/ensemble/randomforest_common.pyx`:
- Around line 407-410: Update the FutureWarning emitted in the as_fil()
deprecation to match the documented removal release (26.08): locate the
warnings.warn(...) call inside the as_fil method in randomforest_common.pyx and
change the message text from "will be removed in 26.10" to "will be removed in
26.08" (while keeping the rest of the message and FutureWarning class
unchanged); also ensure any adjacent docstring or comment in the same method
mentioning as_fil/as_nvforest remains consistent with the new release string.

---

Nitpick comments:
In `@python/cuml/cuml/ensemble/randomforest_common.pyx`:
- Around line 680-681: The OOB path in _compute_oob_score currently calls
as_nvforest() which builds a fresh nvForest model and discards it; replace that
call with _get_inference_nvforest_model() so the code reuses and warms the
cached _nvforest_model (when oob_score=True) and avoids an extra
Treelite→nvForest load on subsequent inferences.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: abc1f576-a70c-4084-be8d-7c86aa765c73

📥 Commits

Reviewing files that changed from the base of the PR and between 7438c88 and 2bdc95c.

📒 Files selected for processing (4)
  • ci/build_wheel_cuml.sh
  • ci/build_wheel_libcuml.sh
  • ci/release/update-version.sh
  • python/cuml/cuml/ensemble/randomforest_common.pyx

@csadorf

csadorf commented May 21, 2026

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit a2d706e into NVIDIA:release/26.06 May 21, 2026
102 checks passed
@chyunsu3
chyunsu3 deleted the adopt_nvforest branch May 21, 2026 21:53
trxcllnt added a commit to rapidsai/devcontainers that referenced this pull request May 22, 2026
Add `nvforest` to the cuML C++ devcontainer dependency list so cuML
builds after nvForest when using the RAPIDS build-utils manifest.

Follow-up to NVIDIA/cuml#8048

---------

Co-authored-by: ptaylor <paul.e.taylor@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change ci CMake conda conda issue CUDA/C++ Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapt cuML to depend on nvForest

6 participants