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

Pinned vector factory that uses the global pool #15895

Merged
merged 44 commits into from
Jun 12, 2024

Conversation

vuule
Copy link
Contributor

@vuule vuule commented May 31, 2024

Description

closes #15612
Expanded the set of vector factories to cover pinned vectors. The functions return cudf::detail::host_vector, which use a type-erased allocator, allowing us to utilize the runtime configurable global pinned (previously host) resource.
The pinned_host_vector type has been removed as it can only support the non-pooled pinned allocations. Its use is not replaced with cudf::detail::host_vector.
Moved the global host (now pinned) resource out of cuIO and changed the type to host_device. User-specified resources are now required to allocate device-accessible memory. The name has been changed to pinned to reflect the new requirement.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@vuule vuule added feature request New feature or request breaking Breaking change labels May 31, 2024
@vuule vuule self-assigned this May 31, 2024
@github-actions github-actions bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels May 31, 2024
@@ -27,6 +27,7 @@
#include "io/utilities/parsing_utils.cuh"

#include <cudf/detail/utilities/cuda.cuh>
#include <cudf/detail/utilities/logger.hpp>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used to be included indirectly, same as cpp/src/io/orc/reader_impl_chunking.cu

@@ -380,7 +382,7 @@ thrust::host_vector<T> make_host_vector_async(device_span<T const> v, rmm::cuda_
* @brief Asynchronously construct a `std::vector` containing a copy of data from a device
* container
*
* @note This function synchronizes `stream`.
* @note This function does not synchronize `stream`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed typo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of the scope of the current PR, the _sync suffix in make_host_vector_sync is wordy and confusing and not aligned with CUDA/C++ naming convention: APIs are treated as synchronous by default and only asynchronous ones are named by adding a _async suffix. I assume this is also why the typo was introduced in the first place.

@@ -19,6 +19,7 @@
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/error.hpp>

#include <rmm/aligned.hpp>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used to be included indirectly

@@ -32,7 +33,7 @@ namespace {

struct host_ticket {
cudaEvent_t event;
cudf::detail::pinned_host_vector<char> buffer;
std::unique_ptr<cudf::detail::rmm_host_vector<char>> buffer;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an array of host_tickets, so it needs to have a default constructor

Copy link
Contributor Author

@vuule vuule May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to a separate file with plans to add other user-facing APIs related to pinned memory.
No real changes to the code, just move + rebrand to pinned

@github-actions github-actions bot added the Java Affects Java cuDF API. label May 31, 2024
@vuule
Copy link
Contributor Author

vuule commented May 31, 2024

@abellina I changed the API namespace and replaced host with pinned to reflect the new requirement; updated the Java side until CI passed, please review when you get a chance.

@vuule vuule marked this pull request as ready for review June 3, 2024 17:13
@vuule vuule requested review from a team as code owners June 3, 2024 17:13
@abellina abellina self-requested a review June 3, 2024 21:33
@github-actions github-actions bot added Python Affects Python cuDF API. cudf.pandas Issues specific to cudf.pandas pylibcudf Issues specific to the pylibcudf package labels Jun 11, 2024
@vuule vuule changed the base branch from branch-24.08 to branch-24.06 June 11, 2024 00:28
@vuule vuule requested a review from a team as a code owner June 11, 2024 00:28
@vuule vuule changed the base branch from branch-24.06 to branch-24.08 June 11, 2024 00:29
@github-actions github-actions bot removed Python Affects Python cuDF API. cudf.pandas Issues specific to cudf.pandas pylibcudf Issues specific to the pylibcudf package labels Jun 11, 2024
@vuule vuule requested a review from harrism June 11, 2024 00:43
@vyasr vyasr removed request for a team June 11, 2024 00:50
@vuule vuule added the 3 - Ready for Review Ready for review by team label Jun 11, 2024
Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, and thanks for the design discussions!

static_assert(cuda::mr::resource_with<fixed_pinned_pool_memory_resource,
cuda::mr::device_accessible,
cuda::mr::host_accessible>,
"");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a message? This would be a compile-time error, right?

@vuule vuule added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jun 11, 2024
@vuule
Copy link
Contributor Author

vuule commented Jun 12, 2024

/merge

@rapids-bot rapids-bot bot merged commit f7ba6ab into rapidsai:branch-24.08 Jun 12, 2024
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge breaking Breaking change CMake CMake build issue feature request New feature or request Java Affects Java cuDF API. libcudf Affects libcudf (C++/CUDA) code.
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

[FEA] Have a global pinned memory pool by default
7 participants