rocm.hipfile.buffer#

2026-09-24

4 min read time

Applies to Linux and Windows

Advanced Micro Devices, Inc.

Classes#

Buffer

Lifecycle manager for a hipFile-registered GPU memory region.

Module Contents#

class rocm.hipfile.buffer.Buffer(buffer_ptr, length, flags)#

Lifecycle manager for a hipFile-registered GPU memory region.

The caller pre-allocates the underlying device buffer (typically via hipMalloc or any equivalent GPU-allocator) and constructs a Buffer to register it with the hipFile driver. Deregistration happens on context exit (or via explicit deregister).

Use as a context manager:

with Buffer(ptr, length, flags=0) as registered_buf:

…

classmethod from_ctypes_void_p(ctypes_void_p: ctypes.c_void_p, length, flags)#

Construct a Buffer from a ctypes.c_void_p.

property ptr#
deregister()#
register()#