Skip to content

Commit b56e37e

Browse files
committed
cuda.core: clarify ObjectCode.handle vs get_module() docstrings
Document that .handle returns the native context-independent CUlibrary for cuda.core/newer APIs, while get_module() is a legacy-interop bridge returning a context-dependent CUmodule via cuLibraryGetModule.
1 parent 600176e commit b56e37e

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎cuda_core/cuda/core/_module.pyi‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ class ObjectCode:
459459
"""
460460

461461
def get_module(self) -> object:
462-
"""Return the :obj:`~driver.CUmodule` associated with this object code.
462+
"""Return a context-dependent :obj:`~driver.CUmodule` for legacy interop.
463+
464+
Bridges the native :obj:`~driver.CUlibrary` (see :attr:`handle`) to a
465+
``CUmodule`` via ``cuLibraryGetModule``, for use with legacy driver APIs
466+
that only accept ``CUmodule``.
463467
464468
Returns
465469
-------
@@ -486,7 +490,10 @@ class ObjectCode:
486490

487491
@property
488492
def handle(self) -> object:
489-
"""Return the underlying handle object.
493+
"""Return the native, context-independent :obj:`~driver.CUlibrary` handle.
494+
495+
Used by ``cuda.core`` and newer driver library APIs. For legacy APIs
496+
that only accept a ``CUmodule``, use :meth:`get_module` instead.
490497
491498
.. caution::
492499

‎cuda_core/cuda/core/_module.pyx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,11 @@ cdef class ObjectCode:
798798
return Kernel._from_handle(h_kernel)
799799

800800
def get_module(self) -> object:
801-
"""Return the :obj:`~driver.CUmodule` associated with this object code.
801+
"""Return a context-dependent :obj:`~driver.CUmodule` for legacy interop.
802+
803+
Bridges the native :obj:`~driver.CUlibrary` (see :attr:`handle`) to a
804+
``CUmodule`` via ``cuLibraryGetModule``, for use with legacy driver APIs
805+
that only accept ``CUmodule``.
802806

803807
Returns
804808
-------
@@ -834,7 +838,10 @@ cdef class ObjectCode:
834838

835839
@property
836840
def handle(self) -> object:
837-
"""Return the underlying handle object.
841+
"""Return the native, context-independent :obj:`~driver.CUlibrary` handle.
842+
843+
Used by ``cuda.core`` and newer driver library APIs. For legacy APIs
844+
that only accept a ``CUmodule``, use :meth:`get_module` instead.
838845

839846
.. caution::
840847

0 commit comments

Comments
 (0)