Skip to content

Commit

Permalink
Add get_upstream_resource method to `stream_checking_resource_adapt…
Browse files Browse the repository at this point in the history
…or` (#15203)

Also deprecate `get_upstream` as we want to get away from raw upstreams

Authors:
  - Michael Schellenberger Costa (https://github.com/miscco)

Approvers:
  - Mark Harris (https://github.com/harrism)
  - David Wendt (https://github.com/davidwendt)

URL: #15203
  • Loading branch information
miscco authored Mar 6, 2024
1 parent ab20f47 commit bb0e4fd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 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 @@ -58,11 +59,14 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
default;

/**
* @brief Return pointer to the upstream resource.
* @brief Returns the wrapped upstream resource
*
* @return Pointer to the upstream resource.
* @return The wrapped upstream resource
*/
Upstream* get_upstream() const noexcept { return upstream_; }
[[nodiscard]] rmm::device_async_resource_ref get_upstream_resource() const noexcept
{
return upstream_;
}

private:
/**
Expand Down Expand Up @@ -110,8 +114,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

0 comments on commit bb0e4fd

Please sign in to comment.