Background
CodeRabbit flagged that callback_memory_resource accepts alignment through the resource interface but the callback signatures do not include alignment, so the implementation cannot forward alignment to user callbacks:
#2361 (comment)
The current callback types are shaped around (bytes, stream, arg) and (ptr, bytes, stream, arg). callback_memory_resource_impl::allocate() and deallocate() receive an alignment parameter from the CCCL/RMM resource interface, but discard it before invoking the user callbacks.
Problem
Silently ignoring alignment can violate the resource contract for callers that request non-default alignment. However, changing the callback signatures is a user-facing API change, and rejecting non-default alignment may be surprising for existing callback users.
Furthermore, the callback API signatures don't match the current CCCL argument ordering, and we should fix that as a part of the same API break.
Desired Solution
Update callback API signature to match CCCL allocate/deallocate. Verify alignments are valid (a power of two) before calling the allocate API. Forward alignments through to the allocate call.
Background
CodeRabbit flagged that
callback_memory_resourceaccepts alignment through the resource interface but the callback signatures do not include alignment, so the implementation cannot forward alignment to user callbacks:#2361 (comment)
The current callback types are shaped around
(bytes, stream, arg)and(ptr, bytes, stream, arg).callback_memory_resource_impl::allocate()anddeallocate()receive an alignment parameter from the CCCL/RMM resource interface, but discard it before invoking the user callbacks.Problem
Silently ignoring alignment can violate the resource contract for callers that request non-default alignment. However, changing the callback signatures is a user-facing API change, and rejecting non-default alignment may be surprising for existing callback users.
Furthermore, the callback API signatures don't match the current CCCL argument ordering, and we should fix that as a part of the same API break.
Desired Solution
Update callback API signature to match CCCL allocate/deallocate. Verify alignments are valid (a power of two) before calling the allocate API. Forward alignments through to the allocate call.