Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/include/cuml/fil/Implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ directory here.
implemented as a macro.

### Source Files
The experimental FIL source files contain no implementation details. They
The FIL source files contain no implementation details. They
merely use the macros defined in
`include/cuml/fil/detail/specializations` to indicate the template
instantiations that must be compiled. These are broken up into an arbitrary
Expand Down
7 changes: 2 additions & 5 deletions cpp/include/cuml/fil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LightGBM, or even Scikit-Learn/cuML's random forest implementations, FIL
cannot be used to _train_ forest models. Instead, its goal is to speed up
inference using forest models trained by all of those packages.

This directory contains an experimental new implementation of FIL which
This directory contains an implementation of FIL which
provides both CPU and GPU execution. Its GPU implementation also offers
improved performance relative to the existing implementation in many but not all cases.

Expand All @@ -26,10 +26,7 @@ implementation, much of the more general-purpose CPU-GPU interoperable code
has temporarily been put in the `raft_proto` namespace. As the name suggests,
the intention is that most or all of this functionality will either be moved
to RAFT or that RAFT features will be updated to provide CPU-GPU
compatible versions of the same. The public API includes just a few
references to this namespace, so be prepared to shift these references to the
corresponding RAFT symbols as this version of FIL progresses out of
experimental.
compatible versions of the same.

