You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
I recall in an internal thread around Aug 13 we discussed that we prefer composition over inheritance, except for memory resources inheriting from the abstract base class. @carterbox is this still needed?
Activity
mdboom commentedon Jul 29, 2026
As an aside, do we want to consider a policy of favoring
@classmethodover@staticmethodthroughout 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?
leofang commentedon Nov 4, 2026
I recall in an internal thread around Aug 13 we discussed that we prefer composition over inheritance, except for memory resources inheriting from the abstract base class. @carterbox is this still needed?
carterbox commentedon Nov 5, 2026
We've decided to take option 3: "Rolling our own MemoryResource/Buffer abstraction that is unique to nvmath's distributed APIs."