sima_utils.transformer.devkit.utils
Attributes
Classes
A wrapper around the Mla_buffer defined in devkit apis with additional buffer properties. |
|
Model definition with buffers for ifms and ofms. |
Functions
|
|
Module Contents
- sima_utils.transformer.devkit.utils.VLM_EVAL_PRINT_INOUTS
- sima_utils.transformer.devkit.utils.VLM_EVAL_PROFILE
- sima_utils.transformer.devkit.utils.mla_rt_api: mla_rt_service.devkit_python_api.Mla_rt_apis | None = None
- sima_utils.transformer.devkit.utils.connect_mla_rt_api(lib_mla_rt_path: pathlib.Path | None)
- sima_utils.transformer.devkit.utils.disconnect_mla_rt_api()
- class sima_utils.transformer.devkit.utils.MLAGpio(lib_mla_rt_path: pathlib.Path)
- lib_mla_rt_path
- mla_poke_path
- mla_control_gpio(pin: int, value: int) None
- mla_read_reg(reg_addr: str) int
- mla_write_reg(reg_addr: str, value: str) None
- class sima_utils.transformer.devkit.utils.MLABuffer
A wrapper around the Mla_buffer defined in devkit apis with additional buffer properties.
- name: str
- shape: tuple[int, Ellipsis]
- dtype: str
- align_last_dim: bool = True
- mla_buffer: mla_rt_service.devkit_python_api.Mla_buffer | None = None
- property itemsize: int
Returns the size of the buffer item in bytes.
- property size: int
Returns the size of the buffer in bytes.
- allocate()
Creates and allocates the buffer.
- free()
Frees the buffer if it is allocated.
- upload(data: numpy.ndarray)
Uploads the data to the buffer.
- download(begin: tuple[int, Ellipsis] | None = None, shape: tuple[int, Ellipsis] | None = None) numpy.ndarray
Downloads the data from the buffer.
- get_buf_addr_len(begin: tuple[int, Ellipsis] | None = None, shape: tuple[int, Ellipsis] | None = None) mla_rt_service.devkit_python_api.DADDR_LEN
Creates a DADDR_LEN object for the slice of the buffer defined by begin and shape.
- class sima_utils.transformer.devkit.utils.MLAModel
Model definition with buffers for ifms and ofms.
- model_path: pathlib.Path
- ifm_buffer_addr_lens: list[mla_rt_service.devkit_python_api.DADDR_LEN | None] = []
- ofm_buffer_addr_lens: list[mla_rt_service.devkit_python_api.DADDR_LEN] = []
- unique_models: ClassVar[dict[pathlib.Path, Any | None]]
- load() Any
Loads the model and caches the model object so that the model is only loaded once.
- free()
Frees the model if it is loaded.
- run(update_ifm_addr_len_dict: dict[int, Any] | None = None) float
Loads and runs the model. Updates the ifm addr_len if needed. Returns the runtime of the model.
- classmethod load_all_models(do_parallel_load: bool = False, elf_dir: pathlib.Path | None = None)