Skip to content

[FEA]: Support inheritance from Buffer #2435

Description

@carterbox

Is this a duplicate?

Area

cuda.core

Is your feature request related to a problem? Please describe.

nvmath-python is considering creating a subclass of Buffer specific to NVSHMEM because we want to mostly follow cuda.core's semantics for Buffer/MemoryResource, but need some different behavior regarding garbage collection.

Describe the solution you'd like

Buffer should use classmethod instead of staticmethod for all methods that return an instance of the class. i.e. from_handle() and _reduce_helper()

Describe alternatives you've considered

Composing Buffer with our Buffer.
Replicating the Buffer protocol with an unrelated class.
Rolling our own MemoryResource/Buffer abstraction that is unique to nvmath's distributed APIs.

Additional context

Related to: #750

Activity

  1. mdboom commented on Jul 29, 2026

    @mdboom
    Contributor

    As an aside, do we want to consider a policy of favoring @classmethod over @staticmethod throughout CUDA core? I think unless there is a good reason to make a class "final" (in the C++ sense) we shouldn't make it hard to subclass.

    @Andy-Jost: thoughts?

  2. added this to the cuda.core next milestone on Sep 24, 2026
  3. added
    P1Medium priority - Should do
    and removed
    triageNeeds the team's attention
    cuda.coreEverything related to the cuda.core module
    on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should do

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions