Skip to content

Commit

Permalink
Use RMM adaptor constructors instead of factories. (#16414)
Browse files Browse the repository at this point in the history
This PR uses RMM memory resource adaptor constructors instead of factory functions. With CTAD, we do not need the factory and can use the constructor directly. The factory will be deprecated in rapidsai/rmm#1626.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Jayjeet Chakraborty (https://github.com/JayjeetAtGithub)

URL: #16414
  • Loading branch information
bdice authored Jul 30, 2024
1 parent e8048f7 commit 368a34c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cpp/benchmarks/fixture/benchmark_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class memory_stats_logger {
public:
memory_stats_logger()
: existing_mr(rmm::mr::get_current_device_resource()),
statistics_mr(rmm::mr::make_statistics_adaptor(existing_mr))
statistics_mr(rmm::mr::statistics_resource_adaptor(existing_mr))
{
rmm::mr::set_current_device_resource(&statistics_mr);
}
Expand Down
12 changes: 0 additions & 12 deletions cpp/include/cudf_test/stream_checking_resource_adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,4 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
// cudf::test::get_default_stream() is observed.
};

/**
* @brief Convenience factory to return a `stream_checking_resource_adaptor` around the
* upstream resource `upstream`.
*
* @param upstream Reference to the upstream resource
*/
inline stream_checking_resource_adaptor make_stream_checking_resource_adaptor(
rmm::device_async_resource_ref upstream, bool error_on_invalid_stream, bool check_default_stream)
{
return stream_checking_resource_adaptor{upstream, error_on_invalid_stream, check_default_stream};
}

} // namespace cudf::test
2 changes: 1 addition & 1 deletion cpp/include/cudf_test/testing_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ inline auto make_stream_mode_adaptor(cxxopts::ParseResult const& cmd_opts)
auto const stream_error_mode = cmd_opts["stream_error_mode"].as<std::string>();
auto const error_on_invalid_stream = (stream_error_mode == "error");
auto const check_default_stream = (stream_mode == "new_cudf_default");
auto adaptor = cudf::test::make_stream_checking_resource_adaptor(
auto adaptor = cudf::test::stream_checking_resource_adaptor(
resource, error_on_invalid_stream, check_default_stream);
if ((stream_mode == "new_cudf_default") || (stream_mode == "new_testing_default")) {
rmm::mr::set_current_device_resource(&adaptor);
Expand Down
7 changes: 0 additions & 7 deletions java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,6 @@ class tracking_resource_adaptor final : public base_tracking_resource_adaptor {
}
};

template <typename Upstream>
tracking_resource_adaptor<Upstream>* make_tracking_adaptor(Upstream* upstream,
std::size_t size_alignment)
{
return new tracking_resource_adaptor<Upstream>{upstream, size_alignment};
}

/**
* @brief An RMM device memory resource adaptor that delegates to the wrapped resource
* for most operations but will call Java to handle certain situations (e.g.: allocation failure).
Expand Down

0 comments on commit 368a34c

Please sign in to comment.