Skip to content

Python Types API

Enumerations

Type Members
HaMemCpyDirection HostToDevice, DeviceToHost, DeviceToDevice
HaDeviceVersion BERTHA_CLOUD_EVT0, BERTHA_CLOUD_EVT1, BERTHA_EDGE_EVT0 — device chip generation
HaDeviceAttr PCI_DOMAIN, PCI_BUS, PCI_SLOT, PCI_FUNC, PEER_PRESENT_MASK, PEER_MAPPED_MASK, DRAM_CHANNELS, DRAM_CHANNEL_STRIDE, VERSION — device attributes read with get_device_attribute() (VERSION is a HaDeviceVersion value)
HaMemScope HOST, DEVICE — address space a HaLayout refers to
HaDataType Element types for layouts and launch arguments (BYTES, INT8–INT64, UINT8–UINT64, FLOAT16, FLOAT32, BFLOAT16, FLOAT8, FLOAT4, FLOAT64)
HaTensorKind KV_CACHE_KEY, KV_CACHE_VALUE, SINGLE_CHANNEL, ROW_INTERLEAVED, MAX_ROWS_INTERLEAVED, DRAM_WORD_INTERLEAVED, MPU_TENSOR, MPU_TENSOR_TRANSPOSED, SINGLE_PASS_INTERLEAVED
PageType KEY, VALUE
ValuePageMode CONTIGUOUS, STRIDE
HaLaunchArgRoute UNIVERSAL, TOP, CORE — argument block that a Legato kernel argument is written to

Structs

Type Fields
HaShape w, h, c. Constructed as HaShape(w, h, c)
HaLayout Read-only properties shape, strides, dtype, scope, ndim. Constructed as HaLayout(shape, strides=[], scope=HaMemScope.HOST, dtype=HaDataType.BYTES); an empty strides means row-major contiguous. Strides are in elements, not bytes
TLBInitInfo page_size, base_addr, layer_num, head_num, max_page_num, value_page_mode, value_stride, value_line_page_num, log_value_stride
TLBAllocInfo / TLBDeallocInfo req_id, page_num, page_type
TLBSharedAllocInfo / TLBSharedDeallocInfo shared_id, page_num, page_type
TLBReqToSharedInfo req_id, shared_id, page_num, page_type
TLBSharedToReqInfo shared_id, req_id, page_type
HaLaunchArgs Kernel launch argument list. See Execution API

PageType, ValuePageMode and the TLB*Info structs are not re-exported by the hart package, so import them from hart.hart (e.g. from hart.hart import PageType, TLBAllocInfo). Their constructors take every field, positionally or by keyword, with no defaults.


See also