Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_upstream_resource method to stream_checking_resource_adaptor #15203

Merged
21 changes: 18 additions & 3 deletions cpp/include/cudf_test/stream_checking_resource_adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cudf/detail/utilities/stacktrace.hpp>

#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/resource_ref.hpp>

#include <iostream>

Expand Down Expand Up @@ -57,12 +58,26 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
stream_checking_resource_adaptor& operator=(stream_checking_resource_adaptor&&) noexcept =
default;

/**
* @brief Returns the wrapped upstream resource
*
* @return The wrapped upstream resource
*/
[[nodiscard]] rmm::device_async_resource_ref get_upstream_resource() const noexcept
{
return upstream_;
}

/**
* @brief Return pointer to the upstream resource.
*
* @return Pointer to the upstream resource.
*/
Upstream* get_upstream() const noexcept { return upstream_; }
[[deprecated("Use get_upstream_resource instead")]] [[nodiscard]] Upstream* get_upstream()
const noexcept
{
return upstream_;
}

private:
/**
Expand Down Expand Up @@ -110,8 +125,8 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
{
if (this == &other) { return true; }
auto cast = dynamic_cast<stream_checking_resource_adaptor<Upstream> const*>(&other);
return cast != nullptr ? upstream_->is_equal(*cast->get_upstream())
: upstream_->is_equal(other);
if (cast == nullptr) { return upstream_->is_equal(other); }
return get_upstream_resource() == cast->get_upstream_resource();
}

/**
Expand Down
Loading