XRT Python Bindings

Pybind11 module for XRT

class pyxrt.bo

Represents a buffer object

address(self: pyxrt.bo) → int

Return the device physical address of the buffer object

class flags

Buffer object creation flags

Members:

normal

cacheable

device_only

host_only

p2p

svm

property name
map(self: pyxrt.bo) → memoryview

Create a byte accessible memory view of the buffer object

read(self: pyxrt.bo, arg0: int, arg1: int) → numpy.ndarray[numpy.int8]

Read from the buffer object requested number of bytes starting from specified offset

size(self: pyxrt.bo) → int

Return the size of the buffer object

sync(*args, **kwargs)

Overloaded function.

  1. sync(self: pyxrt.bo, arg0: pyxrt.xclBOSyncDirection, arg1: int, arg2: int) -> None

Synchronize (DMA or cache flush/invalidation) the buffer in the requested direction

  1. sync(self: pyxrt.bo, arg0: pyxrt.xclBOSyncDirection) -> None

Sync entire buffer content in specified direction.

write(self: pyxrt.bo, arg0: Buffer, arg1: int) → None

Write the provided data into the buffer object starting at specified offset

class pyxrt.device

Abstraction of an acceleration device

get_info(self: pyxrt.device, arg0: pyxrt.xrt_info_device) → str

Obtain the device properties and sensor information

get_xclbin_uuid(self: pyxrt.device) → pyxrt.uuid

Return the UUID of the xclbin currently associated with the device.

load_xclbin(*args, **kwargs)

Overloaded function.

  1. load_xclbin(self: pyxrt.device, xclbin_path: str) -> pyxrt.uuid

Deprecated compatibility shim. Load an xclbin and return its UUID; use hw_context(device, xclbin_path) for new code

  1. load_xclbin(self: pyxrt.device, xclbin: xrt::xclbin) -> pyxrt.uuid

Deprecated compatibility shim. Load an xclbin and return its UUID; use hw_context(device, xclbin) for new code

register_xclbin(self: pyxrt.device, xclbin: xrt::xclbin) → pyxrt.uuid

Register an xclbin with the device. Registration alone does not create a hardware context.

class pyxrt.elf

ELF representation of compiled AIE binary

pyxrt.enumerate_devices() → int

Enumerate devices in system

class pyxrt.ert_cmd_state

Kernel execution status

Members:

ERT_CMD_STATE_NEW

ERT_CMD_STATE_QUEUED

ERT_CMD_STATE_COMPLETED

ERT_CMD_STATE_ERROR

ERT_CMD_STATE_ABORT

ERT_CMD_STATE_SUBMITTED

ERT_CMD_STATE_TIMEOUT

ERT_CMD_STATE_NORESPONSE

ERT_CMD_STATE_SKERROR

ERT_CMD_STATE_SKCRASHED

property name
class pyxrt.hw_context

Hardware context for associating an xclbin or ELF configuration with device resources.

class access_mode

Hardware context access mode

Members:

exclusive

shared

property name
add_config(self: pyxrt.hw_context, elf: xrt::elf) → None

Add an ELF configuration object to the hardware context.

get_device(self: pyxrt.hw_context) → xrt::device

Get the device from which the hardware context was created.

get_mode(self: pyxrt.hw_context) → pyxrt.hw_context.access_mode

Get the access mode of the hardware context.

get_xclbin(self: pyxrt.hw_context) → xrt::xclbin

Get the xclbin associated with the hardware context.

get_xclbin_uuid(self: pyxrt.hw_context) → pyxrt.uuid

Get the UUID of the xclbin associated with the hardware context.

class pyxrt.kernel

Represents a set of instances matching a specified name

class cu_access_mode

Compute unit access mode

Members:

exclusive

shared

none

property name
group_id(self: pyxrt.kernel, arg0: int) → int

Get the memory-group identifier for a kernel argument.

pyxrt.log_message(arg0: pyxrt.xrt_msg_level, arg1: str, arg2: str) → None

Dispatch formatted log message

class pyxrt.module

Executable hardware module created from an ELF image.

get_hw_context(self: pyxrt.module) → pyxrt.hw_context

Get the hardware context associated with the module.

class pyxrt.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.

get_partition_size(self: pyxrt.program) → int

Required partition size to run the program

class pyxrt.run

Represents one execution of a kernel

