Skip to content

Bind MemoryReservation::split() to Python - #1182

Merged
rapids-bot[bot] merged 1 commit into
rapidsai:mainfrom
madsbk:bind-memory-reservation-split
Aug 31, 2026
Merged

Bind MemoryReservation::split() to Python#1182
rapids-bot[bot] merged 1 commit into
rapidsai:mainfrom
madsbk:bind-memory-reservation-split

Conversation

@madsbk

@madsbk madsbk commented Aug 31, 2026

Copy link
Copy Markdown
Member

Exposes the split() added in #1177 as MemoryReservation.split(size).

Together with the existing opaque_memory_usage context manager, callers can scope part of a reservation to the allocation it covers:

with opaque_memory_usage(reservation.split(reorder_bytes)):
    reordered, offsets = plc.partitioning.hash_partition(...)
# the reorder's bytes are released here

instead of computing the remainder and releasing it by hand. This lets cudf-polars' shuffle actors drop a helper and its bookkeeping at two call sites.

Also fixes the opaque_memory_usage docstring example, which passed an argument the function doesn't take.

@madsbk madsbk self-assigned this Aug 31, 2026
@madsbk madsbk added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Aug 31, 2026
@madsbk
madsbk force-pushed the bind-memory-reservation-split branch from 6116f95 to 9944217 Compare August 31, 2026 07:03
@madsbk
madsbk marked this pull request as ready for review August 31, 2026 07:35
@madsbk
madsbk requested a review from a team as a code owner August 31, 2026 07:35
@rapidsai rapidsai deleted a comment from copy-pr-bot Bot Aug 31, 2026

@pentschev pentschev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@madsbk

madsbk commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Thanks @pentschev

@madsbk

madsbk commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 46746d0 into rapidsai:main Aug 31, 2026
62 checks passed
@madsbk
madsbk deleted the bind-memory-reservation-split branch August 31, 2026 08:24
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.

2 participants