### Importing a model
FIL uses Treelite as a common translation layer for all its input types.
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuml/fil/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
namespace ML {
namespace fil {

/** Exception indicating model is incompatible with experimental FIL */
/** Exception indicating model is incompatible with FIL */
struct unusable_model_exception : std::exception {
unusable_model_exception() : msg_{"Model is not compatible with experimental FIL"} {}
unusable_model_exception() : msg_{"Model is not compatible with FIL"} {}
unusable_model_exception(std::string msg) : msg_{msg} {}
unusable_model_exception(char const* msg) : msg_{msg} {}
virtual char const* what() const noexcept { return msg_.c_str(); }
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/forest/traversal/traversal_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace ML {
namespace forest {

/** Exception indicating model is incompatible with experimental FIL */
/** Exception indicating model is incompatible with FIL */
struct parentless_node_exception : std::exception {
parentless_node_exception() : msg_{"Node does not track its parent"} {}
parentless_node_exception(std::string msg) : msg_{msg} {}
Expand Down
90 changes: 45 additions & 45 deletions cpp/tests/sg/rf_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,25 @@ std::shared_ptr<thrust::device_vector<LabelT>> FilPredict(
TreeliteModelHandle model;
build_treelite_forest(&model, forest, params.n_cols);

auto filex_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
std::is_same_v<DataT, double>,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
auto fil_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
std::is_same_v<DataT, double>,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
handle.sync_stream();
handle.sync_stream_pool();
delete static_cast<treelite::Model*>(model);

filex_model.predict(handle,
workspace->data().get(),
X_transpose,
params.n_rows,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
fil_model.predict(handle,
workspace->data().get(),
X_transpose,
params.n_rows,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
handle.sync_stream();
handle.sync_stream_pool();

Expand Down Expand Up @@ -281,25 +281,25 @@ auto FilPredictProba(const raft::handle_t& handle,
TreeliteModelHandle model;
build_treelite_forest(&model, forest, params.n_cols);

auto filex_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
std::is_same_v<DataT, double>,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
auto fil_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
std::is_same_v<DataT, double>,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
handle.sync_stream();
handle.sync_stream_pool();
delete static_cast<treelite::Model*>(model);

filex_model.predict(handle,
pred->data().get(),
X_transpose,
params.n_rows,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
fil_model.predict(handle,
pred->data().get(),
X_transpose,
params.n_rows,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
handle.sync_stream();
handle.sync_stream_pool();

Expand Down Expand Up @@ -657,25 +657,25 @@ TEST(RfTests, IntegerOverflow)
TreeliteModelHandle model;
build_treelite_forest(&model, forest_ptr, n);

auto filex_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
false,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
auto fil_model = ML::fil::import_from_treelite_handle(model,
ML::fil::tree_layout::breadth_first,
128,
false,
raft_proto::device_type::gpu,
handle.get_device(),
handle.get_next_usable_stream());
handle.sync_stream();
handle.sync_stream_pool();
delete static_cast<treelite::Model*>(model);

filex_model.predict(handle,
pred.data().get(),
X.data().get(),
m,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
fil_model.predict(handle,
pred.data().get(),
X.data().get(),
m,
raft_proto::device_type::gpu,
raft_proto::device_type::gpu,
ML::fil::infer_kind::default_kind,
1);
handle.sync_stream();
handle.sync_stream_pool();
}
Expand Down
81 changes: 6 additions & 75 deletions python/cuml/cuml/benchmark/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import cuml
import cuml.decomposition
import cuml.experimental
import cuml.metrics
import cuml.naive_bayes
from cuml.benchmark.bench_helper_funcs import (
Expand Down Expand Up @@ -452,11 +451,10 @@ def all_algorithms():
cuml.ForestInference,
shared_args=dict(num_rounds=100, max_depth=10),
cuml_args=dict(
fil_algo="AUTO",
output_class=False,
is_classifier=False,
threshold=0.5,
storage_type="auto",
precision="float32",
layout="depth_first",
),
name="FIL",
accepts_labels=False,
Expand All @@ -471,11 +469,10 @@ def all_algorithms():
cuml.ForestInference,
shared_args=dict(n_estimators=100, max_leaf_nodes=2**10),
cuml_args=dict(
fil_algo="AUTO",
output_class=False,
is_classifier=False,
threshold=0.5,
storage_type=True,
precision="float32",
layout="depth_first",
),
name="Sparse-FIL-SKL",
accepts_labels=False,
Expand All @@ -484,49 +481,15 @@ def all_algorithms():
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
treelite,
cuml.experimental.ForestInference,
shared_args=dict(num_rounds=100, max_depth=10),
cuml_args=dict(output_class=False),
name="FILEX",
accepts_labels=False,
setup_cpu_func=_build_gtil_classifier,
setup_cuml_func=_build_fil_classifier,
cpu_data_prep_hook=_treelite_format_hook,
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
treelite,
cuml.experimental.ForestInference,
shared_args=dict(num_rounds=100, max_depth=10),
cuml_args=dict(
fil_algo="NAIVE",
storage_type="DENSE",
output_class=False,
precision="float32",
infer_type="default",
model_type="xgboost_ubj",
),
name="FILEX-Optimized",
accepts_labels=False,
setup_cpu_func=_build_gtil_classifier,
setup_cuml_func=_build_optimized_fil_classifier,
cpu_data_prep_hook=_treelite_format_hook,
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
treelite,
cuml.ForestInference,
shared_args=dict(num_rounds=100, max_depth=10),
cuml_args=dict(
fil_algo="NAIVE",
storage_type="DENSE",
output_class=False,
is_classifier=False,
threshold=0.5,
precision="float32",
layout="depth_first",
),
name="FIL-Optimized",
accepts_labels=False,
Expand All @@ -536,38 +499,6 @@ def all_algorithms():
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
treelite,
cuml.experimental.ForestInference,
shared_args=dict(n_estimators=100, max_leaf_nodes=2**10),
cuml_args=dict(output_class=False),
name="Sparse-FILEX-SKL",
accepts_labels=False,
setup_cpu_func=_build_cpu_skl_classifier,
setup_cuml_func=_build_fil_skl_classifier,
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
treelite,
cuml.experimental.ForestInference,
shared_args=dict(
num_rounds=100, max_depth=10, infer_type="per_tree"
),
cuml_args=dict(
fil_algo="NAIVE",
storage_type="DENSE",
output_class=False,
precision="float32",
),
name="FILEX-PerTree",
accepts_labels=False,
setup_cpu_func=_build_gtil_classifier,
setup_cuml_func=_build_optimized_fil_classifier,
cpu_data_prep_hook=_numpy_format_hook,
accuracy_function=_treelite_fil_accuracy_score,
bench_func=predict,
),
AlgorithmPair(
UMAP,
cuml.manifold.UMAP,
Expand Down
Loading
Loading