add_callback(self: pyxrt.run, arg0: pyxrt.ert_cmd_state, arg1: std::function<void (void const*, ert_cmd_state, void*)>, arg2: capsule) → None

Register a callback to be invoked when the run reaches the requested state.

get_ctrl_scratchpad_bo(self: pyxrt.run) → xrt::bo

Get the control scratchpad buffer object associated with this run

set_arg(*args, **kwargs)

Overloaded function.

  1. set_arg(self: pyxrt.run, arg0: int, arg1: xrt::bo) -> None

Set a specific kernel global argument for a run

  1. set_arg(self: pyxrt.run, arg0: int, arg1: int) -> None

Set a specific kernel scalar argument for this run

start(self: pyxrt.run) → None

Start one execution of a run

state(self: pyxrt.run) → pyxrt.ert_cmd_state

Return the current execution state of the run.

wait(*args, **kwargs)

Overloaded function.

  1. wait(self: pyxrt.run) -> pyxrt.ert_cmd_state

Wait for the run to complete

  1. wait(self: pyxrt.run, arg0: int) -> pyxrt.ert_cmd_state

Wait for the specified milliseconds for the run to complete

wait2(*args, **kwargs)

Overloaded function.

  1. wait2(self: pyxrt.run) -> None

Wait for the run to complete

  1. wait2(self: pyxrt.run, arg0: std::chrono::duration<long, std::ratio<1l, 1000l> >) -> std::cv_status

Wait for the specified milliseconds for the run to complete

class pyxrt.runlist

Ordered collection of runs executed as a unit.

add(self: pyxrt.runlist, run: pyxrt.run) → None

Add a run to the runlist

execute(self: pyxrt.runlist) → None

Execute all runs in the runlist

wait(*args, **kwargs)

Overloaded function.

  1. wait(self: pyxrt.runlist) -> None

Wait for all runs in the runlist to complete

  1. wait(self: pyxrt.runlist, timeout: std::chrono::duration<long, std::ratio<1l, 1000l> >) -> std::cv_status

Wait for the specified timeout for the runlist to complete

class pyxrt.uuid

XRT UUID object to identify a compiled xclbin binary

to_string(self: pyxrt.uuid) → str

Convert XRT UUID object to string

class pyxrt.xclBOSyncDirection

DMA flags used with DMA API

Members:

XCL_BO_SYNC_BO_TO_DEVICE

XCL_BO_SYNC_BO_FROM_DEVICE

XCL_BO_SYNC_BO_GMIO_TO_AIE

XCL_BO_SYNC_BO_AIE_TO_GMIO

property name
class pyxrt.xclbin

Represents an xclbin and provides APIs to access meta data

get_axlf(self: pyxrt.xclbin) → axlf

Get the axlf data of the xclbin

get_kernels(self: pyxrt.xclbin) → list[pyxrt.xclbin.xclbinkernel]

Get list of kernels from xclbin

get_mems(self: pyxrt.xclbin) → list[pyxrt.xclbin.xclbinmem]

Get list of memory objects

get_uuid(self: pyxrt.xclbin) → pyxrt.uuid

Get the uuid of the xclbin

get_xsa_name(self: pyxrt.xclbin) → str

Get Xilinx Support Archive (XSA) name of xclbin

class xclbinkernel

Represents a kernel in an xclbin

get_name(self: pyxrt.xclbin.xclbinkernel) → str

Get kernel name

get_num_args(self: pyxrt.xclbin.xclbinkernel) → int

Number of arguments

class xclbinmem

Represents a physical device memory bank

get_base_address(self: pyxrt.xclbin.xclbinmem) → int

Get the base address of the memory bank

get_index(self: pyxrt.xclbin.xclbinmem) → int

Get the index of the memory

get_size_kb(self: pyxrt.xclbin.xclbinmem) → int

Get the size of the memory in KB

get_tag(self: pyxrt.xclbin.xclbinmem) → str

Get tag name

get_used(self: pyxrt.xclbin.xclbinmem) → bool

Get used status of the memory

class pyxrt.xrt_info_device

Device feature and sensor information

Members:

bdf

interface_uuid

kdma

max_clock_frequency_mhz

m2m

name

nodma

offline

electrical

thermal

mechanical

memory

platform

pcie_info

host

dynamic_regions

vmr

class pyxrt.xrt_msg_level

XRT log msgs level

Members:

emergency

alert

critical

error

warning

notice

info

debug

property name