cuda.core.textures.SurfaceObject#
- class cuda.core.textures.SurfaceObject(*args, **kwargs)#
A bindless surface handle for kernel-side typed load/store.
Wraps
cuSurfObjectCreate. Unlike aTextureObject, a surface has no sampling state (no filtering, no addressing modes, no normalization); kernels read and write through it using integer pixel coordinates.The backing
CUDAArraymust have been created withis_surface_load_store=Trueand is kept alive for the lifetime of this object to prevent dangling handles.Construct via
from_array()orfrom_descriptor(). Passes to kernels as a 64-bit handle (via thehandleproperty).Methods
- __init__(*args, **kwargs)#
- close(self)#
Release this object’s reference to the underlying
CUsurfObject.Destruction (
cuSurfObjectDestroy) and release of the backing array happen via the handle’s deleter when the last reference is dropped. Idempotent.
- classmethod from_array(cls, array)#
Create a surface object directly from an
CUDAArray.The array must have been created with
is_surface_load_store=True.
- classmethod from_descriptor(cls, *, resource)#
Create a surface object from a
ResourceDescriptor.- Parameters:
resource (ResourceDescriptor) – Must wrap an
CUDAArrayallocated withis_surface_load_store=True. Linear/pitch2d resources are not valid surface backings.
Attributes
- device#
- handle#
The underlying
CUsurfObjectas an integer (64-bit kernel arg).
- resource#
The
ResourceDescriptorthis surface was built from.