Skip to content

Use cudf::pack with pinned mr in TableChunk::copy#966

Open
nirandaperera wants to merge 21 commits into
rapidsai:mainfrom
nirandaperera:table_chunk_pinned_copy
Open

Use cudf::pack with pinned mr in TableChunk::copy#966
nirandaperera wants to merge 21 commits into
rapidsai:mainfrom
nirandaperera:table_chunk_pinned_copy

Conversation

@nirandaperera
Copy link
Copy Markdown
Contributor

@nirandaperera nirandaperera commented Apr 13, 2026

In a previous analysis we found that using cudf::pack with a pinned mem resource performs similar to,

  1. packing to device memory and copying.
  2. chunk packing into pinned memory directly.

Since (1) use unreserved device memory, TableChunk::copy is prone to OOM. This PR changes pinned memory to use cudf::pack directly.

Depends on #967

Signed-off-by: niranda perera <niranda.perera@gmail.com>
@nirandaperera nirandaperera requested a review from a team as a code owner April 13, 2026 23:33
@nirandaperera nirandaperera added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Apr 13, 2026
@nirandaperera
Copy link
Copy Markdown
Contributor Author

This PR depends on #967 because it now requires precise packed sizes for pinned memory.

Comment thread cpp/include/rapidsmpf/memory/buffer_resource.hpp Outdated
Comment thread cpp/include/rapidsmpf/memory/buffer_resource.hpp Outdated
Comment thread cpp/src/memory/buffer_resource.cpp Outdated
Comment thread cpp/src/streaming/cudf/table_chunk.cpp Outdated
Comment thread cpp/src/streaming/cudf/table_chunk.cpp Outdated
Copy link
Copy Markdown
Member

@pentschev pentschev left a comment

Choose a reason for hiding this comment

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

Looks good overall, left some requests for typo fixes and phrasing improvements, and a nit.

nirandaperera and others added 4 commits April 17, 2026 08:17
Co-authored-by: Peter Andreas Entschev <peter@entschev.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
@nirandaperera nirandaperera requested a review from pentschev April 20, 2026 22:46
Copy link
Copy Markdown
Member

@pentschev pentschev left a comment

Choose a reason for hiding this comment

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

Thanks Niranda.

Comment thread cpp/src/streaming/cudf/table_chunk.cpp Outdated
Comment thread cpp/src/streaming/cudf/table_chunk.cpp
Comment thread cpp/src/memory/buffer_resource.cpp
@nirandaperera nirandaperera requested a review from wence- April 22, 2026 17:22
Signed-off-by: niranda perera <niranda.perera@gmail.com>
…_pinned_copy

Signed-off-by: niranda perera <niranda.perera@gmail.com>
Signed-off-by: niranda perera <niranda.perera@gmail.com>
@nirandaperera nirandaperera requested a review from a team as a code owner May 12, 2026 19:56
Signed-off-by: niranda perera <niranda.perera@gmail.com>
@nirandaperera nirandaperera requested a review from pentschev May 12, 2026 20:08
Copy link
Copy Markdown
Member

@madsbk madsbk left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @nirandaperera

Comment thread cpp/include/rapidsmpf/memory/resource_types.hpp Outdated
Comment thread cpp/include/rapidsmpf/memory/resource_types.hpp Outdated
Comment thread cpp/src/streaming/cudf/table_chunk.cpp Outdated
nirandaperera and others added 2 commits May 13, 2026 10:12
Copy link
Copy Markdown
Member

@pentschev pentschev left a comment

Choose a reason for hiding this comment

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

Minor question/nit, looks good otherwise, thanks Niranda.

Comment thread cpp/src/memory/buffer_resource.cpp
Copy link
Copy Markdown
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Tiny suggestions

Comment thread cpp/include/rapidsmpf/memory/resource_types.hpp Outdated
Comment on lines +39 to +40
return accessibility == cuda::mr::__memory_accessibility::__host
|| accessibility == cuda::mr::__memory_accessibility::__host_device;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there really no public way to do this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately no (at least not that I know of)

get_property(mr, cuda::mr::dynamic_accessibility_property{});
return accessibility == cuda::mr::__memory_accessibility::__device
|| accessibility == cuda::mr::__memory_accessibility::__host_device;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can avoid the dynamic lookup if you if constexpr (has_property<mr, device_accessible>) otherwise fallback?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants