@@ -170,6 +170,15 @@ class uuid:
170170class hw_context :
171171 """A hardware context associates an xclbin with hardware resources."""
172172
173+ class access_mode (IntEnum ):
174+ """Hardware context access mode."""
175+ exclusive : hw_context .access_mode
176+ shared : hw_context .access_mode
177+
178+ # Class-level enum value aliases
179+ exclusive : access_mode
180+ shared : access_mode
181+
173182 @overload
174183 def __init__ (self ) -> None :
175184 """Create an empty hardware context."""
@@ -185,6 +194,70 @@ class hw_context:
185194 """
186195 ...
187196
197+ @overload
198+ def __init__ (self , device : device , uuid : uuid , mode : access_mode ) -> None :
199+ """Create a hardware context for a registered xclbin UUID with a specific access mode."""
200+ ...
201+
202+ @overload
203+ def __init__ (self , device : device , uuid : uuid , cfg_param : dict [str , int ]) -> None :
204+ """Create a hardware context for a registered xclbin UUID with configuration parameters."""
205+ ...
206+
207+ @overload
208+ def __init__ (self , device : device , xclbin : xclbin ) -> None :
209+ """Create a hardware context for a device from an xclbin object.
210+
211+ The xclbin is registered with the device and a hardware context is
212+ created for the registered image.
213+
214+ Args:
215+ device: The device to create the context on.
216+ xclbin: The xclbin object to register and associate with this context.
217+ """
218+ ...
219+
220+ @overload
221+ def __init__ (self , device : device , xclbin : xclbin , mode : access_mode ) -> None :
222+ """Create a hardware context for a device from an xclbin object with a specific access mode."""
223+ ...
224+
225+ @overload
226+ def __init__ (self , device : device , xclbin : xclbin , cfg_param : dict [str , int ]) -> None :
227+ """Create a hardware context for a device from an xclbin object with configuration parameters."""
228+ ...
229+
230+ @overload
231+ def __init__ (self , device : device , xclbin_path : str ) -> None :
232+ """Create a hardware context for a device from an xclbin file path.
233+
234+ The xclbin is loaded from disk, registered with the device, and used
235+ to create a hardware context.
236+
237+ Args:
238+ device: The device to create the context on.
239+ xclbin_path: Path to the xclbin file.
240+ """
241+ ...
242+
243+ @overload
244+ def __init__ (self , device : device , xclbin_path : str , mode : access_mode ) -> None :
245+ """Create a hardware context for a device from an xclbin file path with a specific access mode."""
246+ ...
247+
248+ @overload
249+ def __init__ (self , device : device , xclbin_path : str , cfg_param : dict [str , int ]) -> None :
250+ """Create a hardware context for a device from an xclbin file path with configuration parameters."""
251+ ...
252+
253+ @overload
254+ def __init__ (self , device : device , cfg_param : dict [str , int ], mode : access_mode ) -> None :
255+ """Create a hardware context placeholder with configuration parameters and access mode.
256+
257+ A configuration ELF can be added later with add_config().
258+ """
259+ ...
260+
188261 @overload
189262 def __init__ (self , device : device , elf : elf ) -> None :
190263 """Create a hardware context for a device with an ELF object.
@@ -194,6 +267,31 @@ class hw_context:
194267 elf: The ELF object to associate with this context.
195268 """
196269 ...
270+
271+ @overload
272+ def __init__ (self , device : device , elf : elf , cfg_param : dict [str , int ], mode : access_mode ) -> None :
273+ """Create a hardware context for a device with an ELF object, configuration parameters, and access mode."""
274+ ...
275+
276+ def add_config (self , elf : elf ) -> None :
277+ """Add an ELF configuration object to the hardware context."""
278+ ...
279+
280+ def get_device (self ) -> device :
281+ """Get the device from which the hardware context was created."""
282+ ...
283+
284+ def get_xclbin_uuid (self ) -> uuid :
285+ """Get the UUID of the xclbin associated with the hardware context."""
286+ ...
287+
288+ def get_xclbin (self ) -> xclbin :
289+ """Get the xclbin associated with the hardware context."""
290+ ...
291+
292+ def get_mode (self ) -> access_mode :
293+ """Get the access mode of the hardware context."""
294+ ...
197295
198296
199297class device :
@@ -222,38 +320,45 @@ class device:
222320 """
223321 ...
224322
225- @overload
226- def load_xclbin (self , xclbin_path : str ) -> uuid :
227- """Load an xclbin given the path to the device.
323+ def register_xclbin (self , xclbin : xclbin ) -> uuid :
324+ """Register an xclbin with the device.
325+
326+ Registration returns the xclbin UUID. Use hw_context to associate the
327+ registered xclbin with hardware resources for kernel and BO creation.
228328
229329 Args:
230- xclbin_path: Path to the xclbin file .
330+ xclbin: The xclbin object to register .
231331
232332 Returns:
233- UUID of the loaded xclbin.
333+ UUID of the registered xclbin.
234334 """
235335 ...
236336
237337 @overload
238- def load_xclbin (self , xclbin : xclbin ) -> uuid :
239- """Load the xclbin to the device.
338+ def load_xclbin (self , xclbin_path : str ) -> uuid :
339+ """Deprecated compatibility shim. Load an xclbin file and return its UUID.
340+
341+ Prefer hw_context(self, xclbin_path) for new code.
240342
241343 Args:
242- xclbin: The xclbin object to load.
344+ xclbin_path: Path to the xclbin file to load.
243345
244346 Returns:
245347 UUID of the loaded xclbin.
246348 """
247349 ...
248350
249- def register_xclbin (self , xclbin : xclbin ) -> uuid :
250- """Register an xclbin with the device.
351+ @overload
352+ def load_xclbin (self , xclbin : xclbin ) -> uuid :
353+ """Deprecated compatibility shim. Load an xclbin object and return its UUID.
354+
355+ Prefer hw_context(self, xclbin) for new code.
251356
252357 Args:
253- xclbin: The xclbin object to register .
358+ xclbin: The xclbin object to load .
254359
255360 Returns:
256- UUID of the registered xclbin.
361+ UUID of the loaded xclbin.
257362 """
258363 ...
259364
@@ -494,6 +599,35 @@ class bo:
494599 """
495600 ...
496601
602+ @overload
603+ def __init__ (
604+ self ,
605+ ctx : hw_context ,
606+ size : SupportsInt ,
607+ flags : flags ,
608+ group : SupportsInt
609+ ) -> None :
610+ """Create a buffer object with specified properties in a hardware context.
611+
612+ Args:
613+ ctx: The hardware context to allocate the buffer in.
614+ size: Size of the buffer in bytes.
615+ flags: Buffer creation flags.
616+ group: Memory bank group ID.
617+ """
618+ ...
619+
620+ @overload
621+ def __init__ (self , ctx : hw_context , size : SupportsInt , group : SupportsInt ) -> None :
622+ """Create a buffer object with default flags in a hardware context.
623+
624+ Args:
625+ ctx: The hardware context to allocate the buffer in.
626+ size: Size of the buffer in bytes.
627+ group: Memory bank group ID.
628+ """
629+ ...
630+
497631 @overload
498632 def __init__ (self , parent : bo , size : SupportsInt , offset : SupportsInt ) -> None :
499633 """Create a sub-buffer of an existing buffer object.
@@ -821,7 +955,7 @@ class program:
821955
822956
823957class module :
824- """Functions an application will execute in hardware ."""
958+ """Executable hardware module created from an ELF image ."""
825959
826960 def __init__ (self , elf : elf ) -> None :
827961 """Create a module from an ELF object.
@@ -832,7 +966,7 @@ class module:
832966 ...
833967
834968 def get_hw_context (self ) -> hw_context :
835- """Get hw context of module.
969+ """Get the hardware context associated with the module.
836970
837971 Returns:
838972 Hardware context associated with the module.
@@ -841,7 +975,7 @@ class module:
841975
842976
843977class runlist :
844- """Represents a list of runs to be executed ."""
978+ """Ordered collection of runs executed as a unit ."""
845979
846980 @overload
847981 def __init__ (self ) -> None :
@@ -910,7 +1044,7 @@ class _ext_access_mode(IntEnum):
9101044
9111045
9121046class _ext_bo (bo ):
913- """Represents an enhanced version of xrt::bo with support for access mode ."""
1047+ """Extended buffer object with explicit sharing and access controls ."""
9141048
9151049 @overload
9161050 def __init__ (
@@ -1011,7 +1145,7 @@ class _ext_bo(bo):
10111145
10121146
10131147class _ext_kernel (kernel ):
1014- """Represents an external kernel object."""
1148+ """Extended kernel object for module-backed and shared workflows ."""
10151149
10161150 @overload
10171151 def __init__ (self , ctx : hw_context , mod : module , name : str ) -> None :
@@ -1036,7 +1170,7 @@ class _ext_kernel(kernel):
10361170
10371171
10381172class ext :
1039- """Submodule for extended XRT functionality."""
1173+ """Extended XRT functionality."""
10401174
10411175 # Type aliases for the ext submodule
10421176 access_mode = _ext_access_mode
0 commit comments