@@ -46,17 +46,19 @@ def _lazy_init():
46
46
47
47
48
48
class Kernel :
49
- """Represents a compiled kernel that had been loaded onto the device.
49
+ """Represent a compiled kernel that had been loaded onto the device.
50
50
51
51
Kernel instances can execution when passed directly into a
52
52
launch function.
53
53
54
+ Directly creating a :obj:`Kernel` is not supported, and they
55
+ should instead be created through a :obj:`ObjectCode` object.
56
+
54
57
"""
55
58
56
59
__slots__ = ("_handle" , "_module" ,)
57
60
58
61
def __init__ (self ):
59
- """Unsupported function whose creation is intended through an :obj:`ObjectCode` object."""
60
62
raise NotImplementedError ("directly constructing a Kernel instance is not supported" )
61
63
62
64
@staticmethod
@@ -72,49 +74,41 @@ def _from_obj(obj, mod):
72
74
73
75
74
76
class ObjectCode :
75
- """Represents the compiled program loaded onto the device.
77
+ """Represent a compiled program that was loaded onto the device.
76
78
77
79
This object provides a unified interface for different types of
78
80
compiled programs that are loaded onto the device.
79
81
82
+ Loads the module library with specified module code and JIT options.
83
+
84
+ Note
85
+ ----
86
+ Usage under CUDA 11.x will only load to the current device
87
+ context.
88
+
89
+ Parameters
90
+ ----------
91
+ module : Union[bytes, str]
92
+ Either a bytes object containing the module to load, or
93
+ a file path string containing that module for loading.
94
+ code_type : Any
95
+ String of the compiled type.
96
+ Supported options are "ptx", "cubin" and "fatbin".
97
+ jit_options : Optional
98
+ Mapping of JIT options to use during module loading.
99
+ (Default to no options)
100
+ symbol_mapping : Optional
101
+ Keyword argument dictionary specifying how symbol names
102
+ should be mapped before trying to retrieve them.
103
+ (Default to no mappings)
104
+
80
105
"""
81
106
82
107
__slots__ = ("_handle" , "_code_type" , "_module" , "_loader" , "_sym_map" )
83
108
_supported_code_type = ("cubin" , "ptx" , "fatbin" )
84
109
85
110
def __init__ (self , module , code_type , jit_options = None , * ,
86
111
symbol_mapping = None ):
87
- """Create and return a compiled program as an instance of an :obj:`ObjectCode`.
88
-
89
- Loads the module library with specified module code and JIT options.
90
-
91
- Note
92
- ----
93
- Usage under CUDA 11.x will only load to the current device
94
- context.
95
-
96
- Parameters
97
- ----------
98
- module : Union[bytes, str]
99
- Either a bytes object containing the module to load, or
100
- a file path string containing that module for loading.
101
- code_type : Any
102
- String of the compiled type.
103
- Supported options are "ptx", "cubin" and "fatbin".
104
- jit_options : Optional
105
- Mapping of JIT options to use during module loading.
106
- (Default to no options)
107
- symbol_mapping : Optional
108
- Keyword argument dictionary specifying how symbol names
109
- should be mapped before trying to retrieve them.
110
- (Default to no mappings)
111
-
112
- Returns
113
- -------
114
- :obj:`ObjectCode`
115
- Newly created :obj:`ObjectCode`.
116
-
117
- """
118
112
if code_type not in self ._supported_code_type :
119
113
raise ValueError
120
114
_lazy_init ()
0 commit comments