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

Remove get_mem_info functions from custom memory resources #14832

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 1 addition & 26 deletions cpp/include/cudf_test/stream_checking_resource_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -71,16 +71,6 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
*/
bool supports_streams() const noexcept override { return upstream_->supports_streams(); }

/**
* @brief Query whether the resource supports the get_mem_info API.
*
* @return Whether or not the upstream resource supports get_mem_info
*/
bool supports_get_mem_info() const noexcept override
{
return upstream_->supports_get_mem_info();
}

private:
/**
* @brief Allocates memory of size at least `bytes` using the upstream
Expand Down Expand Up @@ -131,21 +121,6 @@ class stream_checking_resource_adaptor final : public rmm::mr::device_memory_res
: upstream_->is_equal(other);
}

/**
* @brief Get free and available memory from upstream resource.
*
* @throws `rmm::cuda_error` if unable to retrieve memory info.
* @throws `cudf::logic_error` if attempted on a default stream
*
* @param stream Stream on which to get the mem info.
* @return std::pair with available and free memory for resource
*/
std::pair<std::size_t, std::size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override
{
verify_stream(stream);
return upstream_->get_mem_info(stream);
}

/**
* @brief Throw an error if the provided stream is invalid.
*
Expand Down
14 changes: 1 addition & 13 deletions java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -96,8 +96,6 @@ class tracking_resource_adaptor final : public base_tracking_resource_adaptor {
return scoped_max_total_allocated;
}

bool supports_get_mem_info() const noexcept override { return resource->supports_get_mem_info(); }

bool supports_streams() const noexcept override { return resource->supports_streams(); }

private:
Expand Down Expand Up @@ -144,10 +142,6 @@ class tracking_resource_adaptor final : public base_tracking_resource_adaptor {
scoped_allocated -= size;
}
}

std::pair<size_t, size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override {
return resource->get_mem_info(stream);
}
};

template <typename Upstream>
Expand Down Expand Up @@ -213,8 +207,6 @@ class java_event_handler_memory_resource : public device_memory_resource {

device_memory_resource *get_wrapped_resource() { return resource; }

bool supports_get_mem_info() const noexcept override { return resource->supports_get_mem_info(); }

bool supports_streams() const noexcept override { return resource->supports_streams(); }

private:
Expand Down Expand Up @@ -277,10 +269,6 @@ class java_event_handler_memory_resource : public device_memory_resource {
}
}

std::pair<size_t, size_t> do_get_mem_info(rmm::cuda_stream_view stream) const override {
return resource->get_mem_info(stream);
}

protected:
JavaVM *jvm;
jobject handler_obj;
Expand Down