Skip to content

Fix callback memory resource allocation API to match CCCL and support alignment #2397

@bdice

Description

@bdice

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    To-do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions