forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyxrt.pyi
More file actions
1188 lines (928 loc) · 32.5 KB
/
Copy pathpyxrt.pyi
File metadata and controls
1188 lines (928 loc) · 32.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SPDX-License-Identifier: MIT
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
from __future__ import annotations
import sys
from enum import IntEnum
from typing import (
Any,
Callable,
Iterator,
List,
Sequence,
SupportsInt,
TYPE_CHECKING,
Union,
overload,
)
if TYPE_CHECKING:
import numpy as np
import numpy.typing as npt
NDArrayInt8 = npt.NDArray[np.int8]
else:
try:
import numpy as np
import numpy.typing as npt
NDArrayInt8 = npt.NDArray[np.int8]
except ImportError:
np = None # type: ignore[assignment]
npt = None # type: ignore[assignment]
NDArrayInt8 = Any
# Buffer protocol type - accepts bytes, bytearray, memoryview, numpy arrays, etc.
if sys.version_info >= (3, 12):
from collections.abc import Buffer as ReadableBuffer
elif npt is not None:
# For Python < 3.12, include numpy arrays when numpy is available
ReadableBuffer = Union[bytes, bytearray, memoryview, NDArrayInt8] # type: ignore[misc]
else:
# Fallback without numpy
ReadableBuffer = Union[bytes, bytearray, memoryview, Any] # type: ignore[misc]
# Type aliases
memory_group = int
export_handle = int
pid_type = int
# Constants
XCL_BO_FLAGS_NONE: int
# =============================================================================
# Enumerations
# =============================================================================
class xclBOSyncDirection(IntEnum):
"""DMA flags used with DMA API"""
XCL_BO_SYNC_BO_TO_DEVICE: xclBOSyncDirection
XCL_BO_SYNC_BO_FROM_DEVICE: xclBOSyncDirection
XCL_BO_SYNC_BO_GMIO_TO_AIE: xclBOSyncDirection
XCL_BO_SYNC_BO_AIE_TO_GMIO: xclBOSyncDirection
class ert_cmd_state(IntEnum):
"""Kernel execution status"""
ERT_CMD_STATE_NEW: ert_cmd_state
ERT_CMD_STATE_QUEUED: ert_cmd_state
ERT_CMD_STATE_COMPLETED: ert_cmd_state
ERT_CMD_STATE_ERROR: ert_cmd_state
ERT_CMD_STATE_ABORT: ert_cmd_state
ERT_CMD_STATE_SUBMITTED: ert_cmd_state
ERT_CMD_STATE_TIMEOUT: ert_cmd_state
ERT_CMD_STATE_NORESPONSE: ert_cmd_state
ERT_CMD_STATE_SKERROR: ert_cmd_state
ERT_CMD_STATE_SKCRASHED: ert_cmd_state
class xrt_info_device(IntEnum):
"""Device feature and sensor information"""
bdf: xrt_info_device
interface_uuid: xrt_info_device
kdma: xrt_info_device
max_clock_frequency_mhz: xrt_info_device
m2m: xrt_info_device
name: xrt_info_device # type: ignore[assignment]
nodma: xrt_info_device
offline: xrt_info_device
electrical: xrt_info_device
thermal: xrt_info_device
mechanical: xrt_info_device
memory: xrt_info_device
platform: xrt_info_device
pcie_info: xrt_info_device
host: xrt_info_device
dynamic_regions: xrt_info_device
vmr: xrt_info_device
class xrt_msg_level(IntEnum):
"""XRT log message level"""
emergency: xrt_msg_level
alert: xrt_msg_level
critical: xrt_msg_level
error: xrt_msg_level
warning: xrt_msg_level
notice: xrt_msg_level
info: xrt_msg_level
debug: xrt_msg_level
# Exported enum values at module level
emergency: xrt_msg_level
alert: xrt_msg_level
critical: xrt_msg_level
error: xrt_msg_level
warning: xrt_msg_level
notice: xrt_msg_level
info: xrt_msg_level
debug: xrt_msg_level
# =============================================================================
# Global Functions
# =============================================================================
def enumerate_devices() -> int:
"""Enumerate devices in system.
Returns:
Number of devices found in the system.
"""
...
def log_message(level: xrt_msg_level, tag: str, message: str) -> None:
"""Dispatch formatted log message.
Args:
level: The log level for the message.
tag: A tag string to identify the message source.
message: The log message to dispatch.
"""
...
# =============================================================================
# Classes
# =============================================================================
class uuid:
"""XRT UUID object to identify a compiled xclbin binary."""
def __init__(self, uuid_str: str) -> None:
"""Create a UUID from a string representation.
Args:
uuid_str: String representation of the UUID.
"""
...
def to_string(self) -> str:
"""Convert XRT UUID object to string.
Returns:
String representation of the UUID.
"""
...
class hw_context:
"""A hardware context associates an xclbin with hardware resources."""
class access_mode(IntEnum):
"""Hardware context access mode."""
exclusive: hw_context.access_mode
shared: hw_context.access_mode
# Class-level enum value aliases
exclusive: access_mode
shared: access_mode
@overload
def __init__(self) -> None:
"""Create an empty hardware context."""
...
@overload
def __init__(self, device: device, uuid: uuid) -> None:
"""Create a hardware context for a device with a specific xclbin UUID.
Args:
device: The device to create the context on.
uuid: The UUID of the xclbin to associate with this context.
"""
...
@overload
def __init__(self, device: device, uuid: uuid, mode: access_mode) -> None:
"""Create a hardware context for a registered xclbin UUID with a specific access mode."""
...
@overload
def __init__(self, device: device, uuid: uuid, cfg_param: dict[str, int]) -> None:
"""Create a hardware context for a registered xclbin UUID with configuration parameters."""
...
@overload
def __init__(self, device: device, xclbin: xclbin) -> None:
"""Create a hardware context for a device from an xclbin object.
The xclbin is registered with the device and a hardware context is
created for the registered image.
Args:
device: The device to create the context on.
xclbin: The xclbin object to register and associate with this context.
"""
...
@overload
def __init__(self, device: device, xclbin: xclbin, mode: access_mode) -> None:
"""Create a hardware context for a device from an xclbin object with a specific access mode."""
...
@overload
def __init__(self, device: device, xclbin: xclbin, cfg_param: dict[str, int]) -> None:
"""Create a hardware context for a device from an xclbin object with configuration parameters."""
...
@overload
def __init__(self, device: device, xclbin_path: str) -> None:
"""Create a hardware context for a device from an xclbin file path.
The xclbin is loaded from disk, registered with the device, and used
to create a hardware context.
Args:
device: The device to create the context on.
xclbin_path: Path to the xclbin file.
"""
...
@overload
def __init__(self, device: device, xclbin_path: str, mode: access_mode) -> None:
"""Create a hardware context for a device from an xclbin file path with a specific access mode."""
...
@overload
def __init__(self, device: device, xclbin_path: str, cfg_param: dict[str, int]) -> None:
"""Create a hardware context for a device from an xclbin file path with configuration parameters."""
...
@overload
def __init__(self, device: device, cfg_param: dict[str, int], mode: access_mode) -> None:
"""Create a hardware context placeholder with configuration parameters and access mode.
A configuration ELF can be added later with add_config().
"""
...
@overload
def __init__(self, device: device, elf: elf) -> None:
"""Create a hardware context for a device with an ELF object.
Args:
device: The device to create the context on.
elf: The ELF object to associate with this context.
"""
...
@overload
def __init__(self, device: device, elf: elf, cfg_param: dict[str, int], mode: access_mode) -> None:
"""Create a hardware context for a device with an ELF object, configuration parameters, and access mode."""
...
def add_config(self, elf: elf) -> None:
"""Add an ELF configuration object to the hardware context."""
...
def get_device(self) -> device:
"""Get the device from which the hardware context was created."""
...
def get_xclbin_uuid(self) -> uuid:
"""Get the UUID of the xclbin associated with the hardware context."""
...
def get_xclbin(self) -> xclbin:
"""Get the xclbin associated with the hardware context."""
...
def get_mode(self) -> access_mode:
"""Get the access mode of the hardware context."""
...
class device:
"""Abstraction of an acceleration device."""
@overload
def __init__(self) -> None:
"""Create an empty device object."""
...
@overload
def __init__(self, index: SupportsInt) -> None:
"""Open a device by index.
Args:
index: Device index (0-based).
"""
...
@overload
def __init__(self, bdf: str) -> None:
"""Open a device by BDF string.
Args:
bdf: Device BDF (Bus:Device.Function) string.
"""
...
def register_xclbin(self, xclbin: xclbin) -> uuid:
"""Register an xclbin with the device.
Registration returns the xclbin UUID. Use hw_context to associate the
registered xclbin with hardware resources for kernel and BO creation.
Args:
xclbin: The xclbin object to register.
Returns:
UUID of the registered xclbin.
"""
...
@overload
def load_xclbin(self, xclbin_path: str) -> uuid:
"""Deprecated compatibility shim. Load an xclbin file and return its UUID.
Prefer hw_context(self, xclbin_path) for new code.
Args:
xclbin_path: Path to the xclbin file to load.
Returns:
UUID of the loaded xclbin.
"""
...
@overload
def load_xclbin(self, xclbin: xclbin) -> uuid:
"""Deprecated compatibility shim. Load an xclbin object and return its UUID.
Prefer hw_context(self, xclbin) for new code.
Args:
xclbin: The xclbin object to load.
Returns:
UUID of the loaded xclbin.
"""
...
def get_xclbin_uuid(self) -> uuid:
"""Return the UUID object representing the xclbin loaded on the device.
Returns:
UUID of the currently loaded xclbin.
"""
...
def get_info(self, key: xrt_info_device) -> str:
"""Obtain the device properties and sensor information.
Args:
key: The type of device information to retrieve.
Returns:
String representation of the requested device information.
"""
...
class run:
"""Represents one execution of a kernel."""
@overload
def __init__(self) -> None:
"""Create an empty run object."""
...
@overload
def __init__(self, kernel: kernel) -> None:
"""Create a run object from a kernel.
Args:
kernel: The kernel to create a run for.
"""
...
def start(self) -> None:
"""Start one execution of a run."""
...
@overload
def set_arg(self, index: SupportsInt, bo: bo) -> None:
"""Set a specific kernel global argument for a run.
Args:
index: Argument index.
bo: Buffer object argument.
"""
...
@overload
def set_arg(self, index: SupportsInt, value: SupportsInt) -> None:
"""Set a specific kernel scalar argument for this run.
Args:
index: Argument index.
value: Integer scalar argument.
"""
...
@overload
def wait(self) -> ert_cmd_state:
"""Wait for the run to complete.
Returns:
Final execution state.
"""
...
@overload
def wait(self, timeout_ms: SupportsInt) -> ert_cmd_state:
"""Wait for the specified milliseconds for the run to complete.
Args:
timeout_ms: Timeout in milliseconds.
Returns:
Execution state when wait completes or times out.
"""
...
@overload
def wait2(self) -> None:
"""Wait for the run to complete."""
...
@overload
def wait2(self, timeout: int) -> ert_cmd_state:
"""Wait for the specified milliseconds for the run to complete.
Args:
timeout: Timeout in milliseconds.
Returns:
Execution state when wait completes or times out.
"""
...
def state(self) -> ert_cmd_state:
"""Check the current state of a run object.
Returns:
Current execution state.
"""
...
def add_callback(
self,
state: ert_cmd_state,
callback: Callable[[Any, ert_cmd_state, Any], None],
data: Any
) -> None:
"""Add a callback function for run state.
Args:
state: The state to trigger the callback on.
callback: The callback function.
data: User data to pass to the callback.
"""
...
class kernel:
"""Represents a set of instances matching a specified name."""
class cu_access_mode(IntEnum):
"""Compute unit access mode."""
exclusive: kernel.cu_access_mode
shared: kernel.cu_access_mode
none: kernel.cu_access_mode
# Class-level enum value aliases
exclusive: cu_access_mode
shared: cu_access_mode
none: cu_access_mode
@overload
def __init__(
self,
device: device,
uuid: uuid,
name: str,
mode: cu_access_mode
) -> None:
"""Create a kernel with specified access mode.
Args:
device: The device to create the kernel on.
uuid: UUID of the xclbin containing the kernel.
name: Name of the kernel.
mode: Access mode for compute units.
"""
...
@overload
def __init__(self, device: device, uuid: uuid, name: str) -> None:
"""Create a kernel with default access mode.
Args:
device: The device to create the kernel on.
uuid: UUID of the xclbin containing the kernel.
name: Name of the kernel.
"""
...
@overload
def __init__(self, ctx: hw_context, name: str) -> None:
"""Create a kernel from a hardware context.
Args:
ctx: The hardware context.
name: Name of the kernel.
"""
...
def __call__(self, *args: Union[bo, int]) -> run:
"""Execute the kernel with the given arguments.
Args:
*args: Kernel arguments (buffer objects or integers).
Returns:
A run object representing the kernel execution.
"""
...
def group_id(self, index: SupportsInt) -> int:
"""Get the memory bank group id of a kernel argument.
Args:
index: Argument index.
Returns:
Memory bank group ID.
"""
...
class bo:
"""Represents a buffer object."""
class flags(IntEnum):
"""Buffer object creation flags."""
normal: bo.flags
cacheable: bo.flags
device_only: bo.flags
host_only: bo.flags
p2p: bo.flags
svm: bo.flags
# Class-level enum value aliases
normal: flags
cacheable: flags
device_only: flags
host_only: flags
p2p: flags
svm: flags
@overload
def __init__(
self,
device: device,
size: SupportsInt,
flags: flags,
group: SupportsInt
) -> None:
"""Create a buffer object with specified properties.
Args:
device: The device to allocate the buffer on.
size: Size of the buffer in bytes.
flags: Buffer creation flags.
group: Memory bank group ID.
"""
...
@overload
def __init__(
self,
ctx: hw_context,
size: SupportsInt,
flags: flags,
group: SupportsInt
) -> None:
"""Create a buffer object with specified properties in a hardware context.
Args:
ctx: The hardware context to allocate the buffer in.
size: Size of the buffer in bytes.
flags: Buffer creation flags.
group: Memory bank group ID.
"""
...
@overload
def __init__(self, ctx: hw_context, size: SupportsInt, group: SupportsInt) -> None:
"""Create a buffer object with default flags in a hardware context.
Args:
ctx: The hardware context to allocate the buffer in.
size: Size of the buffer in bytes.
group: Memory bank group ID.
"""
...
@overload
def __init__(self, parent: bo, size: SupportsInt, offset: SupportsInt) -> None:
"""Create a sub-buffer of an existing buffer object.
Args:
parent: Parent buffer object.
size: Size of the sub-buffer in bytes.
offset: Offset in the parent buffer.
"""
...
def write(self, data: ReadableBuffer, seek: SupportsInt) -> None:
"""Write the provided data into the buffer object.
Args:
data: Data to write (any buffer protocol object: bytes, bytearray, memoryview, numpy array, etc.).
seek: Offset in the buffer to start writing at.
"""
...
def read(self, size: SupportsInt, skip: SupportsInt) -> NDArrayInt8:
"""Read from the buffer object.
Args:
size: Number of bytes to read.
skip: Offset in the buffer to start reading from.
Returns:
NumPy array containing the read data.
"""
...
@overload
def sync(self, direction: xclBOSyncDirection, size: SupportsInt, offset: SupportsInt) -> None:
"""Synchronize (DMA or cache flush/invalidation) the buffer.
Args:
direction: Direction of synchronization.
size: Number of bytes to sync.
offset: Offset in the buffer.
"""
...
@overload
def sync(self, direction: xclBOSyncDirection) -> None:
"""Sync entire buffer content in specified direction.
Args:
direction: Direction of synchronization.
"""
...
def map(self) -> memoryview:
"""Create a byte accessible memory view of the buffer object.
Returns:
Memory view of the buffer.
"""
...
def size(self) -> int:
"""Return the size of the buffer object.
Returns:
Size in bytes.
"""
...
def address(self) -> int:
"""Return the device physical address of the buffer object.
Returns:
Physical device address.
"""
...
class xclbin:
"""Represents an xclbin and provides APIs to access meta data."""
class xclbinip:
"""Represents an IP in an xclbin."""
def __init__(self) -> None:
"""Create an empty xclbinip object."""
...
def get_name(self) -> str:
"""Get the IP name.
Returns:
Name of the IP.
"""
...
class xclbinkernel:
"""Represents a kernel in an xclbin."""
def __init__(self) -> None:
"""Create an empty xclbinkernel object."""
...
def get_name(self) -> str:
"""Get kernel name.
Returns:
Name of the kernel.
"""
...
def get_num_args(self) -> int:
"""Number of arguments.
Returns:
Number of kernel arguments.
"""
...
class xclbinmem:
"""Represents a physical device memory bank."""
def __init__(self) -> None:
"""Create an empty xclbinmem object."""
...
def get_tag(self) -> str:
"""Get tag name.
Returns:
Tag name of the memory bank.
"""
...
def get_base_address(self) -> int:
"""Get the base address of the memory bank.
Returns:
Base address.
"""
...
def get_size_kb(self) -> int:
"""Get the size of the memory in KB.
Returns:
Size in kilobytes.
"""
...
def get_used(self) -> bool:
"""Get used status of the memory.
Returns:
True if the memory bank is used.
"""
...
def get_index(self) -> int:
"""Get the index of the memory.
Returns:
Memory bank index.
"""
...
@overload
def __init__(self) -> None:
"""Create an empty xclbin object."""
...
@overload
def __init__(self, filename: str) -> None:
"""Create an xclbin object from a file.
Args:
filename: Path to the xclbin file.
"""
...
@overload
def __init__(self, axlf_data: Any) -> None:
"""Create an xclbin object from axlf data.
Args:
axlf_data: Pointer to axlf data structure.
"""
...
def get_kernels(self) -> List[xclbinkernel]:
"""Get list of kernels from xclbin.
Returns:
List of kernel objects.
"""
...
def get_xsa_name(self) -> str:
"""Get Xilinx Support Archive (XSA) name of xclbin.
Returns:
XSA name string.
"""
...
def get_uuid(self) -> uuid:
"""Get the uuid of the xclbin.
Returns:
UUID object.
"""
...
def get_mems(self) -> List[xclbinmem]:
"""Get list of memory objects.
Returns:
List of memory bank objects.
"""
...
def get_axlf(self) -> Any:
"""Get the axlf data of the xclbin.
Returns:
Pointer to axlf data structure.
"""
...
class xclbinip_vector(Sequence[xclbin.xclbinip]):
"""Vector of xclbin IP objects."""
def __init__(self) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> xclbin.xclbinip: ... # type: ignore[override]
def __setitem__(self, index: int, value: xclbin.xclbinip) -> None: ...
def __delitem__(self, index: int) -> None: ...
def __iter__(self) -> Iterator[xclbin.xclbinip]: ...
def __bool__(self) -> bool: ...
def append(self, value: xclbin.xclbinip) -> None: ...
def clear(self) -> None: ...
def extend(self, values: Sequence[xclbin.xclbinip]) -> None: ...
def insert(self, index: int, value: xclbin.xclbinip) -> None: ...
def pop(self, index: int = -1) -> xclbin.xclbinip: ...
class xclbinkernel_vector(Sequence[xclbin.xclbinkernel]):
"""Vector of xclbin kernel objects."""
def __init__(self) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> xclbin.xclbinkernel: ... # type: ignore[override]
def __setitem__(self, index: int, value: xclbin.xclbinkernel) -> None: ...
def __delitem__(self, index: int) -> None: ...
def __iter__(self) -> Iterator[xclbin.xclbinkernel]: ...
def __bool__(self) -> bool: ...
def append(self, value: xclbin.xclbinkernel) -> None: ...
def clear(self) -> None: ...
def extend(self, values: Sequence[xclbin.xclbinkernel]) -> None: ...
def insert(self, index: int, value: xclbin.xclbinkernel) -> None: ...
def pop(self, index: int = -1) -> xclbin.xclbinkernel: ...
class xclbinmem_vector(Sequence[xclbin.xclbinmem]):
"""Vector of xclbin memory objects."""
def __init__(self) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> xclbin.xclbinmem: ... # type: ignore[override]
def __setitem__(self, index: int, value: xclbin.xclbinmem) -> None: ...
def __delitem__(self, index: int) -> None: ...
def __iter__(self) -> Iterator[xclbin.xclbinmem]: ...
def __bool__(self) -> bool: ...
def append(self, value: xclbin.xclbinmem) -> None: ...
def clear(self) -> None: ...
def extend(self, values: Sequence[xclbin.xclbinmem]) -> None: ...
def insert(self, index: int, value: xclbin.xclbinmem) -> None: ...
def pop(self, index: int = -1) -> xclbin.xclbinmem: ...
class elf:
"""ELF representation of compiled AIE binary."""
@overload
def __init__(self, filename: str) -> None:
"""Create an ELF object from a file.
Args:
filename: Path to the ELF file.
"""
...
@overload
def __init__(self, data: Any, size: SupportsInt) -> None:
"""Create an ELF object from memory.
Args:
data: Pointer to ELF data in memory.
size: Size of the ELF data.
"""
...
class program:
"""Represents a compiled program to be executed on the AIE.
The program is an ELF file with sections and data specific to the AIE.
"""
def __init__(self, elf: elf) -> None:
"""Create a program from an ELF object.
Args:
elf: The ELF object containing the program.
"""
...
def get_partition_size(self) -> int:
"""Required partition size to run the program.
Returns:
Required partition size.
"""
...
class module:
"""Executable hardware module created from an ELF image."""
def __init__(self, elf: elf) -> None:
"""Create a module from an ELF object.
Args:
elf: The ELF object containing the module.
"""
...
def get_hw_context(self) -> hw_context:
"""Get the hardware context associated with the module.
Returns:
Hardware context associated with the module.
"""
...
class runlist:
"""Ordered collection of runs executed as a unit."""
@overload
def __init__(self) -> None:
"""Create an empty runlist."""
...
@overload
def __init__(self, hwctx: hw_context) -> None:
"""Create a runlist with a hardware context.
Args:
hwctx: Hardware context for the runlist.
"""
...
def add(self, run: run) -> None:
"""Add a run to the runlist.
Args:
run: Run object to add.
"""
...