Hailort 4.18.0 User Guide
Hailort 4.18.0 User Guide
Release 4.18.0
8 July 2024
Table of Contents
I User Guide 2
1 HailoRT Overview 3
1.1 Included in this Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 HailoRT Library (C/C++ API) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 HailoRT Python API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 HailoRT CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 PCIe Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Yocto Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Hailo Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.8 Hailo GStreamer Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Changelog 5
3 Installation 12
3.1 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Installation on Ubuntu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 Installation on Yocto-based Linux Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.4 Compiling from Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.5 Validating that the PCIe Driver was Successfully Installed on Linux . . . . . . . . . . . . . . . . . . . 19
3.6 Linux Installation Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.7 Installation on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5 Tutorials 24
5.1 C inference tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2 C++ inference tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.3 Python inference tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.4 Python power measurement tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.5 Python Inference Tutorial - Multi Process Service and Model Scheduler . . . . . . . . . . . . . . . . . 61
5.6 Python inference tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.7 Python Async Inference Tutorial - Multiple Models with Model Scheduler . . . . . . . . . . . . . . . . 64
6 Running Inference 67
6.1 Inference Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2 Python Inference API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.3 C/C++ Inference API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.4 Asynchronous Inference API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.5 Device virtualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.6 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.7 Model Scheduler and Compiling Models Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.8 Model Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.9 Model Scheduler Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.10 Stream Multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.11 Multi-Process Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Page i Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
8 PCIe Driver 85
8.1 Manual Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
8.2 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
9 SoC Features 87
9.1 Temperature Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.2 User Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.3 Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
10 Yocto 91
10.1 The Meta-Hailo Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.2 Recipes in Meta-Hailo-Libhailort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.3 Recipes in Meta-Hailo-Accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.4 Recipes in Meta-Hailo-Vpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.5 Integrating with an Existing Yocto Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
10.6 Validating the Integration’s Success . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
10.7 Offline Builds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
II API Reference 98
Page ii Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Page iii Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Copyright
No part of this document may be reproduced or transmitted in any form without the expressed, written permission
of Hailo. Nothing contained in this document should be construed as granting any license or right to use proprietary
information for that matter, without the written permission of Hailo.
General Notice
Hailo, to the fullest extent permitted by law, provides this document “as-is” and disclaims all warranties, either ex-
press or implied, statutory or otherwise, including but not limited to the implied warranties of merchantability, non-
infringement of third parties’ rights, and fitness for particular purpose.
Although Hailo used reasonable efforts to ensure the accuracy of the content of this document, it is possible that
this document may contain technical inaccuracies or other errors. Hailo assumes no liability for any error in this
document, and for damages, whether direct, indirect, incidental, consequential or otherwise, that may result from
such error, including, but not limited to loss of data or profits.
The content in this document is subject to change without prior notice and Hailo reserves the right to make changes
to content of this document without providing a notification to its users.
Page 1 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
Part I
User Guide
Page 2 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
1. HailoRT Overview
Hailo SW products are set of frameworks and tools that enable you to compile, run and evaluate neural networks on
Hailo devices. HailoRT is part of Hailo’s runtime environment:
Integration pyHailoRT
CLI
Tool (Python API)
Hailo Dataflow Compiler (SDK)
C/C++ API and Library
Python API CLI tools
Hailo Driver
Model Parser OS IP Stack
Model Optimizer
Ethernet PCIe Integrated
Resource Allocator Profiler
Emulator
NN Core
Compiler
(part of Hailo Vision Processor or AI Accelerator)
In preview
• HailoRT CLI
• PCIe driver
• Yocto layer
• Hailo Firmware
Page 3 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The HailoRT library is a user-space run time library responsible for operating the Hailo device. It allows both to control
the Hailo device and to transfer data to and from it. The HailoRT library implements robust and intuitive API’s in C/C++
for optimized performance using the Hailo device.
The HailoRT Python package wraps the library and exposes a Python interface that allows the loading of models to
the device and to send and receive data from it.
HailoRT CLI is the command line application used to control Hailo devices, use the devices for running inference as
well as collecting inference statistics and device events, etc
The Hailo’s PCIe driver is required when working via the PCIe interface, it links the HailoRT library and the device. It
also loads the device’s firmware when working through this interface. The device driver is used to manage the Hailo
device, communicate with the device and transfer data to and from the device.
Hailo’s Yocto layer allows the user to integrate Hailo’s software into an existing Yocto environment. It includes recipes
for the HailoRT library, Python package and the PCIe driver.
The firmware that runs on the Hailo device. It manages the boot and the control of the Hailo device.
The Hailo’s GStreamer plugin provides the “hailonet” element which can infer GStreamer frames according to the
configured network. This element can be used multiple times in a GStreamer pipeline to infer multiple networks in
parallel.
Page 4 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
2. Changelog
HailoRT v4.18.0 (July 2024)
Hailo-10H
Async API
• The Asynchronous Inference API (Async API), which was released in version 4.17.0, is the new and recom-
mended approach for running inference on Hailo devices. For additional documentation and tutorials -
we added an Asynchronous Inference API section
• Added a new HailoRT profiler visualization tool, which creates an html report for the HailoRT Model Sched-
uler behavior
– InferModel()
– ConfiguredInferModel()
– AsyncInferJob()
– AsyncInferCompletionInfo()
• Added new method in class VDevice() - create_infer_model()
Note: When running multiple processes, multi-process service must be enabled before creating any VDevice
object, and the VDevice parameters must be set correctly (see Python multi process inference tutorial).
Logger
• The user can now control the console HailoRT log level (HailoRT messages to the console) by setting the
environment variable HAILORT_CONSOLE_LOGGER_LEVEL to one of the following values: info,
warning, error, critical (from verbose to minimal). The default value is warning
API
Note: From now, the HEF file (or HEF buffer) must be maintained until the completion of the configuration
phase
Page 5 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– This flag can only be enabled when Model Scheduler is also enabled
– In case the Python application uses multiple processes for multiple models - this flag needs to be
enabled
– Updated Python multi-process inference tutorial to reflect this added member and usage
– It is possible to use the Python API with Model Scheduler without Multi-Process service - it requires the
application to use all models in the same process
Note: Existing Python applications behavior might change when enabling this flag - make sure it is
enabled for the scenarios mentioned above
Hailo-15
• Fixed a sequencer issue for Hailo-15, for modules before preliminary ASAP
Async API
• Updated HailoNet to use Async API by default (no API changes needed)
• Updated and added new tutorials - basic Async inference and advanced Async inference
• Added the forcewritable property in HailoNet to handle the case of a read-only buffer
• Fixed a bug in Yolov8 post-processing, which occurs when padded-shape is not equal to shape
CLI
Page 6 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– full mode is replaced by full_sync and will keep being the default run mode
– raw is replaced by raw_sync
• Added new API for pre-mapping buffers, used with async API (which improves performance when the
same buffer is used multiple times):
– C++ API
* hailort::DmaMappedBuffer
* hailort::VDevice::dma_map()
* hailort::VDevice::dma_unmap()
* hailort::Device::dma_map()
* hailort::Device::dma_unmap()
– C API
* hailo_vdevice_dma_map_buffer()
* hailo_vdevice_dma_unmap_buffer()
* hailo_device_dma_map_buffer()
* hailo_device_dma_unmap_buffer()
API
• Removed HAILO_STREAM_INTERNAL_ABORT
• Removed HAILO_STREAM_ABORTED_BY_HW
Hailo-15
Multi-Process Service
Hailo-15
Async API
• Added Zero Copy optimization (when using Async API) which improves memory consumption for certain
input formats
Multi-Process Service
Page 7 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• Fixed various stabilization issues - the service now supports wider and more various scenarios
API
• Changed the argument quantized in vStream parameters creation to bool unused - and its usage
will be ignored. Affected functions:
– C API
* hailo_hef_make_input_vstream_params()
* hailo_hef_make_output_vstream_params()
* hailo_make_input_vstream_params()
* hailo_make_output_vstream_params()
– C++ API
* hailort::Hef::make_input_vstream_params()
* hailort::Hef::make_output_vstream_params()
* hailort::ConfiguredNetworkGroup::make_input_vstream_params()
* hailort::ConfiguredNetworkGroup::make_output_vstream_params()
* hailort::ConfiguredNetworkGroup::make_output_vstream_params_groups()
* hailort::InputTransformContext::create()
* hailort::OutputTransformContext::create()
– PyHailoRT
* make()
* make_from_network_group()
* make()
* make_from_network_group()
* make_groups()
– HailoNet - inputquantized, outputquantized are removed
– C API
* hailo_set_scheduler_timeout()
* hailo_set_scheduler_threshold()
* hailo_set_scheduler_priority()
– C++ API
* hailort::ConfiguredNetworkGroup::set_scheduler_timeout()
* hailort::ConfiguredNetworkGroup::set_scheduler_threshold()
* hailort::ConfiguredNetworkGroup::set_scheduler_priority()
– PyHailoRT
* set_scheduler_timeout()
* set_scheduler_threshold()
* set_scheduler_priority()
• Added shutdown function for configured network group:
Page 8 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– C API
* hailo_shutdown_network_group()
– C++ API
* hailort::ConfiguredNetworkGroup::shutdown()
CLI
• Monitor:
– Updated Frames Queue metric, now it will include the average, maximum and minimum number
of frames for each of the queues (in a 1-second window)
Windows
• Added a PowerShell example for working with Multi-Process service and PyHailoRT
Note: In case of restricted execution policy, either run the script with
API
• Data quantization (or de-quantization) is determined by the input and output data types:
– Deprecation of the argument quantized in vstream-params creation - its usage will be ignored
Note: QP will be invalid in case HEF file was compiled with multiple QPs, and then the user will try to
work with API for a single QP.
– Deprecated functions:
* C API
· hailo_hef_make_input_vstream_params()
· hailo_hef_make_output_vstream_params()
· hailo_make_input_vstream_params()
· hailo_make_output_vstream_params()
* C++ API
· hailort::Hef::make_input_vstream_params()
· hailort::Hef::make_output_vstream_params(),
Page 9 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
· hailort::ConfiguredNetworkGroup::make_input_vstream_params()
· hailort::ConfiguredNetworkGroup::make_output_vstream_params()
· hailort::ConfiguredNetworkGroup::make_output_vstream_params_groups()
· hailort::InputTransformContext::create()
· hailort::OutputTransformContext::create()
* PyHailoRT
· make()
· make_from_network_group()
· make()
· make_from_network_group()
· make_groups()
• Removed support for format type hailo_format_type_t::
HAILO_FORMAT_TYPE_UINT16 on NMS outputs
– hailo_format_type_t::HAILO_FORMAT_TYPE_AUTO will be translated
as hailo_format_type_t::HAILO_FORMAT_TYPE_FLOAT32 instead of
hailo_format_type_t::HAILO_FORMAT_TYPE_UINT16
• Updated API to prepare support for scaling by feature (currently not yet supported in Dataflow Compiler):
– C++ API
· hailort::InputTransformContext::is_transformation_required()
· hailort::OutputTransformContext::create() and hailort::
OutputTransformContext::is_transformation_required()
The overloads of these functions, which receive a single hailo_quant_info_t as a
parameter, are deprecated. Instead, new overloads of these functions receive a vector of
hailo_quant_info_t
· hailort::OutputStream::get_quant_infos()
· hailort::InputVStream::get_quant_infos()
· hailort::OutputVStream::get_quant_infos()
– C API
* Deprecated:
· hailo_is_input_transformation_required()
· hailo_is_output_transformation_required()
· hailo_is_output_transformation_required2()
Page 10 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
· hailo_get_input_stream_quant_infos()
· hailo_get_input_vstream_quant_infos()
· hailo_get_output_stream_quant_infos()
· hailo_get_output_vstream_quant_infos()
· hailo_create_output_transform_context_by_stream()
· hailo_create_input_transform_context_by_stream()
• Added support for NMS dynamic configuration when the model is compiled to run NMS on host CPU:
– C API
* hailo_vstream_set_nms_score_threshold()
* hailo_vstream_set_nms_iou_threshold()
* hailo_vstream_set_nms_max_proposals_per_class()
– C++ API
* hailort::OutputVStream::set_nms_score_threshold()
* hailort::OutputVStream::set_nms_iou_threshold()
* hailort::OutputVStream::set_nms_max_proposals_per_class()
* hailort::InferVStreams::set_nms_score_threshold()
* hailort::InferVStreams::set_nms_iou_threshold()
* hailort::InferVStreams::set_nms_max_proposals_per_class()
– PyHailoRT
* set_nms_score_threshold()
* set_nms_iou_threshold()
* set_nms_max_proposals_per_class()
* set_nms_score_threshold()
* set_nms_iou_threshold()
* set_nms_max_proposals_per_class()
Page 11 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
3. Installation
This chapter presents the system requirements and installation instructions per operating system/distribution.
if system requirements are met, Hailo provides several possible ways to install HailoRT, depends on the operating
system:
• Installing on Ubuntu
• Installing on Windows
For the installation of HailoRT, the following minimum system requirements are necessary:
• Linux or Windows
– PCIe interface or Gigabit Ethernet (802.3) interface for the evaluation board, see Hailo-8 Evaluation board
– M.2 connector for the M.2 board, see Hailo-8 M.2 board
Page 12 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– mPCIe connector for the mPCIe board, see Hailo-8 mPCIe board
Note: Additional requirements may be needed depending on the installation method, see below.
Note: The PCIe driver has been tested on several Linux kernel versions, including 4.15.039generic, 5.
0.16050016generic, 5.4.062generic and 5.11.0040.
Note: The RAM requirement depends on the number of the network’s inputs and outputs, and on the data through-
put.
• As part of the Hailo Software Suite – Please refer to the suite installation instructions inside the Hailo Dataflow
Compiler User Guide.
• Using a Docker container (without the full suite) – Please refer to the Docker instructions.
• (Optional) bison, flex, libelf-dev and dkms packages (needed to register the PCIe driver using DKMS)
• (Optional) curl (needed to download the firmware when installing without the PCIe driver)
Page 13 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The HailoRT Ubuntu offers several files, select the files according to your requirements:
Note: PyHailoRT is optional and is needed for using the Python API
Download
Download the relevant files for your environment from our Developer Zone.
# .deb architecture
dpkg printarchitecture
Page 14 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: A prompt regarding using DKMS (Dynamic Kernel Module Support) is expected and it is recommended to
approve it.
Run the following command to install HailoRT including the PCIe driver:
This command will install HailoRT. It will also compile the PCIe driver for the machine’s kernel version and install the
driver. The command needs root permissions (sudo).
After boot, you can use the hailortcli tool and run hailortcli scan to validate that the device is identified:
hailortcli scan
Note: The PCIe driver is not signed. In some systems it means that secure boot has to be disabled to load the driver.
Users who wish to use secure boot while HailoRT PCIe driver is not signed, can use MOK (Machine-Owner Key), which
can be used for (locally) signing third-party drivers. Please notice this is an advanced feature and is recommended
for users who are familiar with the process of locally-signing drivers.
Run the following command to obtain the serial number from the device:
Page 15 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Run the following command to install HailoRT only (without the PCIe driver):
Run the following command to download the Ethernet firmware (only needed when loading the firmware is not via
the driver):
sudo rm /lib/firmware/hailo/hailo8_fw.bin
sudo curl https://hailohailort.s3.euwest2.amazonaws.com/Hailo8/<VERSION>/FW/
,→hailo8_fw.<VERSION>_eth.bin createdirs o /lib/firmware/hailo/hailo8_fw.bin
Note: If the Hailo device is connected via Ethernet, use the Ethernet command line tools.
Also, the Ethernet related shell scripts are useful to configure the Ethernet connection in the host’s side.
Run the following command to install PyHailoRT into a new virtual environment:
,→tag>.whl
For example, for installing PyHailoRT v4.17.0 to a Python-3.10 environment on a x86_64 platform, the command
would be:
Run the following command to install PyHailoRT into existing virtual environment:
Page 16 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
source hailo_platform_venv/bin/activate
pip uninstall hailort
See the PCIe driver page for details about compiling the PCIe driver from sources.
Using HailoRT with other Linux distributions is possible via source compilation. On Ubuntu, it is even sometimes
useful to compile from sources, for example in order to keep ABI integrity. HailoRT sources can be cloned from
GitHub using:
cmake S. Bbuild DCMAKE_BUILD_TYPE=Release && cmake build build config release
Note: By adding target install to the CMake command, HailoRT artifacts will be installed on the machine.
Linux:
cmake S. Bbuild DCMAKE_BUILD_TYPE=Release && sudo cmake build build config�
,→release target install
after installation (either by installer or CMake install) one can link with libhailort by using CMake’s
find_package(). See ‘hailort/libhailort/examples/CMakeLists.txt’ for reference.
Note: By adding DHAILO_BUILD_EXAMPLES=1 to the CMake command, examples targets will be added to
the project (useful for debug build of C++ examples, instead of linking them with pre-installed HailoRT).
Note: When building from sources, some additional tools must be installed. For example, gcc for arm or python
dev if building pyhailort.
Page 17 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
build/hailort/hailortcli/hailortcli
Note: To compile sources on Windows please see Windows compile from sources
Note: The wheel depends on libhailort. Make sure libhailort is installed before building the (.whl) file.
Note: To force a specific CMake generator, set the environment variable CMAKE_GENERATOR to the generator name:
e.g. CMAKE_GENERATOR=”Ninja Multi-Config”
Note: For cross-compilation, set the following environment variables to setup.py bdist_wheel:
“CMAKE_TOOLCHAIN_FILE” - path to the toolchain file (defines the compiler and linker for cross-compilation)
“HAILORT_INCLUDE_DIR” - path to the include directory of the HailoRT library “LIBHAILORT_PATH” - path to the
HailoRT library “PYTHON_INCLUDE_DIRS” - path to the Python include directory (e.g. /usr/include/python3.10.
Required for pybind linkage) “PYTHON_LIBRARY” - path to the Python lib to link with It is also important to pass to
bdist_wheel the argument platname - which indicates the target architecture (e.g. aarch64)
Compilation of hailort-gstreamer-binding:
Compilation of hailort-examples:
Page 18 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
3.5. Validating that the PCIe Driver was Successfully Installed on Linux
Make sure your device is connected to a PCIe/M.2/mPCIe slot. Run the following command:
If the second output is received, update the PCIe IDs file on your device by running:
sudo updatepciids
If the Hailo device does not appear in the result, please ensure the following:
• The PCIe driver installation did not output any error messages.
This section contains common possible issues that you may encounter after connecting Hailo-8 and installing the
driver and library.
The device should be listed in the terminal output, see driver validation
Possible solution Verify the module is properly attached and secured into the M.2 slot
Possible solution Verify the slot in use is a valid M.2 slot. Check to see if the slot is disabled in the platform BIOS
Page 19 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The firmware load process and events appear there - and if either the load process has ended with success or
failure
Possible solution If the firmware load has failed (during boot) - the reason may be specified in the log. Re-install the
driver, see driver installation only
hailortcli scan
• (Optional) CMake and Visual Studio Build Tools – in order to compile applications that use HailoRT
Page 20 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: It is recommended to remove old HailoRT versions before installing a new version.
3. Run the installer and follow the instructions. Check the pyHailoRT or multiprocess service
boxes if you wish to install these features.
5. After boot, you can use the hailortcli tool and run hailortcli scan to validate that the device is identified.
6. If pyHailoRT preview was checked, the Python wheel will be found in the directory C:\Program
Files\HailoRT\python. Refer to section Installation of pyHailoRT into a new environment to finish the
installation of pyHailoRT.
Note: The .whl cannot be installed (via pip) from the Program Files folder.
Note: Compilation of HailoRT from sources is recommended, for example, in order to keep ABI integrity. See clone
HailoRT and compile HailoRT. Notice that when compiling the HailoRT library from sources, the library will not be
signed.
cmake S. Bbuild A=x64 DCMAKE_BUILD_TYPE=Release && cmake build build config�
,→release target install
Compilation Notes:
• This section refers only to HailoRT library itself and not the PCIe driver. The PCIe driver should be installed
using the .msi installation file (can be downloaded from our Developer Zone).
• When compiling for Windows, add the define NOMINMAX to prevent collisions.
hailortcli.exe
Note: Windows Python API support is still in preview stage. Python applications are supported only through the
infer() API. See the Python API section and the InferVStreams API reference for more information.
Page 21 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
To install Docker:
• Install curl
• Install Docker
• Add your user (which has root privileges) to the Docker group
Note: Requirements - Docker package, either docker.io 20.10.07 (from Ubuntu repo), or docker-ce 20.10.6 (from
Docker website).
Using this method, the following intermediate steps are handled by the script:
Note: The directory from which you use the Docker should contain following Hailo files:
• hailo_docker_hailort_VERSION.tar
• run_hailort_docker.sh
The following step is required if the PC does not have a working hailo_pci driver installed, or its version is different
from the current one. Install the PCIe driver on the host. See how to download the pcie driver and how to install PCIe
driver
Note: PC restart is required after driver installation. After PC restart, one should be able to resume to existing
container or to create a new one and start working with Hailo device.
Page 22 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
In order to use HailoRT release Docker image, one should run the following script:
For example:
v /dev:/dev \
v /lib/firmware:/lib/firmware \
v /lib/udev/rules.d:/lib/udev/rules.d \
v /lib/modules:/lib/modules \
device=/dev/hailo0:/dev/hailo0 \
Note: When using several Hailo devices, define the additional devices accordingly. For example, for a 2nd device,
add:
device=/dev/hailo1:/dev/hailo1 \
Page 23 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
5. Tutorials
The tutorials below go through the inference steps in C, C++ and Python and are aimed to demonstrate HailoRT API
usage.
Hailo offers an additional set of Application Code Examples, which are more application-oriented.
Run the download script to download the HEFs used by the tutorials:
• Ubuntu
• Windows:
Double-click hailort\hailort\scripts\download_hefs.cmd
Note: If running only C and C++ tutorials, PyHailoRT installation can be skipped.
Note: Python tutorials require HailoRT and PyHailoRT to be installed, and the additional following packages:
1. jupyter
2. matplotlib
To install these packages, from the virtual environment PyHailoRT is installed into run:
In this section we will provide various examples of the HailoRT API. The code mentioned below is included in the
release under hailort/libhailort/examples/c in the github repository. In order to compile and run
the examples, one should copy the examples into a machine with installed hailort, or install hailort from the github
repository. See documentation.
All functions calls are based on the header provided in hailort/include/hailo/hailort.h. See the API
documentation for more details.
Note: Write permissions are required to compile the examples from their current directory. If this is not the case,
copy the examples directory to another location with the required permissions.
Page 24 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Compiling examples is done using the following commands from examples directory:
In order to compile a specific example, either add the example name as target with a c prefix, or run the cmake
command from the target example dir:
cd c/vstreams_example
cmake S. Bbuild DCMAKE_BUILD_TYPE=Release
cmake build build config release
Note: When copying an example to a different directory, make sure to copy the common directory as well.
Running examples:
Run the examples using the following command, from the examples directory:
build/c/<example_name>/c_<example_name> [params...]
Cross-Compile Tutorials
Add the following options while configuring the examples using CMake:
• DCMAKE_TOOLCHAIN_FILE=”<toolchain file>”
• DCMAKE_FIND_ROOT_PATH=”<target dir>”
• DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
See: hailort/libhailort/examples/c/vstreams_example.c
Summary
• Demonstrates basic inference of a shortcut network (i.e inputs are sent through the vdevice and right back out,
without any changes made to the data).
• The program uses the Hailo virtual device with default values for initialization.
• The data is sent to the vdevice via input vstreams and received via output vstreams.
• The data is transformed before sent and after receiving in a different thread using the virtual stream pipeline.
Page 25 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Code structure
Device initialization The first step is to initialize the vdevice, we initialize the hailo_vdevice_params_t
with default values, and then we create the VDevice. By creating the VDevice with a
hailo_vdevice_params_t with default values, the model scheduler is enabled (with its default
scheduling scheme - Round Robin). For that reason, we don’t need to activate/deactivate the network
groups in the user application, since when the scheduler is enabled, the activation and deactivation is done
automatically.
Creating vstreams First we need to initialize vstream params (both input and output), then we are ready to create
the vstreams.
Write to device The write thread, will firstly initialize a buffer used for send. Then the thread will send all frames in
a loop.
See: hailort/libhailort/examples/c/multi_device_example.c
Summary
• Creates a virtual device from all Hailo devices that are connected to the computer.
• The program infers HEFs with multiple virtual input streams and multiple virtual output streams.
• The program creates a thread for each virtual output stream and a thread for each virtual input stream.
Page 26 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Code structure
Device initialization First we scan for Hailo devices, then we initialize the hailo_vdevice_params_t with
the device count we scanned before. The next step is to create the VDevice.
Configuring the vdevice from HEF (for each HEF) The next step is to create a hailo_hef, and to use it
to configure the vdevice for inference. We init a hailo_configure_params_t with default
values. Then we modify batch-size to 1 for each network group. This is the default batch-size value
and will not have any effect (just to demonstrate API usage). We configure the vdevice and gets a
hailo_configured_network_group object.
Used APIs: hailo_create_hef_file(), hailo_init_configure_params_by_vdevice()
and hailo_configure_vdevice().
Build vstreams The next step is creating the input and output virtual streams for the configured network.
First, we are making default virtual stream params for each virtual stream. Second, we create the virtual
streams (inputs and outputs). Finally, we extract the vstream’s frame size and allocating the host input
and output buffers and initialize the source with random data to send to inference.
hailo_make_input_vstream_params(), hailo_make_output_vstream_params(),
Used APIs:
hailo_create_input_vstreams(), hailo_create_output_vstreams().
hailo_get_input_vstream_frame_size() and hailo_get_output_vstream_frame_size().
Infer stage
Inference In this example, we create a new thread for each input vstream using the function cre-
ate_input_vstream_thread. Each created thread sends data to the vdevice using the function
write_to_vdevice.
The write thread will send all frames by writing the HW buffer to the vdevice.
Read from device The read function gets as input the following:
The read function will receive all frames in the following flow:
Page 27 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
In order to complete the inference on each network group, the main thread then waits for all the input vstream
threads to finish via hailo_join_thread, and afterwards waits for all the output vstreams threads to finish before
deactivating the current activated network group and continuing onto the next.
See: hailort/libhailort/examples/c/multi_network_vstream_example.c
Summary
• Demonstrates how to work with multiple networks compiled together into the same network group (co-
compilation), using virtual streams.
• Working with multiple networks allows to configure network-based parameters (such as different batch per
network) and gives a more native approach to work with send/receive threads per network.
• The example works with an HEF containing one network group, and two networks in the network group.
• Configure the network group and get the networks information to create the vstreams for each network.
• The data is sent to the device via input vstreams and received via output vstreams.
• The data is transformed before sent and after receiving in a different thread using the virtual stream pipeline.
Code structure
Device initialization The first step is to initialize the vdevice, we initialize the hailo_vdevice_params_t with
default values, and then we create the VDevice.
Get the networks information We use the hailo_configured_network_group object we got in the pre-
vious step, to get the networks information, hailo_network_info_t objects.
Creating vstreams For each network in the network group, we first need to initialize vstream params (both input
and output). Then, we are ready to create the vstreams for each network. The vstreams will be ready for use
only after activating the network group.
Note: To create the vstream for a specific network, one should pass the specific net-
work’s name when making the vstream’s params. It is also possible to use the net-
work group’s name to create all vstreams for all networks together. For more infor-
mation see the documentation for hailo_make_input_vstream_params() and
hailo_make_output_vstream_params().
Used APIs: hailo_make_input_vstream_params(), hailo_make_output_vstream_params(),
hailo_create_input_vstreams() and hailo_create_output_vstreams()
Activating a network group Before starting inference, we need to activate the network group.
Page 28 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Inference In this example, we use p_thread for inference, with a sub-thread for each output vstream receiving
data and a sub-thread for each input vstream sending data.
Write to device The write thread, will firstly initialize a buffer used for send. Then the thread will send all frames in
a loop.
The read function is analogical to the write. Firstly we initialize a recv buffer. Then we will recv all
frames in a loop.
5.1.5. Automatic switch between multiple network groups using virtual streams –
switch_network_groups_example
See: hailort/libhailort/examples/c/switch_network_groups_example.c
Summary
• Demonstrates inference of multiple network groups over a single device, using VDevice and Round-Robin
scheduling algorithm.
• Multiple HEFs are configured into the VDevice, creating multiple network groups.
• For each network group, create virtual streams, send threads and recv threads.
See also:
See the comparison table between context switching and network groups switching for more information about run-
ning multiple models.
Code structure
Device initialization We initialize the hailo_vdevice_params_t with default values, and then we create
the VDevice. The hailo_vdevice_params_t::scheduling_algorithm is set by default to
HAILO_SCHEDULING_ALGORITHM_ROUND_ROBIN.
Used APIs: hailo_create_vdevice().
Pre infer stage
Configuring the vdevice from HEF (for each HEF) The next step is to create a hailo_hef, and to use it to
configure the vdevice for inference. We init a hailo_configure_params_t with default values,
configure the vdevice and gets a hailo_configured_network_group object.
Page 29 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Set scheduler’s timeout threshold, and priority We set higher threshold and timeout for the first
model scheduling. It will give priority to the scheduling of the second model. We also set
HAILO_SCHEDULER_PRIORITY_NORMAL+1 priority for the first model scheduling. The
practical meaning is that the first network will be ready to run only if SCHEDULER_THRESHOLD send
requests have been accumulated, or more than SCHEDULER_TIMEOUT_MS time has passed and at
least one send request has been accumulated. However when both the first and the second networks
are ready to run, the first network will be preferred over the second network.
Build vstreams (for each network group) The next step is creating the input and output virtual streams for
each configured network. First, we are making default virtual stream params for each virtual stream.
Second, we create the virtual streams (inputs and outputs). Finally, we extract the vstream’s frame size
and allocating the host input and output buffers and initialize the source with random data to send to
inference.
hailo_make_input_vstream_params(), hailo_make_output_vstream_params(),
Used APIs:
hailo_create_input_vstreams(), hailo_create_output_vstreams().
hailo_get_input_vstream_frame_size() and hailo_get_output_vstream_frame_size().
Inference In this example, we create a new thread for each input vstream using the function cre-
ate_input_vstream_thread. Each created thread sends data to the device using the function
write_to_device.
The write thread will send all frames by writing the HW buffer to the device.
Read from device The read function gets as input the following:
The read function will receive all frames in the following flow:
Page 30 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
5.1.6. User controlled switch between multiple HEFs using virtual streams –
switch_network_groups_manually_example
See: hailort/examples/c/switch_network_groups_manually_example.c
Summary
• Demonstrates inference of multiple network groups over a single device, using VDevice.
• Multiple HEFs are configured into the VDevice, creating multiple network groups.
• Create send thread and recv thread. the vstreams for each network group will be created inside these threads.
See also:
See the comparison table between context switching and network groups switching for more information about run-
ning multiple models.
Code structure
hailo_create_hef_file(), hailo_init_configure_params_by_vdevice(),
Used APIs:
hailo_configure_vdevice(), hailo_make_input_vstream_params(), and
hailo_make_output_vstream_params().
Creating VStream params and Vstream infos
The next step is to create the virtual stream params. We create the virtual stream params from
the network group using the functions hailo_make_input_vstream_params() and
hailo_make_output_vstream_params(). Then, we get all vstream infos from the HEF.
Used APIs: hailo_make_input_vstream_params(),
hailo_make_output_vstream_params() and hailo_hef_get_all_vstream_infos()
Inference In this example, we create one thread for inputs, and one thread for outputs, assuming we
have only one input and one output per network group. The threads are responsible for creating
the VStreams, allocating buffers for send / recv, and synchronizing the network group switches using
hailo_activate_network_group() and hailo_deactivate_network_group()
APIs. the first activation of the first network group is done in the main thread.
Page 31 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/c/data_quantization_example.c
Page 32 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Summary
When a neural network (NN from now on) is compiled by the Dataflow Compiler, each input/output layer in the NN is
assigned two floating point values that are parameters to an input/output transformation: qp_zp (zero_point) and
qp_scale (fields of the struct hailo_quant_info_t). These values are stored in the HEF.
• Input transformation: input data is divided by qp_scale and then qp_zp is added to the result.
• Output transformation: qp_zp is subtracted from output data and then the result is multiplied by
qp_scale.
In the context of the HailoRT library, there are two options to quantize the data:
• Use a virtual stream, and mark it as non-quantized (float32_t) in the vstream params creation. The data sent to
the virtual stream will be quantized as part as the transformation process. See the vstreams example for more
info about virtual streams.
• out – The output is to be left quantized, hence HailoRT won’t de-quantize the output.
• both – The input is quantized and the output is to be left quantized, hence HailoRT won’t do either.
• none – The input isn’t quantized and the output is to be de-quantized, hence HailoRT will do both.
Code structure
Device initialization and configuration We create a vdevice and configure it using HEF. The code is similar to the
one in the vstreams example
Creating virtual streams In the function create_vstreams we create both input and output virtual stream. At this
point we can set the desired quantization behavior for input streams and de-quantization behavior for output
streams via the format_type argument.
Note: On some cases (such as NMS output) the output’s format_type HAILO_FORMAT_TYPE_AUTO stands for
HAILO_FORMAT_TYPE_FLOAT32, and therefor will result in output de-quantization.
Page 33 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The rest of the code After creating the virtual streams and activating the network group, we can get the stream
handles and commence with the inference. This code is almost identical to the code used in hailort/
libhailort/examples/c/vstreams_example.c. For an explanation, see the vstreams example.
See: hailort/libhailort/examples/c/raw_streams_example.c
Summary
• The data sent/received does not undergo the transformation process as required on raw streams. For a com-
plete raw stream example with transformation, see raw_streams_example.
Code structure
Device initialization We open the first enumerated Hailo device (by passing NULL as value for parameter device_id
to hailo_create_device_by_id())
Activating a network group Before starting inference, we need to activate the network group.
Write to device The write thread, will firstly initialize any necessarily resources, including:
• host_data – Will contain the actual user data (for example - frame).
• host_data - Will contain the actual user data (The network result).
Page 34 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/c/raw_async_streams_single_thread_example.
c
Summary
• Demonstrates basic async inference of a shortcut network using raw async stream API.
• The data sent/received does not undergo the transformation process as required on raw streams. For a com-
plete raw stream example with transformation, see raw_streams_example.
Code Structure
Device Initialization We open the first enumerated Hailo device (by passing NULL as value for parameter device_id
to hailo_create_device_by_id())
Activating a network group Before starting inference, activate the network group.
Async streams are backed by limited-sized queue for pending async transfers. The max queue
sizes are provided by hailo_input_stream_get_async_max_queue_size() and
hailo_output_stream_get_async_max_queue_size(). In this example, the maximum
number of ongoing transfers across all streams, denoted as ongoing_transfers, is calculated by taking the
minimum value among the queues of all streams.
If a user attempts to perform more concurrent async operations than the value of ongoing_transfers, they may
encounter an error with the code HAILO_QUEUE_IS_FULL.
Page 35 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Async Inference
• For each output stream, ongoing_transfers async read requests are launched.
1. For each transfer, allocate memory that is aligned to the system page size, as required by
hailo_stream_read_raw_buffer_async().
2. The async read operation is initiated by calling hailo_stream_read_raw_buffer_async(),
passing the allocated buffer.
In a real application the results obtained by the read operations can be passed for post-processing
or display.
• For each input stream, ongoing_transfers async writes requests are launched.
1. For each transfer, allocate memory that is aligned to the system page size, as required by
hailo_stream_write_raw_buffer_async(). In this example, the buffer initially con-
tains garbage data.
Real applications may choose to fill the buffer with a new frame, free it, or return it to some buffer
pool for later use.
• Since further async operations are launched within each callback, the inference is executed in parallel to
the main thread. In this example, the main thread remains idle and sleeps for 5 seconds, allowing the
inference to run in the background.
Note: It is important to ensure that the buffers passed to the inference and any variables passed in the async callback
opaque remains valid until all callbacks are called. Failure to do so may result in the callback being called with invalid
variables, leading to undefined behavior.
Page 36 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/examples/c/infer_pipeline_example.c
Summary
• Demonstrates basic inference of a shortcut network (i.e inputs are sent through the device and right back out,
without any changes made to the data).
• The program uses the first Hailo Ethernet device found connected to a specified interface.
• The data is both sent to the device and received using the inference pipeline.
Code structure
Device initialization We open the first enumerated Hailo Ethernet device found on the specified interface.
Creating VStream params and Vstream infos The next step is creating the virtual
stream params. We create the virtual stream params from the network
group using the functions hailo_make_input_vstream_params() and
hailo_make_output_vstream_params(). Then, we get all vstream infos from the HEF.
Used APIs: hailo_make_input_vstream_params(), hailo_make_output_vstream_params()
and hailo_hef_get_all_vstream_infos()
Activating a network group Before starting inference, we need to activate the network group.
Page 37 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/c/power_measurement_example.c
Summary
• The program uses a VDevice created from all the Hailo devices that are connected to the computer.
• In this tutorial we use the following arguments to control the measurement type:
Code structure
VDevice initialization First we scan for devices, then we initialize the hailo_vdevice_params_t with the
device count we scanned before. The next step is to create the VDevice.
Initialization For sending controls to a hailo_device, we need to get the underlying physical devices
from the hailo_vdevice, using the function hailo_get_physical_devices(). For each
physical device, we first call the function hailo_stop_power_measurement() to make sure
there aren’t any former measurements currently running. The next step is to set power measurement
arguments using the function hailo_set_power_measurement(), and to start the measure-
ment using the function hailo_start_power_measurement()
hailo_get_physical_devices(), hailo_stop_power_measurement(),
Used APIs:
hailo_set_power_measurement() and hailo_start_power_measurement().
Stopping measurement and fetching the results After starting the measurement, we sleep for a constant
period of time (5 seconds). Once we finish sleeping, we go over all physical devices and do the following:
Page 38 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/c/notification_callback_example.c
Summary
• The program creates a device and then sets and removes a notification callback on it.
Code structure
Device initialization
By hailo_set_notification_callback()
calling with
the following hailo_notification_id_t::
notification
id:
HAILO_NOTIFICATION_ID_HEALTH_MONITOR_OVERCURRENT_ALARM, the
callback function will be called when we will get this notification.
By hailo_remove_notification_callback()
calling
with the hailo_notification_id_t
same as in the
hailo_set_notification_callback(), we remove this notification callback.
Used APIs: hailo_remove_notification_callback().
In this section we will provide various examples of the HailoRT API. The code mentioned below is included in the
release under hailort/libhailort/examples/cpp in the github repository. In order to compile and run
the examples, one should clone the repository, and install hailort from the github repository. See documentation.
Note: (for C++ API users) In order to maintain ABI Integrity between libhailort and the examples code that uses the
C++ API, you should compile libhailort instead of using the pre-compiled binaries.
All functions calls are based on the headers provided in the directory hailort/include/hailo/. One can
include hailort/include/hailo/hailort.hpp to access all functions. See the API documentation for
more details.
Page 39 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Compiling examples is done using the following commands from examples directory:
In order to compile a specific example, either add the example name as target with a cpp prefix, or run the cmake
command from the target example dir:
cd cpp/vstreams_example
cmake S. Bbuild DCMAKE_BUILD_TYPE=Release
cmake build build config release
Note: For debug builds of C++ examples, it is recommended to build the examples as part of source compilation of
HailoRT.
Running examples:
Run the examples using the following command, from the examples directory:
build/cpp/<example_name>/cpp_<example_name> [params...]
Cross-Compile Tutorials
Add the following options while configuring the examples using CMake:
• DCMAKE_TOOLCHAIN_FILE=”<toolchain file>”
• DCMAKE_FIND_ROOT_PATH=”<target dir>”
• DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
See: hailort/libhailort/examples/cpp/vstreams_example.cpp
Page 40 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Summary
• Demonstrates basic inference of a shortcut network using the virtual stream C++ API.
• The program infers hefs with multiple virtual input streams and multiple virtual output streams.
• The program creates a thread for each virtual output stream and a thread for each virtual input stream.
Code structure
Device initialization We initialize the hailo_vdevice_params_t with default values, and then we create
the VDevice. By creating the VDevice with a hailo_vdevice_params_t with default values, the model
scheduler is enabled (with its default scheduling scheme - Round Robin). For that reason, we don’t need to acti-
vate/deactivate the network groups in the user application, since when the scheduler is enabled, the activation
and deactivation is done automatically.
hailort::NetworkGroup::make_input_vstream_params(), hailort::VStreamsBuilde
Used APIs:
hailort::NetworkGroup::make_output_vstream_params() and hailort::
VStreamsBuilder::create_output_vstreams(),
Inference In this example, we use std::thread for inference, with a sub-thread for each output thread receiving
data from the device calling the read_all() function, and another sub-thread for each input thread calling the
write_all() function for sending data to the device.
Read all The read_all() function, will firstly create and initialize a vector of data to recv data from the device. Then
the read_all thread will receive all of the frames from the device.
See: hailort/libhailort/examples/cpp/multi_device_example.cpp
Page 41 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Summary
• Creates a virtual device from all Hailo devices that are connected to the computer.
• The program infers HEFs with multiple virtual input streams and multiple virtual output streams.
• The program creates a thread for each virtual output stream and a thread for each virtual input stream.
Code structure
VDevice initialization First we scan for Hailo devices, then we initialize the hailo_vdevice_params_t with
the device count we scanned before. The next step is to create the vdevice.
Read all The read_all() function, will firstly create and initialize a vector of data to recv data from the vdevice. Then
the read_all thread will receive all of the frames from the device.
See: hailort/libhailort/examples/cpp/multi_network_vstream_example.cpp
Page 42 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Summary
• Demonstrates how to work with multiple networks compiled together into the same network group (co-
compilation), using virtual streams.
• Working with multiple networks allows to configure network-based parameters (such as different batch per
network) and gives a more native approach to work with send/receive threads per network.
• The example works with an HEF containing one network group, and two networks in the network group.
• Configure the network group and get the networks information to create the vstreams for each network.
• The data is sent to the device via input vstreams and received via output vstreams.
• The data is transformed before sent and after receiving in a different thread using the virtual stream pipeline.
Code structure
Device initialization We initialize the hailo_vdevice_params_t with default values, and then we create the
VDevice.
Note: To create the vstream for a specific network, one should pass the specific network’s name. It is also
possible to use the network group’s name to create all vstreams for all networks together. For more information
see the documentation for hailort::VStreamsBuilder::create_vstreams().
Read all The read_all() function, will firstly create and initialize a vector of data to recv data from the device. Then
the read_all thread will receive all of the frames from the device.
Page 43 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
5.2.5. Automatic switch between multiple network groups using virtual streams –
switch_network_groups_example
See: hailort/libhailort/examples/cpp/switch_network_groups_example.cpp
Summary
• Demonstrates inference of multiple network groups over a single device, using VDevice and Round-Robin
scheduling algorithm.
• Multiple HEFs are configured into the VDevice, creating multiple network groups.
• For each network group, create virtual streams, send threads and recv threads.
See also:
See the comparison table between context switching and network groups switching for more information about run-
ning multiple models.
Code structure
Device initialization We initialize the hailo_vdevice_params_t with default values, and then we create
the VDevice. The hailo_vdevice_params_t::scheduling_algorithm is set by default to
HAILO_SCHEDULING_ALGORITHM_ROUND_ROBIN.
Used APIs: hailort::VDevice::create()
Pre infer stage
Configuring the vdevice from HEF (for each HEF) The next step is to create a hailort::Hef,
and to use it to configure the vdevice for inference. We configure the vdevice using the VDe-
vice class function hailort::VDevice::configure(), and getting a hailort::
ConfiguredNetworkGroupVector object. We store all the configured network groups in
a vector.
hailort::ConfiguredNetworkGroup::set_scheduler_timeout(),
Used APIs:
hailort::ConfiguredNetworkGroup::set_scheduler_threshold() and
hailort::ConfiguredNetworkGroup::set_scheduler_priority().
Build vstreams (for each network group) The next step is creating the input and output virtual streams
for each configured network group. We create the vstreams using the function hailort::
VStreamsBuilder::create_vstreams().
Used APIs: hailort::VStreamsBuilder::create_vstreams()
Inference In this example, we create a new thread for each input vstream using the function cre-
ate_write_threads. Each created thread sends data to the device using the function write_all.
Write all The write_all() function, will firstly create and initialize a vector of data to send to the device, using the
function hailort::InputVStream::get_frame_size(). The main loop of this function
sends the allocated frame to the device.
Page 44 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Read all The read_all() function, will firstly create and initialize a vector of data to recv data from the device,
using the function hailort::OutputVStream::get_frame_size(). The main loop of this
function read frames from the device.
5.2.6. User controlled switch between multiple HEFs using virtual streams –
switch_network_groups_manually_example
See: hailort/libhailort/examples/cpp/switch_network_groups_manually_example.
cpp
Summary
• For each network group, create virtual streams, send threads and recv threads. those threads will be re-used.
• The main loop runs over several network groups. It activates a single network group each time.
• For each activated network group, The data is sent to the device via input vstreams and received via output
vstreams.
See also:
See the comparison table between context switching and network groups switching for more information about run-
ning multiple models.
Code structure
Configuring the vdevice from HEF (for each HEF) The next step is to create a hailort::
Hef, and to use it to configure the vdevice for inference. We configure the vdevice using the
VDevice class function hailort::VDevice::configure(), and getting a hailort::
ConfiguredNetworkGroupVector object. We store all the configured network groups in
a vector.
Page 45 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
SyncObject SyncObject is a simple barrier-like synchronization mechanism, which allows re-usage of the same
threads over several iterations. We create SyncObject per network group, initializing it with the number
of vstreams (threads) in that network group. After activating a network group from main thread, we wait
for its I/O threads to finish the iteration. when I/O threads finishes the iteration, they signal the main
thread to ‘switch’ network group.
Build vstreams - main thread per network group The next step is creating the virtual streams and
I/O threads. We create the virtual using the function hailort::VStreamsBuilder::
create_vstreams(). In this example, we use std::thread per network group. in this thread we
create the virtual streams and I/O threads. We create the virtual streams using the function hailort:
:VStreamsBuilder::create_vstreams(). We also create sub-thread for each output
vstream responsible for receiving data from the device calling the read_all() function, and another sub-
thread for each input vstream calling the write_all() function for sending data to the device.
Activating a network group Before starting inference, we need to activate the network group. We iterate
over all configured network groups, activating one at a time. After the activation, we wait on its matching
synchronization object until I/O threads will finish the iteration.
See: hailort/libhailort/examples/cpp/raw_streams_example.cpp
Summary
• Demonstrates basic inference of a shortcut network using the raw stream C++ API.
• The program infers hefs with multiple input streams and multiple output streams.
• The program creates a thread for each input stream and a thread for each output stream.
• The data is transformed using the transformation API when sent / received to / from the device in the same
thread that sends / receives the data to/from the device.
Page 46 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Code structure
Device initialization
We use the first device found on the system using the function hailort::Device::
create().
Used APIs: hailort::Device::create().
Configuring the device from HEF The next step is to create a hailort::Hef, and to use it to configure the device
for inference. We init a hailort::NetworkGroupsParamsMap with default values, configure the
device using the Device class function hailort::Device::configure() and gets a hailort::
ConfiguredNetworkGroupVector object.
Used APIs: hailort::Hef::create(), hailort::Hef::create_configure_params() and
hailort::Device::configure().
Get Input/Output streams
The next step we get the input streams and output streams from the network group.
Read all The read_all() thread, will firstly initialize any necessary resources, including:
• host_data - Will contain the actual user data (The network result).
• host_data – Will contain the actual user data (for example - frame).
Page 47 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/cpp/raw_async_streams_single_thread_example.
cpp
Summary
• Demonstrates basic async inference of a shortcut network using raw async stream API.
• The data sent/received does not undergo pre-processing/post-processing. For a complete raw stream example
with pre-processing/post-processing, see raw_streams_example
Code Structure
Device Initialization
We use the first device found on the system using the function hailort::Device::
create().
Used APIs: hailort::Device::create().
Configuring The Device From HEF The next step is to create a hailort::Hef and to use it to config-
ure the device for inference. We initialize a hailort::NetworkGroupsParamsMap with de-
fault values. To support async streams API the HAILO_STREAM_FLAGS_ASYNC flag is set inside
hailo_stream_parameters_t. We configure the device using the hailort::Device::
configure() function which returns a hailort::ConfiguredNetworkGroup object.
hailort::Hef::create(), hailort::Hef::create_configure_params() and
Used APIs:
hailort::Device::configure().
Activating a network group Before starting inference, activate the network group.
1. For each transfer, allocate memory that is aligned to the system page size, as required by
hailort::OutputStream::read_async().
2. The async read operation is initiated by calling hailort::OutputStream::
read_async(), passing the allocated buffer.
3. Once a read operation has finished, the associated async callback function is triggered.
In this example, the callback function examines the hailort::OutputStream::
CompletionInfo::status that is passed to it. If the status is HAILO_SUCCESS,
indicating a successful transfer, a new async read request is initiated using the same buffer
and callback.
Real applications may pass the results obtained by the read operations for post-processing or
display.
Page 48 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
1. First for each transfer, allocate memory that is aligned to the system page size, as required by
hailort::InputStream::write_async().
2. The async write operation is initiated by calling hailort::InputStream::
write_async(), passing the allocated buffer.
3. Once a write operation has finished, the associated async callback function is triggered.
In this example, the callback function examines the hailort::InputStream::
CompletionInfo::status that is passed to it. If the status is HAILO_SUCCESS,
indicating a successful transfer, a new async write request is initiated using the same buffer
and callback.
Real applications may choose to fill the buffer with a new frame, free it, or return it to some
buffer pool for later use.
• Since further async operations are launched within each callback, the inference is executed in par-
allel to the main thread. In this example, the main thread remains idle and sleeps for 5 seconds,
allowing the inference to run in the background.
Note: It is important to ensure that the buffers passed to the inference and any variables captured in the async
operations callback remain valid until all callbacks are called. Failure to do so may result in the callback being called
with invalid variables, leading to undefined behavior.
See: hailort/libhailort/examples/cpp/raw_async_streams_multi_thread_example.
cpp
Summary
• Demonstrates basic async inference of a shortcut network using raw async stream API.
• The data sent/received does not undergo pre-processing/post-processing. For a complete raw stream example
with pre-processing/post-processing, see raw_streams_example
Page 49 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Code Structure
Device Initialization
We use the first device found on the system using the function hailort::Device::
create().
Used APIs: hailort::Device::create().
Configuring The Device From HEF The next step is to create a hailort::Hef and to use it to config-
ure the device for inference. We initialize a hailort::NetworkGroupsParamsMap with de-
fault values. To support async streams API the HAILO_STREAM_FLAGS_ASYNC flag is set inside
hailo_stream_parameters_t. We configure the device using the hailort::Device::
configure() function which returns a hailort::ConfiguredNetworkGroup object.
Used APIs:hailort::Hef::create(), hailort::Hef::create_configure_params() and
hailort::Device::configure().
Activating a network group Before starting inference, activate the network group.
• First for each transfer, allocate memory that is aligned to the system page size, as required
by the hailort::OutputStream::read_async() and hailort::InputStream::
write_async(). For simplicity, in this example, for each stream we maintain a single buffer that
it is used for all transfers. In real applications, it may be problematic in output since the buffer will be
overridden on each read.
• Since the same buffers are used to inference, the buffers can be mapped to the device by constructing a
hailort::DmaMappedBuffer object. The buffers will be mapped until the object is destroyed.
• Create a thread for the output stream that continuously initiate async read operations. The thread will:
– Wait until the hailort::OutputStream is ready to initiate a new async read operation by
calling hailort::OutputStream::wait_for_async_ready().
– The loop ends when the network becomes deactivated. All pending read will be com-
pleted with the status HAILO_STREAM_ABORT. Either hailort::OutputStream::
wait_for_async_ready() or hailort::OutputStream::read_async() will
return HAILO_STREAM_NOT_ACTIVATED.
• We create a thread for the input stream that continuously initiate async write operations. The thread will:
– Wait until the hailort::InputStream is ready to initiate a new async write operation by
calling hailort::InputStream::wait_for_async_ready().
– The loop ends when the network becomes deactivated. All pending read will be com-
pleted with the status HAILO_STREAM_ABORT. Either hailort::InputStream::
wait_for_async_ready() or hailort::InputStream::write_async() will
return HAILO_STREAM_NOT_ACTIVATED.
Page 50 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• The inference is executed in parallel to the main thread. In this example, the main thread remains idle
and sleeps for 5 seconds, allowing the inference to run in the background.
hailort::OutputStream::wait_for_async_ready(), hailort:
Used APIs:
:OutputStream::read_async(), hailort::InputStream::
wait_for_async_ready(), hailort::InputStream::write_async(),
hailort::DmaMappedBuffer and hailort::ConfiguredNetworkGroup::
shutdown().
Note: It is important to ensure that the buffers passed to the inference and any variables captured in the async
operations callback remain valid until all callbacks are called. Failure to do so may result in the callback being called
with invalid variables, leading to undefined behavior.
Note: To use Multi-Process service with libhailort when compiling from sources, use the compilation flag
HAILO_BUILD_SERVICE.
Note: In case of restricted execution policy, either change the policy, or run the script with “PowerShell -NoProfile
-ExecutionPolicy Bypass -File <FilePath>”
Summary
• Demonstrates how to work with HailoRT multi-process service over a single device, using VDevice and Round-
Robin scheduling algorithm for network group switching.
• For each network group, the program creates a thread for each input vstream and a thread for each output
vstream.
• The program waits for all threads to finish, and validate their results.
Page 51 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
In order to run the example, one should first enable and start the HailoRT service as follow:
• To enable and start the service, run: sudo systemctl enable now hailort.
service
• If service is enabled but not active, run: sudo systemctl start hailort.service
• To see the service status and make sure it is active, run: sudo systemctl status
hailort.service
1) From the examples directory, in each terminal run the following command: ` ./build/
cpp/cpp_multi_process_example <hef_path> `
2) Using the script hailort/libhailort/examples/cpp/multi_process_example.sh or hailort/l
The script is running the example in multiple processes, its default is to run two processes:
In the script options, one can specify how many processes to run inference on each hef. See
hailort/libhailort/examples/cpp/multi_process_example.sh
h or hailort/libhailort/examples/cpp/multi_process_example.
ps1 h for more information.
Code Structure
Device Initialization We initialize the hailo_vdevice_params_t with default values, and then we
create the VDevice. We set the hailo_vdevice_params_t::scheduling_algorithm to
be HAILO_SCHEDULING_ALGORITHM_ROUND_ROBIN and hailo_vdevice_params_t::
multi_process_service to be true.
Used APIs: hailort::VDevice::create()
Pre-infer Stage
Configuring the vdevice from HEF The next step is to create a hailort::Hef, and to use
it to configure the vdevice for inference. We configure the vdevice using the pcie Device
class function hailort::VDevice::configure(), and getting a hailort::
ConfiguredNetworkGroupVector object. We store all the configured network groups in
a vector.
Build VStreams The next step is creating the virtual streams. We create the virtual streams from the network
group using the function hailort::VStreamsBuilder::create_vstreams().
Read all The read_all() function, will firstly create and initialize a vector of data to recv data from the device.
Then the read_all thread will receive all of the frames from the device.
Page 52 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
After joining the read and write threads, we iterate over all returned results to validate success.
See: hailort/libhailort/examples/cpp/infer_pipeline_example.cpp
Summary
• Demonstrates basic inference of a shortcut network (i.e inputs are sent through the device and right back out,
without any changes made to the data).
• The data is both sent to the device and received using the inference pipeline.
Code structure
hailort::InferVStreams::get_input_vstreams(), :hailort::InputVStream::get_fr
Used APIs:
hailort::InferVStreams::get_output_vstreams(), :hailort::
OutputVStream::get_frame_size(),
Inference Finally, we run inference on the input data using the inference pipeline.
Page 53 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/cpp/power_measurement_example.cpp
Summary
• The program uses a VDevice created from all the Hailo devices that are connected to the computer.
• In this tutorial we use the following arguments to control the measurement type:
Code structure
VDevice initialization First we scan for PCIe devices, then we initialize the hailo_vdevice_params_t with
the device count we scanned before. The next step is to create the VDevice.
Initialization For sending controls to a hailort::Device, we need to get the underlying phys-
ical devices from the hailort::VDevice, using the function hailort::VDevice::
get_physical_devices(). For each physical device, we first call the function hailort::
Device::stop_power_measurement() to make sure there aren’t any former measurements
currently running. The next step is to set power measurement arguments using the function hailort:
:Device::set_power_measurement(), and to start the measurement using the function
hailort::Device::start_power_measurement()
Used APIs:hailort::VDevice::get_physical_devices(), hailort::Device::
stop_power_measurement(), hailort::Device::set_power_measurement() and
hailort::Device::start_power_measurement().
Stopping measurement and fetching the results After starting the measurement, we sleep for a constant
period of time (5 seconds). Once we finish sleeping, we go over all physical devices and do the following:
hailort::Device::stop_power_measurement(), hailort::Device::
Used APIs:
get_power_measurement().
Page 54 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See: hailort/libhailort/examples/cpp/notification_callback_example.cpp
Summary
• The program creates a device and then sets and removes a notification callback on it.
Code structure
Device initialization
First we scan for Hailo devices using hailort::Device::scan(), then we use the first de-
vice_id we found for creating the device, using the function hailort::Device::create().
By Device::remove_notification_callback()
calling with
the hailo_notification_id_t
same as in the Device::
set_notification_callback(), we remove this notification callback.
Used APIs: Device::remove_notification_callback().
See: hailort/libhailort/examples/cpp/async_infer_basic_example.cpp
Summary
• The program creates a virtual device and runs async inference on a model.
Code Structure
The example creates an inference model based on the given HEF file, using the function hailort:
:VDevice::create_infer_model(). Then the example configures the inference model
using the function hailort::InferModel::configure().
Page 55 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The example creates input and output buffers and sets them as hailort::MemoryView buffers
for the inference model, using the function hailort::ConfiguredInferModel::
Bindings::InferStream::set_buffer()
Used APIs: hailort::ConfiguredInferModel::Bindings::InferStream::
set_buffer().
Note: Buffer guards are used to ensure the buffers won’t be deleted during inference.
The example runs async inference and waits for the job to finish using the functions hailort:
:ConfiguredInferModel::run_async(), and hailort::AsyncInferJob::
wait().
Used APIs: hailort::ConfiguredInferModel::run_async(), hailort::
AsyncInferJob::wait().
See: hailort/libhailort/examples/cpp/async_infer_advanced_example.cpp
Summary
• The program creates a virtual device and runs async inference on a multi-planar network.
Code Structure
Device Initialization
The example creates an inference model based on the given HEF file, using the function
hailort::VDevice::create_infer_model(). The example then sets the out-
put format type to HAILO_FORMAT_TYPE_FLOAT32 using hailort::InferModel:
:InferStream::set_format_type(), sets the batch size to BATCH_SIZE (de-
fined at the top of thie example) using hailort::InferModel::InferStream::
set_batch_size() and following this the example configures the inference model using the
function hailort::InferModel::configure().
hailort::VDevice::create_infer_model(), hailort::InferModel:
Used APIs:
:InferStream::set_format_type(), hailort::InferModel::InferStream::
set_size(), hailort::InferModel::configure().
Input And Output Buffers Assignment
The example creates input and output buffers and sets them as hailo_pix_buffer_t
input buffers and hailort::MemoryView output buffers for the inference model, using the
Page 56 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
functions hailort::ConfiguredInferModel::Bindings::InferStream:
:set_pix_buffer() and hailort::ConfiguredInferModel::Bindings::
InferStream::set_buffer()
Used APIs: hailort::ConfiguredInferModel::Bindings::InferStream:
:set_pix_buffer(), hailort::ConfiguredInferModel::Bindings::
InferStream::set_buffer().
Note: buffer guards are used to ensure the buffers won’t be deleted during inference.
The example runs async inference on all the frames and waits for the last async inference job to
finish using the functions hailort::ConfiguredInferModel::run_async(), and
hailort::AsyncInferJob::wait().
Used APIs: hailort::ConfiguredInferModel::run_async(), hailort::
AsyncInferJob::wait().
Requirements:
• Run the notebook inside the Python virtual environment: source hailo_virtualenv/bin/
activate
It is recommended to use the command hailo tutorial (when inside the virtualenv) to open a Jupyter server
that contains the tutorials.
The standalone flow allows direct access to the HW, developing applications directly on top of Hailo core HW, using
HailoRT. This way the Hailo hardware can be used without Tensorflow, and even without the Hailo SDK (after the HEF
is built).
An HEF is Hailo’s binary format for neural networks. The HEF files contain:
• Target HW configuration
• Weights
First create the desired target object. In this example the Hailo-8 PCIe interface is used.
[ ]: import numpy as np
from multiprocessing import Process
from hailo_platform import (HEF, VDevice, HailoStreamInterface, InferVStreams,�
,→ConfigureParams,
# The target can be used as a context manager (”with” statement) to ensure it's released�
,→on time.
Page 57 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
hef_path = '../hefs/{}.hef'.format(model_name)
hef = HEF(hef_path)
[ ]: # Infer
with InferVStreams(network_group, input_vstreams_params, output_vstreams_params)�
,→as infer_pipeline:
This section shows how to run streaming inference using multiple processes in Python.
We will not use infer. Instead we will use a send and receive model. The send function and the receive function will
run in different processes.
for _ in range(num_frames):
for vstream, buff in vstream_to_buffer.items():
(continues on next page)
Page 58 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
vstream.send(buff)
proc.start()
recv_procs.append(proc)
for proc in recv_procs:
proc.join()
Define the amount of frames to stream, define the processes, create the target and run processes:
with network_group.activate(network_group_params):
send_process.join()
recv_process.join()
print('Done')
target.release()
This tutorial will show how to perform a power measurement on the chip.
The Hailo chip supports power measurement which is done via the control protocol.
Requirements:
• Run the notebook inside the Python virtual environment: source hailo_virtualenv/bin/
activate
Attention:
• These examples should run in a different process than the one that performs the actual inference.
It is recommended to use the command hailo tutorial (when inside the virtualenv) to open a Jupyter server
that contains the tutorials.
Page 59 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
[ ]: %matplotlib inline
import time
[ ]: target = Device()
When using the power_measurement() function with no parameters, the function tries to detect which board is
connected (evaluation board, M.2 or mPCIe) and determine the DVM accordingly (at the moment only the mentioned
boards are supported).
The parameter dvm (of type DvmTypes) defines which DVM will be measured. The user can choose a specific DVM
or choose the default DVM. The meaning of the default DVM changes according to the board or module in use.
The default for the evaluation board is the sum of three DVMs: DvmTypes.VDD_CORE, DvmTypes.
MIPI_AVDD and DvmTypes.AVDD_H. The sum of these three DVMs approximates of the total power consump-
tion of the chip in PCIe setups. Only power can be measured using this default option, as voltage and current can’t
be summed up this way.
The default for platforms supporting current monitoring, such as M.2 and mPCIe modules, is DvmTypes.
OVERCURRENT_PROTECTION, which measures the power consumption of the whole module.
See the API documentation for further details about the supported DVMs and measurement types.
[ ]: single_power_measurement = target.control.power_measurement()
print('Power from single measurement: {} W'.format(single_power_measurement))
A measurement index is selected. It is a member of the enum class MeasurementBufferIndex (between 0 and 3). The
DVM is not given so the default DVM will be used, as explained above.
[ ]: buffer_index = MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0
target.control.set_power_measurement(buffer_index=buffer_index)
The following call to start_power_measurement() allows to configure the power sampling frequency. In
this case we keep the default configuration. The API documentation provides more details.
[ ]: target.control.start_power_measurement()
Clear old samples and statistics (min, max, average) each time the measurement is taken from the chip.
[ ]: should_clear = True
The firmware calculates the min, max, and average of all the values from the sensor. Note that the average cal-
culated by the firmware is the “average of averages”. This is the average of all values that have already been
averaged by the sensor. The host then requests these values from the firmware every second by calling the
get_power_measurement() function. The host can also read the average time interval between new sen-
sor values.
Page 60 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
[ ]: for _ in range(10):
time.sleep(1)
# Get saved power measurement values from the firmware.
measurements = target.control.get_power_measurement(buffer_index=buffer_index,�
,→should_clear=should_clear)
,→milliseconds))
target.release()
5.5. Python Inference Tutorial - Multi Process Service and Model Sched-
uler
This tutorial describes how to run an inference process using the multi-process service.
Requirements:
• Enable HailoRT Multi-Process Service before running inference. For instructions, see Multi Process Service.
• Run the notebook inside the Python virtual environment: source hailo_virtualenv/bin/
activate
It is recommended to use the command hailo tutorial (when inside the virtualenv) to open a Jupyter
server that contains the tutorials.
In this example we will use the Model Scheduler to run inference on multiple models. Each model is represented by
an HEF which is built using the Hailo Dataflow Compiler. An HEF is Hailo’s binary format for neural networks. The HEF
files contain:
• Target HW configuration
• Weights
The Model Scheduler is an HailoRT component that comes to enhance and simplify the usage of the same Hailo device
by multiple networks. The responsibility for activating/deactivating the network groups is now under HailoRT, and
done automatically without user application intervention. In order to use the Model Scheduler, create the VDevice
with scheduler enabled, configure all models to the device, and start inference on all models:
[ ]: import numpy as np
from multiprocessing import Process
from hailo_platform import (HEF, VDevice, HailoStreamInterface, InferVStreams,�
,→ConfigureParams,
rep_count = 100
with InferVStreams(network_group, input_vstreams_params, output_vstreams_
,→params) as infer_pipeline: (continues on next page)
Page 61 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
for i in range(rep_count):
infer_results = infer_pipeline.infer(input_data)
infer_processes.append(infer_process)
print('Done inference')
Page 62 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Requirements:
• Run the notebook inside the Python virtual environment: source hailo_virtualenv/bin/
activate
It is recommended to use the command hailo tutorial (when inside the virtualenv) to open a Jupyter server
that contains the tutorials.
The standalone flow allows direct access to the HW, developing applications directly on top of Hailo core HW, using
HailoRT. This way the Hailo hardware can be used without Tensorflow, and even without the Hailo SDK (after the HEF
is built).
An HEF is Hailo’s binary format for neural networks. The HEF files contain:
• Target HW configuration
• Weights
First create the desired target object. In this example the Hailo-8 PCIe interface is used.
[ ]: import numpy as np
from hailo_platform import VDevice, HailoSchedulingAlgorithm
timeout_ms = 1000
params = VDevice.create_params()
params.scheduling_algorithm = HailoSchedulingAlgorithm.ROUND_ROBIN
# The vdevice is used as a context manager (”with” statement) to ensure it's released on�
,→time.
buffer = np.empty(infer_model.output().shape).astype(np.uint8)
bindings.output().set_buffer(buffer)
Page 63 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
5.7. Python Async Inference Tutorial - Multiple Models with Model Sched-
uler
Requirements:
• Run the notebook inside the Python virtual environment: source hailo_virtualenv/bin/
activate
It is recommended to use the command hailo tutorial (when inside the virtualenv) to open a Jupyter
server that contains the tutorials.
In this example we will use the Model Scheduler to run inference on multiple models. Each model is represented by
an HEF which is built using the Hailo Dataflow Compiler. An HEF is Hailo’s binary format for neural networks. The HEF
files contain:
• Target HW configuration
• Weights
The Model Scheduler is an HailoRT component that comes to enhance and simplify the usage of the same Hailo device
by multiple networks. The responsibility for activating/deactivating the network groups is now under HailoRT, and
done automatically without user application intervention. In order to use the Model Scheduler, create the VDevice
with scheduler enabled, configure all models to the device, and start inference on all models:
[ ]: # Optional: define a callback function that will run after the inference job is done
# The callback must have a keyword argument called ”completion_info”.
# That argument will be passed by the framework.
def example_callback(completion_info, bindings):
if completion_info.exception:
# handle exception
pass
_ = bindings.output().get_buffer()
[ ]: import numpy as np
from functools import partial
from hailo_platform import VDevice, HailoSchedulingAlgorithm, FormatType
number_of_frames = 4
timeout_ms = 10000
def infer(multi_process_service):
# Create a VDevice
params = VDevice.create_params()
params.scheduling_algorithm = HailoSchedulingAlgorithm.ROUND_ROBIN
params.group_id = ”SHARED”
if multi_process_service:
params.multi_process_service = multi_process_service
Page 64 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
infer_model.set_batch_size(2)
bindings.output().set_buffer(np.empty(infer_model.output().shape).
,→astype(np.float32))
# Wait for the async pipeline to be ready, and start an async inference job
configured_infer_model.wait_for_async_ready(timeout_ms=10000)
The models can be run concurrently using either multiple Thread objects or multiple Process objects
pool = [
Thread(target=infer, args=(False,)),
Thread(target=infer, args=(False,))
]
print('Done inference')
If the models are run in different processes, the multi-process service must be enabled first.
pool = [
Process(target=infer, args=(True,)),
Process(target=infer, args=(True,))
]
Page 65 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
print('Done inference')
Page 66 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
6. Running Inference
The following section covers several use cases of the inference process. Inference is the process in which the host
sends the data to the Hailo device (and its NN Core) and receives the output from it.
Configure device
from HEF
Activate network
group
Figure 7. Illustration of an inference flow with the Hailo device. The first stages are common to all application archi-
tectures. The last stages, with the light blue background, are architecture dependent. Three architectures are shown:
C/C++ application, multi-process Python application and single process Python application.
Page 67 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
6.1.1. Preparation
In order to start working with the device, the user opens the device and the HEF file (or files). The user then configures
the device from the HEF and activates one of the network groups.
Note: In most simple use cases, there is a single network group. When there are multiple network groups, for
example when multiple HEFs are loaded, the user can choose which one to load.
Once the HEF files are downloaded to the Hailo chip and a network group is activated, the device is ready to start
running data. To start running data the following steps are required:
Pre-Inference Prepare the data to be sent to the chip (For example quantizing the images).
Post-Inference Ensure the data is returned in the format expected by the host.
There are two different methods for working with the inference in Python:
Infer (Blocking) A blocking function that wraps all the four steps mentioned.
Send/recv (Streaming) In this case the user has two processes, each one in charge of the two steps mentioned
above:
• Send - in charge of pre-inference and sending the data from the host to the Hailo chip.
• Recv - in charge of receiving the data from the Hailo chip and post-inference.
A single process should be used to receive the outputs from the device, even if there are multiple output
tensors.
See also:
The Python inference tutorial demonstrates how to run blocking and streaming inference in Python.
Note: In this section we explain the common use case which is multi-thread. For multi-process please refer to
Multi-Process Service.
In C/C++ there is usually no need to open multiple processes. Multiple threads are used instead. Use a thread per
input to commence pre-inference and sending the data. A thread per output is used to receive the data from the
Hailo device and for post-inference.
• Raw streams – Allow low level interactions with the device. They are used to send and receive data in the
same format expected by the hardware. Pre and post-inference stages are done separately by calling dedicated
transformation functions.
• Virtual streams (vstreams) – Provide high level interface that is used to interact with the device. The virtual
streams manage the data transformation (pre and post-inference).
Page 68 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
See also:
The C inference tutorial shows how to run inference in C. It demonstrates how to use both raw streams and virtual
streams.
See also:
The C++ inference tutorial shows how to run inference in C++. It demonstrates how to use both raw streams and virtual
streams.
The Asynchronous Inference API (Async API) is the new and recommended approach for running inference on Hailo
devices. Designed with focus on performance, this API enables the inference of multiple frames without requiring
multiple threads, thereby simplifying the process and improving efficiency. Supported in both C++ and Python, the
Async API allows zero-copy pipelines whenever possible, which optimizes performance and reduces memory usage
and utilization. By avoiding unnecessary memory copies, the Async API achieves better performance and more effi-
cient memory utilization.
• InferModel
– Can be created using a VDevice, and an HEF.
– This instance holds the necessary information for configuring the model for inference and includes meth-
ods for setting and getting the model parameters.
– By calling the configure function, the user can create a ConfiguredInferModel object, which
is used to run inference.
• InferModel::InferStream
– Represents the parameters of a stream.
– By default, the stream parameters are set to the default values of the model (e.g. format-type, format-
order, etc).
– The user can change the stream parameters by calling the set_ functions.
• ConfiguredInferModel
– Configured infer_model holds the asynchronous pipeline, and can be used to perform an asyn-
chronous inference.
– This pipeline should be created once, and can be used multiple times for inference.
– In order to trigger a new asynchronous inference operation, verify that the pipeline can accept a new job
- by using wait_for_async_ready().
• ConfiguredInferModel::Bindings
– Represents an asynchronous inference request - holds the input and output buffers of the request.
– This instance holds a reference to the input and output buffers, so its the user’s responsibility to keep
the buffers intact until the end of the asynchronous operation.
• AsyncInferJob
– Asynchronous inference job representation, used to manage and control an inference job that is running
asynchronously.
– When creating an AsyncInferJob, the user can pass a callback, which will be called when the async
operation is done.
– Information about the async operation can be found in the completion_info (in-parameter for the
callback).
Page 69 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: The Async API is a new API and therefore current existing applications which already use the synchronous API
- need to be updated (both functions and structure) in order to use this API.
For tutorials, see basic Async inference and advanced Async inference.
For tutorials, see Python single process inference tutorial and Python multi process inference tutorial.
For further documentation, refer the the class InferModel and below, under the Python API documentation.
HailoRT supports a Virtual Device - hailort::VDevice interface which encapsulates multiple devices into one
instance. Controlling the underlying physical-devices of a VDevice is done using hailo_vdevice_params_t:
:device_count and hailo_vdevice_params_t::device_ids.
Using the VDevice interface enables other HailoRT features such as Model Scheduler, Multi-Process Service and Stream
Multiplexer, and therefore it is recommended to use this interface also with just one physical device.
• The Network groups switching using HailoRT Model Scheduler – The Model scheduler is a HailoRT com-
ponent that comes to enhance and simplify the usage of the same Hailo device by multiple networks. The
responsibility for activating/deactivating the network groups is now under HailoRT, and done automatically
without user application intervention. In order to use the Model Scheduler, create the VDevice with scheduler
enabled, configure all models to the device, and let HailoRT do the rest.
Page 70 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• The manual user controlled switching mechanism which allows the user to switch between several models
manually. In order to do it, first both models are configured and the first one is activated. When the switch
should take place, the first model is de-activated and the second model is activated.
• The compiling models together mechanism allows to run multiple models by automatically switching be-
tween models that were compiled together using the DFC join() API, which constitute the full model.
The Model Scheduler’s behavior and performance is controlled using the following parameters:
• Configured network group batch-size affects the size of the networks group’s input and output queues. The
larger the batch-size parameter, the larger the queues. For multi context models the the actual infer batch will
be up to the batch-size.
• Model Scheduler threshold is the minimum required number of inference requests, before the network group
is eligible to be scheduled (unless the timeout has passed). Default is 0. Once the scheduler switches to the
new model, it will infer all available frames in its queues, even if they are more than the threshold.
hailo_set_scheduler_threshold()
To modify this parameter, use (C) or hailort::
ConfiguredNetworkGroup::set_scheduler_threshold() (C++).
• Model Scheduler timeout is the maximum time period [ms] that may pass before a configured network group
is scheduled. This counter is reset when the network group is activated, and at least one frame is sent to it.
Default is 0ms.
use hailo_set_scheduler_timeout()
To modify this parameter, (C) or hailort::
ConfiguredNetworkGroup::set_scheduler_timeout() (C++).
• Model Scheduler priority determines the relative importance of the network. When the scheduler comes to
select the next network to run it first looks at the the priority of the network. That means that, the scheduler will
first evaluate all the networks that have the same highest priority, and if non can be selected then it will move to
consider lower priority networks. By default, the priority level is set to HAILO_SCHEDULER_PRIORITY_NORMAL.
hailo_set_scheduler_priority()
To modify this parameter, use (C) or hailort::
ConfiguredNetworkGroup::set_scheduler_priority() (C++).
Page 71 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: The Model Scheduler default behavior is using round-robin scheduling scheme with default values of threshold
(0) and timeout (0ms). These defaults will schedule each network as soon as it receives a single frame.
When examining the scheduler behavior and performance we always need to keep in mind that it is all about tradeoffs:
Memory vs Performance and FPS vs Latency.
The scheduler monitors the fullness of each network’s low-level input and output queues (these queues are the buffer
queues that reside just before and after the HW) and determine if the associated network needs and can be activated.
The scheduler also monitors how much time has passed from the last time it was activated. The network is considered
ready for activation if one of its activation criteria is reached. The network is considered able for activation if it has
enough free space in its output queues.
Batch-size: The first step that will improve performance and make the other configurations more effective is to
make the input and output queues larger by increasing the batch-size. Large queues improve performance by
performing any of the following steps:
1. Pre and post processing can run in parallel to the actual HW inference.
2. Pre and post processing can run while the network is deactivated.
3. Once the network is activated more frames are ready to be inferred immediately, so the inference is more
effective.
1. HailoRT consumes more host memory (in particular DMA-able memory which may be limited in some
platforms).
The following parameters are activation parameters that take effect when the network needs to be activated:
Threshold (TH): The TH controls the number of frames that will be accumulated inside the input queue before the
network should be activated. Since the TH is measured against the queue’s fullness then the larger the input
queue the more configuration options we have.
Page 72 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
2. The higher the TH the more frames will be accumulated so each time the network is activated the infer-
ence will be more effective.
3. The higher the TH the more frames will be accumulated so the latency will be higher.
Timeout (TO): The TO controls the maximum time from the last time the network was activated. Even if there are
not enough frames in the input queue (a minimum of 1 frame is required) but enough time has passed the
network will be activated in order to limit the latency, which may increase as a result of high TH.
Priority: The priority reflects the relative importance of each network. Networks with a higher priority will be given
priority during selection, resulting in better performance and longer running time for these networks.
2. Giving higher priority will enhance both the latency and the FPS rates.
3. Increasing the priority of a network will impact the performance of other networks.
4. When the priority of a network is increased, it may cause starvation to other networks if the higher-priority
networks are always ready to run (reach their TH or TO).
1. For multi model scheduling we can set the TH to aggregate more frames before the network is scheduled, doing
this will make the inference more effective but will raise the overall latency.
2. Using the TH we can perform “soft” prioritization, a smaller TH value will cause the network to be scheduled
more often.
3. To limit the latency of the network inference the TO parameter can be set to ensure that a network will be
scheduled for running if it has at least a single frame in its input queue and enough time has passed from its
previous activation.
4. To enable the schedule to be more effective, we need to make the input and output queues larger so more
frames can be accumulated and thus we can parallel the host’s pre and post processing to the actual inference.
The tradeoff of this is consuming more memory.
The Model Scheduler enables Stream Multiplexer which automatically aggregates different streams of the same
model, and saves the model’s activation/deactivation times.
Page 73 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The Multi-Process Service enables the ability to manage and share a Hailo device between multiple processes, thus
providing the ability to use multi-process inference.
Installation
When using the Ubuntu installer or a Docker Container, the multi-process service is installed by default with libhailort.
Source Compilation
To compile the multi-process service with libhailort, use the compilation flag HAILO_BUILD_SERVICE:
Note: Some Linux distributions are delivered without the init system systemd, which is required for the multi-
process service. In such a case, it is possible to run the service using the compiled executable hailort_service.
Enable Service
Once the multi-process service is installed, to enable it, run (now starts the service)
Page 74 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The environment variables for HailoRT service are defined in the file /etc/default/hailort_service:
Setting environment variables for HailoRT service when working with a Docker Container
To see the options for enabling environment variables in HailoRT service, run:
./run_hailort_docker.sh help
./hailo_sw_suite_docker_run.sh help
Example for enabling environment variables inside the HailoRT Docker Container:
Usage
• To create a shared VDevice with the service, use the same hailo_vdevice_params_t::group_id
and enable hailo_vdevice_params_t::multi_process_service
• When using hailortcli run for inference with multi-process service, use the multiprocess
service flag
• When using HailoNet GStreamer element, use the multiprocessservice property
To compile the multi-process service with libhailort, use the compilation flag HAILO_BUILD_SERVICE:
Note: For more information about how to compile sources on Windows please see Windows compile from sources
To install the multi-process service run the hailort_service executable with the flag install.
bin\windows.AMD64.Release\Release\hailort_service.exe install
Page 75 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Start Service
sc start hailort_service
The HailoRT environment variables are used to enable/disable different features. The environment vari-
ables for HailoRT Windows service are defined in the script hailort\hailort_service\windows\
hailort_service_env_vars.bat.
To change an environment variable value, do the following:
Page 76 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
1. Under the hailo command – Python based tools that require a Python environment. When using a Python
virtual environment, it should be activated before running any of the hailo tools.
2. Under the hailortcli command – Native (C++ based) tools that don’t depend on Python.
hailortcli help
hailo help
Note: For additional information and parameters of the sub-commands, use help.
The scan tool is used to scan all the devices that are connected to the host. It scans the PCIe hierarchy (or Ethernet
port) for connected Hailo devices. If found, it will retrieve the bus/device/ function (or IP address) of the device. This
tool supports both PCIe and Ethernet interfaces.
hailortcli scan
hailo scan
Note: The interfaceip flag of this command refers to the IP address of the host’s interface that is connected
to the Hailo device. It does not refer to the address of the Hailo device itself.
The parsehef tool is used for parsing an existing HEF file and getting information about its content, such as
input/output formats and type, singe/multi context, and so on.
Page 77 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
7.3. Inference
The run tool is used for inference. It loads a given HEF to the device and then sends and receives data. While running,
it performs several measurements such as FPS and power. It can also control the running mode:
The batchsize option of this tool sets the batch size in case of context switch, which means after how many
frames a context switch will take place. It should not be confused with the framescount option that sets the
total frame count to be sent to the device.
Note: framescount sets the total frame count, and must be dividable by batchsize.
Note: When using measurelatency, the HW Latency value measured is the time period between when
the frame started to be sent to device until the frame was received on the host.
When using measurelatency measureoveralllatency, the value measure is the time period
between when the application started to send the frame, and when the application finished receiving the frame
(including format reordering, quantization if needed, etc.).
For most use cases and benchmarks, it is recommended to use measurelatency measure
overalllatency.
run2 is a new subcommand used to run inference over multiple networks simultaneously using the model scheduler.
The advantage of run2 over run is in its parameters – run2 allows to individually control the parameters per
network and per vStream within the network (see hailortcli run2 help), for example:
Note: This command replaces collect-runtime-data which is used with hailortcli run for collecting runtime
data for the previous Model profiler version.
The measurefwactions option of the inference tool creates a JSON file, run
time_data_<hef_name>.json, which can be used by the Model Profiler, in order to augment it with
runtime data (see Dataflow Compiler documentation).
for example:
Page 78 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Notes:
• In a case where no batchsize was provided, the command will run inference and measure on the
batch sizes 1,2,4,8,16 - all of them in a single json file
• Since themeasurefwactions option includes also FPS measurement, it excludes the options
measurelatency and measureoveralllatency
The dot option (DOT - graph description language), if set, prints the pipeline graph as a .dot file at the specified path,
which can be used to analyze the current pipeline. This format is textual, and can be converted to an image (e.g.
.png/.svg) using DOT, an executable provided by Graphviz, which is available on Ubuntu.
To get the full-detailed pipeline graph, run an example HEF with the measurements flag:
This runs inference on example.hef using VStreams (by default). After the inference is complete, a .csv file containing
the gathered statistics collected from the VStream pipeline elements is created, and a .dot file containing the pipeline
graph is written to output_path.dot.
Thehailortcli benchmark tool measures performance on a compiled network. This tool wraps the
hailortcli run tool and makes it easier to perform the full set of measurements for a given HEF. While running,
it performs several measurements such as FPS, latency and power. The FPS measurement is performed twice: first,
when taking only the Hailo device into account (“hardware only”) and second, when taking the full system into account
- including the host.
• The batchsize option of this tool sets the batch size in case of context switch, which means after how
many frames a context switch will take place.
Page 79 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• In some cases, the benchmarking results might slightly vary depending on input data. To generate your own
data, see Using Datasets from the Hailo Model Zoo. The inputfiles flag is used to provide the data-file
path.
7.5. Monitor
The monitor command prints to the screen information about the models and devices which are currently running.
The information is updated every second and is presented in three tables:
2. The second table shows general information about the running models:
• PID – Process id
3. The third table shows the frames state for each stream of each model:
• For host-to-device stream it will show the number of frames that can be queued, and the number of
frames pending to be written to the device.
• For device-to-host stream it will show the number of frames that can be queued, and the number of
frames that were read from the device and are pending to be read by the user.
Usage steps:
hailortcli monitor
Note: Monitor will only work when the scheduler is active (i.e., when using VDevice).
Note: In order to use monitor while using the multi-process service, update the file
/etc/default/hailort_service
as specified in Multi-Process Service.
Page 80 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The HailoRT profiler is an html-based visualization tool, designed to allow users to see how the Model Scheduler
behaves in their pipeline, and therefore allowing users to identify pipeline bottlenecks.
The intention is to allow better ease of use for HailoRT - with a quicker visual feedback when building and optimizing
pipelines.
Note: In order to use the HailoRT Profiler - the Dataflow Compiler must be installed on the same machine. Therefore,
it is recommended to use the HailoRT profiler with the Hailo AI Software Suite. It is not recommended to use the
HailoRT profiler on week or embedded hosts.
Usage steps:
Note: This might affect pipeline performance. A high number of events is gathered - so it is recom-
mended enable the tracing for short pipelines (under a minute).
After enabling the tracer and running a pipeline, a file of the type .hrtt will be created, e.g.
hailort_20240708_165830.hrtt
2) With the Dataflow Compiler installed, run hailo runtimeprofiler <.hrtt file> - and an
html profiler report file will be opened.
The fwconfig tool allows reading and writing the firmware configuration. This operation supports both PCIe and
Ethernet interfaces. For more information please see User configuration documentation.
Run one of the following commands in the Linux terminal to display the tool’s help message:
Reading the firmware configuration can be done by executing one of the following:
This will return a JSON string that contains the current configuration. The output can be written to a file, for example:
Page 81 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
In the case where a user config is already loaded, the easiest method is to change the configuration, that is to to read
it, modify it, and then write the updated JSON file. Use the following steps:
If the configs are not already loaded, the reading will fail. In that case, a sample user config at hailort/
hailortcli/example_config.json, or it’s symbolic link platform/hailo_platform/
tools/hailocli/example_config.json, can be used as a reference. Further instructions will
refer to the given json as config.json but are relevant for the example_config.json as well. For
further information about the user config optional fields, please refer to the User configuration documentation.
The changes are only written to the Flash or EEPROM so a restart is required for the changes to take effect.
The fwlogger tool allows to write the fw-logs to a binary file , which can be later parsed with Hailo costumer
support. This operation is supported only via PCIe interface.
By default, the command appends the log entries to the end of the file. For overwriting the file, use the
overwrite flag.
Note: For running control operations on all existing devices over PCIe interface, use s *.
Page 82 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Identify
The identify operation is used to present details about a device. This operation supports both PCIe and Ethernet
interfaces.
Reset
The reset operation is used to reset a device. There are three different reset types:
• soft reset – resets the firmware of the chip. A reset of the NN core is done as a part of this process. Supported
only for Hailo-8 devices.
• forced_soft reset – same as soft reset, but will be performed even if some failure happened in the closing flow
that is made as part of the reset.
• hard reset – a full reset of the Hailo chip - supported only for Hailo-8 Ethernet devices
Hard reset is supported only via the Ethernet interface. NN core reset is supported in both PCIe and Ethernet inter-
faces.
The following tools are only applicable when using the Ethernet interface of the device.
When using the Ethernet interface and a board with flash storage, the firmware update is performed over Ethernet.
The update process is verified before finishing, so in case of failure it is safe to rerun the update.
By default, the board restarts after updating. This behavior can be canceled using the skipreset flag.
Note: This tool is applicable only when using the Ethernet interface. When using the PCIe interface, the PCIe driver
is responsible to load the correct firmware version.
Note: In all of the examples, 1.2.3.4 represents the IP address of the target device.
Page 83 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The udplimiter tool allows to limit the UDP communication rate with a given board. When using UDP dataflow,
the user may need to limit the bandwidth in order to keep in pace with the neural network core. This command uses
the linux tc command on the host to configure Linux’s qdisc mechanism, and therefore, requires sudo.
Set
The set operation will limit to UDP rate to the number of kilo-bits specified in the kbitrate argument.
Reset
The reset operation will cancel the board’s UDP rate limitation.
Autoset
The autoset operation will determine the necessary UDP rate limitation based on an HEF and a desired FPS rate
specified in fps. The limitation takes into account the input/output throughput of the HEF.
The Ethernet interface related shell scripts are provided in GitHub. The scripts are located at hailort/scripts/
.
• configure_interface.sh – This script assigns a manual IP address to the host’s Ethernet interface.
For example:
• configure_ethernet_buffers.sh – This script configures several buffer sizes in the Linux kernel
and the driver to ensure the stability of the UDP data communication with the device. For example:
./configure_ethernet_buffers.sh eth0
./ubuntu_ethernet_statistics.sh eth0
Page 84 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
8. PCIe Driver
In order to work with Hailo device over PCIe, a kernel driver must be installed. The PCIe driver for Linux is an external
kernel module (also known as out-of-tree kernel module).
Normally, the driver is installed from the hailort-pcie-driver.deb or the Yocto recipes (for embedded platforms).
Note: By default, the PCIe driver is installed using the DKMS framework (if installed). This framework automatically
rebuilds the driver when a new kernel is installed.
Manual setup may be required on other platforms (For example - embedded environment without Hailo Yocto layer).
8.1.2. Download
8.1.3. Compilation
Note: In order to compile the driver, a pre-built Linux kernel, including all configuration and headers is required.
To compile the driver locally, run the following commands from the driver source path:
cd linux/pcie
make all
The compiled driver binary will be created in the same directory as hailo_pci.ko.
8.1.4. Cross-Compilation
When cross-compiling the driver, it must be compiled with the exact kernel installed on the target host, including:
2. Same compiler.
3. Same kernel configuration file. The configuration file is named .config, under the kernel source directory.
To ensure these conditions, it is recommended to enable the CONFIG_MODVERSIONS kernel configuration op-
tion. The option ensures that any driver loaded into the kernel is compiled with the exact same kernel version.
Page 85 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
8.1.5. Installation
# Load the driver (needs to be done once, after installation the driver will be loaded�
,→on boot)
./download_firmware.sh
sudo mkdir p /lib/firmware/hailo
sudo mv hailo8_fw.<VERSION>.bin /lib/firmware/hailo/hailo8_fw.bin
8.2. Parameters
The PCIe driver supports parameters that can change the driver’s behavior:
• no_power_mode
• force_desc_page_size
– Must be a power of 2.
• A template file (with the same name) is provided in the driver’s source directory.
2. Define the desired parameters upon loading the driver via modprobe. For example:
Page 86 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
9. SoC Features
During operation, the system continuously monitors the chip’s internal temperature and verifies that the device is
operating within the safe temperature range by executing the following mechanisms:
• Over-temperature protection (always on, kicks in when reaching the temperature AMR)
When the temperature throttling feature is enabled, the FW is monitoring the chip’s junction temperature (Tjunction),
performing frequency throttling (as required) to avoid exceeding the temperature AMR.
To that end the chip’s junction temperature range has been divided to three zones:
• Green Zone - Normal operation (no throttling). The Green Zone’s temperature range is determined by tem
perature_orange_threshold and temperature_orange_hysteresis_threshold.
• Orange Zone - Throttling is active (if enabled) to supervise the chip’s temperature. The Orange
Zone’s temperature range is determined by temperature_orange_threshold, tempera
ture_orange_hysteresis_threshold, temperature_red_threshold and tempera
ture_red_hysteresis_threshold.
• Red Zone - Not safe for operation. The Red Zone’s temperature range is determined by tempera
ture_red_threshold and temperature_red_hysteresis_threshold.
As long as Tjunction remains below the temperature_orange_threshold, the FW remains in the Green
Zone and continues normal operation. After exceeding the temperature_orange_threshold, the FW en-
ters the Orange Zone and decreases the internal clock frequency gradually, from a performance of 100% down to
a performance of 50% and recovers as explained below. In case the temperature_red_threshold is ex-
ceeded, the chip enters the Red Zone, in which the over-temperature protection kicks in, and the input and output
streams will be shut down. Any attempt to open new streams when the device is still on the Red Zone will fail.
In case the chip is cooling down, the FW increases the internal clock frequency gradually, recovering the performance
degradation caused by the thermal throttling. Performance recovery is based on a hysteresis threshold for each of the
corresponding thresholds mentioned above, this is intended to stabilize the throttling process and prevent frequent
clock and zones changes.
The chip changes from the Orange Zone to the Red Zone when Tjunction exceeds tempera
ture_red_threshold and returns to the Orange Zone when Tjunction is lower than tem
perature_red_hysteresis_threshold. The same logic applies when returning from the
Orange Zone to the Green Zone, with temperature_orange_threshold and tempera
ture_orange_hysteresis_threshold respectively.
The parameters temperature_orange_threshold, temperature_orange_hysteresis_threshold,
temperature_red_threshold and temperature_red_hysteresis_threshold can be over-
written by the User configuration, although adjusting them is not recommended.
Page 87 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Current is also monitored continuously, and overcurrent throttling is enabled by default and should not be
disabled.
The firmware has various settings that can be managed by the user. This configuration is stored on the board’s flash
or EEPROM memory. It is read at boot time and contains several entries such as IP address, MAC address, and board
name. The configuration consists of several sections, for example:
• Network – controls network parameters such as DHCP usage (boolean), MAC address, static IP address, static
gateway address, and static netmask.
– name – contains the board name. This name is used for identification.
– max_neural_network_core_clock_rate – sets the clock rate of the neural network core.
The supported values for this field are 100, 200 and 400 MHz, but it cannot raise the clock rate above the
maximum supported value for each board or module.
Page 88 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
CLK rate
Nominal
clk freq
‘light’
throttling
‘Medium’
Throttling
‘Heavy’
Throttling
Th0_h Th0 Th1_h TH1 Th2_h Th2
Temperature
all other conditions are met). All values are given in degree Celsius. Adjusting this parameter is not
recommended.
Warning: Temperature and overcurrent throttling should remain enabled, disabling the features should
occur only in special cases.
• Control – includes the udp_port field, which is used for changing the control port. Typically this is left at the
default value.
{
”network”: {
”static_ip_address”: ”10.0.0.1”,
”static_netmask”: ”255.255.255.0”,
”should_use_dhcp”: false,
”mac_address”: ”80:00:DE:AD:BE:EF”
},
”system”: {
”name”: ”Hailo8 Test”,
”max_neural_network_core_clock_rate”: ”100MHZ”,
”overcurrent_parameters_source”: ”USER_CONFIG_VALUES”,
”overcurrent_monitoring_red_threshold”: 1100,
(continues on next page)
Page 89 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
”overcurrent_conversion_time_microseconds”: 140
}
}
This example configuration sets several fields related to networking such as IP and MAC addresses. These are appli-
cable when the device is connected through the ethernet interface. They are not applicable for the mPCIe and M.2
modules.
In addition, the clock rate of the neural network core is reduced to 100 MHz in order to consume less power. This
example also changes the parameters of the mPCIe and M.2 modules over current protection.
For additional information regarding reading or editing the user config please refer to the Firmware configuration tool
doc.
The difference between these two modes is the PCIe data-transfer size. In performance power mode - each PCIe data
transfer is larger, allowing the PCIe data lanes to remain quiet for a longer duration and as a result switch to deeper
PCIe power states in case the PCIe ASPM (Active-State Power Management) mode is enabled (leads to lower power
consumption). This is the default working mode. In contrast to that, in ultra-performance power mode, each PCIe
data transfer is smaller, and therefore might not be long enough to allow switching to a lower power state.
Note that in some cases, working in the ultra-performance power mode might lead to increased performance (at the
cost of power) when compared to the default performance power mode. This might be the result of other system
flows, such as the CPU entering a C-state low power mode due to the transfer size changes. To maximize performance
it is possible to enable ultra-performance power mode.
Page 90 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
10. Yocto
This section will guide through the integration of Hailo’s Yocto layers into your own Yocto environment.
The layers are stored in Meta-Hailo GitHub, with a branch for each supported yocto release:
The instructions were written after being tested on the DART-MX8M embedded platform.
10.1.1. HailoRT
10.1.2. TAPPAS
• metahailotappas - contains TAPPAS recipes including libgsthailotools and tappas-apps. More details
about these recipes, how to setup and integrate them, can be found on the TAPPAS documentation.
10.2.1. Libhailort
Hailo’s API for running inference on the Hailo chip. The recipe compiles libhailort shared-object into the target device’s
root file system (/usr/bin)
10.2.2. Hailortcli
Hailortcli is a command line utility wrapper for libhailort operations, including inference fw controls, measurements
and more.
10.2.3. Pyhailort
Hailo’s python API. The recipe compiles pyhailort shared object, unpacks the python directory, and uses setup
tools to install into python/sitepackages on the target device’s root file system.
The recipe depends on all the python recipes under metahailo/recipespython/.
Python dependencies:
Page 91 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
10.2.4. Libgsthailo
Hailo’s GStreamer plugin for running inference on the Hailo chip. Depends on libhailort and GStreamer. The
recipe compiles and copies the libgsthailo.so file to /usr/lib/gstreamer1.0 on the target device’s
root file system, enabling it to be loaded by GStreamer as a plugin.
10.3.1. Hailo-Firmware
Hailo-8 firmware (hailo8_fw.bin). The recipe copies the file to the /lib/firmware/hailo directory on
the target device’s root file system.
Note: For development with the Ethernet interface , it is possible to use the Ethernet-firmware recipe. This recipe is
not mandatory for deployment, since in Ethernet cases – the firmware is loaded from flash.
10.4.1. Hailo15-Nnc-Fw
Hailo-15 NNC (neural network core) firmware (hailo15_nnc_fw.bin). The recipe copies the file to the /lib/
firmware/hailo directory on the target device’s root file system.
10.4.2. Hailo-Integrated-Nnc
Compiles Hailo-15’s NNC (neural network core) driver and installs it. The source files can be found at GitHub.
Page 92 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
2. After cloning meta_hailo, checkout a specific branch, for example (for Dunfell)
cd metahailo
git checkout dunfell
3. The Yocto directory of all supported Yocto releases includes the meta-hailo layers. Open the directory of your
required Yocto release and copy the meta-hailo layer directory to your sources directory (same directory as
poky, meta-openembedded etc.). Then add it to your conf/bblayers.conf like so:
BBLAYERS += ” ${BSPDIR}/sources/metahailo/metahailoaccelerator \
${BSPDIR}/sources/metahailo/metahailolibhailort”
/local
yoctodunfell/
build_xwayland/
conf/
local.conf
bblayers.conf
cache/
tmp/
workspace/
setupenvironment
README
sources/
poky/
metahailo/
metahailolibhailort/
metahailoaccelerator/
metaopenembedded/
Make sure that the following conditions have been met on the target device:
Page 93 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Recipe Details
libhailort Libhailort exists at: /usr/lib/libhailort.so
hailortcli hailortcli command works from the global environment. After con-
necting the hailo8 chip – scan and run commands should communicate
with the board.
pyhailort Python3 includes the hailo_platform module and all dependent
modules.
hailo command works from the global environment. After connecting
the hailo8 chip – fwcontrol identify recognizes it and prints
information.
libgsthailo Running gstinspect1.0 | grep hailo returns hailo ele-
ments:
hailo: hailonet: hailonet element
hailodevicestats: hailodevicestats element
Recipes in Yocto may be built offline, if the source code was previously collected on a machine that was connected to a
network. The sources collected for the desired recipes will be found at $DL_DIR and they are suitable for mirroring
(see DL_DIR and source mirrors for more information).
It is assumed that a Yocto environment exists on a machine with network access, which will be used to collect sources
for the desired recipes. These sources will be copied to an offline machine with a Yocto environment, which will be
used to build the aforementioned recipes. See Usage Example for detailed instructions.
The prepare_hailort_external_dependencies task will collect the recipe’s sources and external de-
pendencies, packaging them in a .tar file in $DL_DIR. The following recipes implement this task:
• libhailort
• libgsthailo
• hailortcli
• pyhailort-shared
Two environment variables control the offline build flow of HailoRT recipes:
• HAILORT_OFFLINE_BUILD_ENABLE - Set to “1” to run the offline build flow, both on the machine with
network access (that is used to collect sources) and the offline machine (that is used for building).
Note: If this variable is set to “1”, the $DL_DIR isn’t suitable for sharing between parallel builds
of HailoRT recipes.
Page 94 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
The steps outlined in Integrating with an Existing Yocto Environment are to be run prior to this example. It is assumed
that we are operating with the directory structure described above.
source poky/oeinitbuildenv
3. Collect sources for the the desired hailort recipes. In this example, sources for the libhailort and
hailortcli recipes are collected.
1. Collect sources for the desired hailort recipes using runall=fetch:
3. Collect any other sources needed for the image. Sources for coreimageminimal are col-
lected in this example:
• The contents of $DL_DIR can now be copied to a machine without network access, where they can be built.
For example, building the libhailort and hailortcli recipes is done as follows on a machine without
network access:
source poky/oeinitbuildenv
3. Copy the $DL_DIR created on the machine with network connection to the $DL_DIR used on the
offline machine.
Page 95 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– BB_NO_NETWORK = ”1” - In order to validate that no network access is made by bitbake (see
BB_NO_NETWORK).
Page 96 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
11.1. GStreamer
GStreamer multimedia framework is a framework for creating streaming media applications. GStreamer’s develop-
ment framework makes it possible to write any type of streaming multimedia application. The GStreamer framework
is designed to make it easy to write applications that handle audio or video or both. It isn’t restricted to audio and
video and can process any kind of data flow. The framework is based on plugins that will provide various codecs and
other functionality. The plugins can be linked and arranged in a pipeline. This pipeline defines the flow of the data.
The GStreamer core function is to provide a framework for plugins, data flow, and media type handling/negotiation.
It also provides an API to write applications using the various plugins.
Hailo’s application framework for optimized execution of video-processing pipelines (TAPPAS) is GStreamer based.
11.1.1. HailoNet
Important Parameters
• In order to share resources between multiple HailoNet elements, use the same vdevicegroupid on
each HailoNet element.
Note: In order to share resources between different processes, multiprocessservice needs to be en-
abled.
• If the pipeline contains a single HailoNet element, then that single HailoNet will be activated by default, Other-
wise, each HailoNet element must explicitly specify if it is active or not by setting the is_active property.
This property can also be used for switching the activated networks on a specific device during runtime.
Note: When Model Scheduler is enabled, the is_active property should not be passed.
• For multi-context networks - the batchsize property can be used to specify the batch size.
ONNX Runtime is a cross-platform inference and training machine-learning accelerator, which allows to inference
ONNX models on various supported platforms.
Hailo ONNX Runtime is a fork of ONNX Runtime modified to work on Hailo devices.
Page 97 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
Part II
API Reference
Page 98 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: ethernet devices are not considered “devices in the system”, so they are not scanned in this function.
use :hailo_scan_ethernet_devices for ethernet devices.
Parameters
• params – [in] Scan params, used for future compatibility, only NULL is allowed.
• device_ids – [out] Array of hailo_device_id_t to be fetched from vdevice.
• device_ids_length – [inout] As input - the size of device_ids array. As output - the
number of device scanned.
Note: To release a device, call the hailo_release_device function with the returned hailo_device.
Parameters
• device_id – [in] Device id, can represent several device types: [-] for pcie devices - pcie
bdf (XXXX:XX:XX.X or XX:XX.X) [-] for ethernet devices - ip address (xxx.xxx.xxx.xxx) If NULL
is given, uses an arbitrary device found on the system.
• device – [out] A pointer to a hailo_device that receives the allocated PCIe device.
Returns Upon success, returns Expected of a unique_ptr to Device object. Otherwise, returns Un-
expected of hailo_status error.
Parameters
• number_of_devices – [out] This variable will be filled with the number of devices.
If the buffer is insufficient to hold the information a HAILO_INSUFFICIENT_BUFFER error is
returned.
Page 99 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Note: To release a device, call the hailo_release_device function with the returned hailo_device.
Parameters
• device_info – [in] Information about the device to open. If NULL is given, uses an
arbitrary device found on the system.
• device – [out] A pointer to a hailo_device that receives the allocated PCIe device.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns an hailo_status error.
Parameters
• number_of_devices – [out] This variable will be filled with the number of devices.
If the buffer is insufficient to hold the information a HAILO_INSUFFICIENT_BUFFER error is
returned.
Note: To release a device, call the hailo_release_device function with the returned hailo_device.
Parameters
Page 100 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Page 101 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Page 102 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Parameters
Page 103 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Parameters
Page 104 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
• data – [in] Pointer to a buffer that would store the read data.
• length – [in] The number of bytes to read into the buffer pointed by data.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns an hailo_status error.
Parameters
Parameters
Page 105 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Note: To release a vdevice, call the hailo_release_vdevice function with the returned hailo_vdevice.
Parameters
Page 106 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• network_groups – [out] Array of network_groups that were loaded from the HEF file.
• number_of_network_groups – [inout] As input - the size of network_groups ar-
ray. As output - the number of network_groups loaded.
Note: The returned physical devices are held in the scope of vdevice.
Parameters
Note: The returned physical devices are held in the scope of vdevice.
Parameters
Page 107 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: To release an HEF, call the hailo_release_hef function with the returned hef.
Parameters
Note: To release an HEF, call the hailo_release_hef function with the returned hef.
Parameters
Parameters
• name – [in] The name of the network or network_group which contains the stream_infos.
In case network group name is given, the function returns all stream infos of all the
networks of the given network group. In case network name is given (provided by
hailo_hef_get_network_infos), the function returns all stream infos of the given network. If
NULL is passed, the function returns all the stream infos of all the networks of the first
network group.
Page 108 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
Parameters
Parameters
• name – [in] The name of the network or network_group which contains the virtual stream
infos. In case network group name is given, the function returns all virtual stream infos
of all the networks of the given network group. In case network name is given (provided
by hailo_hef_get_network_infos), the function returns all stream infos of the given network.
If NULL is passed, the function returns all the stream infos of all the networks of the first
network group.
Parameters
Parameters
Page 109 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Page 110 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• bottleneck_fps – [out] Bottleneck FPS. Note: This is not relevant in the case of multi
context.
Note: There are two options to limit the rate of an ethernet input stream to the desired bandwidth:
• On Unix platforms:
– You may use the command line tool hailortcli udpratelimiter instead of using this
API
Parameters
Parameters
Page 111 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Parameters
Page 112 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• network_groups – [out] Array of network_groups that were loaded from the HEF file.
• number_of_network_groups – [inout] As input - the size of network_groups ar-
ray. As output - the number of network_groups loaded.
Parameters
Parameters
Parameters
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
Page 113 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
Parameters
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
Note: Calling this function is optional, and it is used to shutdown network group while there is still ongoing
inference.
Parameters
Page 114 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Note: The new time period will be measured after the previous time the scheduler allocated run time to this
network group.
Note: Currently, setting the timeout for a specific network is not supported.
Page 115 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: The timeout may be ignored to prevent idle time from the device.
Parameters
Note: The default threshold is 0, which means HailoRT will apply an automatic heuristic to choose the thresh-
old.
Note: Currently, setting the threshold for a specific network is not supported.
Note: The threshold may be ignored to prevent idle time from the device.
Parameters
Page 116 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Currently, setting the priority for a specific network is not supported.
Parameters
• network_name – [in] Network name for which to set the priority. If NULL is passed,
the priority will be set for all the networks in the network group.
Parameters
• name – [in] The name of the network group or network which contains the input virtual
streams. In case network group name is given, the function returns input virtual stream
params of all the networks of the given network group. In case network name is given (pro-
vided by hailo_hef_get_network_infos), the function returns input virtual stream params of
the given network. If NULL is passed, the function returns the input virtual stream params
of all the networks of the first network group.
Parameters
• name – [in] The name of the network group or network which contains the output vir-
tual streams. In case network group name is given, the function returns output virtual
stream params of all the networks of the given network group. In case network name is
given (provided by hailo_hef_get_network_infos), the function returns output virtual stream
params of the given network. If NULL is passed, the function returns the output virtual
stream params of all the networks of the first network group.
Page 117 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Note: To release input virtual streams, call the hailo_release_input_vstreams function with the returned in-
put_vstreams and inputs_count.
Parameters
Page 118 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: If not creating all output vstreams together, one should make sure all vstreams from the same group
are created together. See hailo_get_output_vstream_groups
Note: To release output virtual streams, call the hailo_release_output_vstreams function with the returned out-
put_vstreams and outputs_count.
Parameters
Parameters
Parameters
Parameters
Page 119 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: In case a single qp is present - the returned list will be of size 1. Otherwise - the returned list will be of
the same length as the number of the frame’s features.
Parameters
Note: In case a single qp is present - the returned list will be of size 1. Otherwise - the returned list will be of
the same length as the number of the frame’s features.
Parameters
Parameters
Parameters
Parameters
Page 120 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• buffer_size – [in] buffer buffer size in bytes. The size is expected to be the size re-
turned from hailo_get_input_vstream_frame_size.
Parameters
Parameters
Page 121 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• buffer_size – [in] dst buffer size in bytes.The size is expected to be the size returned
from hailo_get_output_vstream_frame_size.
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
Parameters
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
Parameters
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
Parameters
Parameters
Parameters
Page 122 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Note: If not all output vstreams from the same group are passed together, it will cause an undefined behavior
. See hailo_get_output_vstream_groups, to get the output vstreams’ groups.
Parameters
Note: the size of each element in input_buffers and output_buffers should match the product of frames_count
and the frame size of the matching hailo_input_vstream / hailo_output_vstream.
Parameters
Page 123 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Parameters
Note: In case a single qp is present - the returned list will be of size 1. Otherwise - the returned list will be of
the same length as the number of the frame’s features.
Parameters
Page 124 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: In case a single qp is present - the returned list will be of size 1. Otherwise - the returned list will be of
the same length as the number of the frame’s features.
Parameters
Note: The output buffer format comes from the format field inside hailo_stream_info_t and the shape comes
from the hw_shape field inside hailo_stream_info_t.
Parameters
Note: The input buffer format comes from the format field inside hailo_stream_info_t and the shape comes
from the hw_shape field inside hailo_stream_info_t.
Page 125 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• timeout_ms – [in] Amount of time to wait until the stream is ready in milliseconds.
Returns Upon success, returns HAILO_SUCCESS. Otherwise:
• If timeout_ms has passed and the stream is not ready, returns HAILO_TIMEOUT.
Parameters
• timeout_ms – [in] Amount of time to wait until the stream is ready in milliseconds.
Returns Upon success, returns HAILO_SUCCESS. Otherwise:
• If timeout_ms has passed and the stream is not ready, returns HAILO_TIMEOUT.
Parameters
Parameters
Page 126 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If the function call succeeds (i.e., hailo_stream_read_raw_buffer_async returns HAILO_SUCCESS), the deferred
operation has been initiated. Until user_callback is called, the user cannot change or delete buffer.
• If the function call fails (i.e., hailo_stream_read_raw_buffer_async returns a status other than
HAILO_SUCCESS), the deferred operation will not be initiated and user_callback will not be invoked.
The user is free to change or delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The callback
receives a hailo_stream_read_async_completion_info_t object containing a pointer to the transferred buffer
(buffer_addr) and the transfer status (status). If the operation has completed successfully, the contents of
buffer will have been updated by the read operation.
Note: The output buffer format comes from the format field inside hailo_stream_info_t and the shape comes
from the hw_shape field inside hailo_stream_info_t.
Note: The address provided must be aligned to the system’s page size, and the rest of the page should not be
in use by any other part of the program to ensure proper functioning of the DMA operation. Memory for the
provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on Windows.
Parameters
• size – [in] The size of the given buffer, expected to be the result of
hailo_get_output_stream_frame_size.
• user_callback – [in] The callback that will be called when the transfer is complete
or has failed.
• opaque – [in] Optional pointer to user-defined context (may be NULL if not desired).
Returns Upon success, returns HAILO_SUCCESS. Otherwise:
• If the function call succeeds (i.e., hailo_stream_write_raw_buffer_async returns HAILO_SUCCESS), the deferred
operation has been initiated. Until user_callback is called, the user cannot change or delete buffer.
Page 127 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If the function call fails (i.e., hailo_stream_write_raw_buffer_async returns a status other than
HAILO_SUCCESS), the deferred operation will not be initiated and user_callback will not be invoked. The
user is free to change or delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The callback
receives a hailo_stream_write_async_completion_info_t object containing a pointer to the transferred buffer
(buffer_addr) and the transfer status (status).
Note: The input buffer format comes from the format field inside hailo_stream_info_t and the shape comes
from the hw_shape field inside hailo_stream_info_t.
Note: The address provided must be aligned to the system’s page size, and the rest of the page should not be
in use by any other part of the program to ensure proper functioning of the DMA operation. Memory for the
provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on Windows.
Parameters
• size – [in] The size of the given buffer, expected to be the result of
hailo_get_input_stream_frame_size.
• user_callback – [in] The callback that will be called when the transfer is complete
or has failed.
• opaque – [in] Optional pointer to user-defined context (may be NULL if not desired).
Returns Upon success, returns HAILO_SUCCESS. Otherwise:
Parameters
Page 128 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: To release the transform_context, call the hailo_release_input_transform_context function with the re-
turned hailo_input_transform_context.
Parameters
Note: To release the transform_context, call the hailo_release_input_transform_context function with the re-
turned hailo_input_transform_context.
Parameters
Note: In case transformation_required is false, the src frame is ready to be sent to HW without any transforma-
tion.
Parameters
Page 129 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Note: In case transformation_required is false, the src frame is already in the required format without any
transformation.
Parameters
Page 130 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: To release the transform_context, call the hailo_release_output_transform_context function with the re-
turned hailo_output_transform_context.
Parameters
Note: To release the transform_context, call the hailo_release_output_transform_context function with the re-
turned hailo_output_transform_context.
Parameters
Parameters
Page 131 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: QP will be invalid in case HEF file was compiled with multiple QPs, and then the user will try work-
ing with API for single QP. For example - if HEF was compiled with multiple QPs and then the user calls
hailo_get_input_stream_info, The hailo_quant_info_t object of the hailo_stream_info_t object will be invalid.
Parameters
Note: To release the demuxer, call the hailo_release_output_demuxer function with the returned
hailo_output_demuxer.
Parameters
Note: The order of raw_buffers should be the same as returned from the function
‘hailo_get_mux_infos_by_output_demuxer()’.
Parameters
Page 132 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters
Page 133 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• measurement – [out] The measured value. Measured units are determined due to
hailo_power_measurement_types_t.
Parameters
Parameters
• dvm – [in] Which DVM will be measured. Default (HAILO_DVM_OPTIONS_AUTO) will be dif-
ferent according to the board:
Page 134 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• should_clear – [in] Flag indicating if the results saved at the firmware will be deleted
after reading.
Parameters
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
Parameters
Page 135 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns HAILO_SUCCESS. Otherwise, if the buffer is insufficient to hold the
information a HAILO_INSUFFICIENT_BUFFER would be returned. In any other case, returns a
hailo_status error.
enum hailo_status
Values:
enumerator HAILO_SUCCESS
Success - No error
enumerator HAILO_UNINITIALIZED
No error code was initialized
enumerator HAILO_INVALID_ARGUMENT
Invalid argument passed to function
enumerator HAILO_OUT_OF_HOST_MEMORY
Cannot allocate more memory at host
enumerator HAILO_TIMEOUT
Received a timeout
enumerator HAILO_INSUFFICIENT_BUFFER
Buffer is insufficient
enumerator HAILO_INVALID_OPERATION
Invalid operation
enumerator HAILO_NOT_IMPLEMENTED
Code has not been implemented
enumerator HAILO_INTERNAL_FAILURE
Unexpected internal failure
enumerator HAILO_DATA_ALIGNMENT_FAILURE
Data is not aligned
enumerator HAILO_CHUNK_TOO_LARGE
Chunk too large
enumerator HAILO_INVALID_LOGGER_LEVEL
Used non-compiled level
enumerator HAILO_CLOSE_FAILURE
Failed to close fd
Page 136 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_OPEN_FILE_FAILURE
Failed to open file
enumerator HAILO_FILE_OPERATION_FAILURE
File operation failure
enumerator HAILO_UNSUPPORTED_CONTROL_PROTOCOL_VERSION
Unsupported control protocol version
enumerator HAILO_UNSUPPORTED_FW_VERSION
Unsupported firmware version
enumerator HAILO_INVALID_CONTROL_RESPONSE
Invalid control response
enumerator HAILO_FW_CONTROL_FAILURE
Control failed in firmware
enumerator HAILO_ETH_FAILURE
Ethernet operation has failed
enumerator HAILO_ETH_INTERFACE_NOT_FOUND
Ethernet interface not found
enumerator HAILO_ETH_RECV_FAILURE
Ethernet failed at recv operation
enumerator HAILO_ETH_SEND_FAILURE
Ethernet failed at send operation
enumerator HAILO_INVALID_FIRMWARE
Firmware bin is invalid
enumerator HAILO_INVALID_CONTEXT_COUNT
Host build too many contexts
enumerator HAILO_INVALID_FRAME
Part or all of the result data is invalid
enumerator HAILO_INVALID_HEF
Invalid HEF
enumerator HAILO_PCIE_NOT_SUPPORTED_ON_PLATFORM
PCIe not supported on platform
enumerator HAILO_INTERRUPTED_BY_SIGNAL
Blocking syscall was interrupted by a signal
enumerator HAILO_START_VDMA_CHANNEL_FAIL
Starting VDMA channel failure
enumerator HAILO_SYNC_VDMA_BUFFER_FAIL
Synchronizing VDMA buffer failure
Page 137 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_STOP_VDMA_CHANNEL_FAIL
Stopping VDMA channel failure
enumerator HAILO_CLOSE_VDMA_CHANNEL_FAIL
Closing VDMA channel failure
enumerator HAILO_ATR_TABLES_CONF_VALIDATION_FAIL
Validating address translation tables failure, for FW control use
enumerator HAILO_EVENT_CREATE_FAIL
Creating event failure
enumerator HAILO_READ_EVENT_FAIL
Reading event failure
enumerator HAILO_DRIVER_FAIL
Driver failure
enumerator HAILO_INVALID_FIRMWARE_MAGIC
Invalid FW magic
enumerator HAILO_INVALID_FIRMWARE_CODE_SIZE
Invalid FW code size
enumerator HAILO_INVALID_KEY_CERTIFICATE_SIZE
Invalid key certificate size
enumerator HAILO_INVALID_CONTENT_CERTIFICATE_SIZE
Invalid content certificate size
enumerator HAILO_MISMATCHING_FIRMWARE_BUFFER_SIZES
FW buffer sizes mismatch
enumerator HAILO_INVALID_FIRMWARE_CPU_ID
Invalid CPU ID in FW
enumerator HAILO_CONTROL_RESPONSE_MD5_MISMATCH
MD5 of control response does not match expected MD5
enumerator HAILO_GET_CONTROL_RESPONSE_FAIL
Get control response failed
enumerator HAILO_GET_D2H_EVENT_MESSAGE_FAIL
Reading device-to-host message failure
enumerator HAILO_MUTEX_INIT_FAIL
Mutex initialization failure
enumerator HAILO_OUT_OF_DESCRIPTORS
Cannot allocate more descriptors
enumerator HAILO_UNSUPPORTED_OPCODE
Unsupported opcode was sent to device
Page 138 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_USER_MODE_RATE_LIMITER_NOT_SUPPORTED
User mode rate limiter not supported on platform
enumerator HAILO_RATE_LIMIT_MAXIMUM_BANDWIDTH_EXCEEDED
Rate limit exceeded HAILO_DEFAULT_MAX_ETHERNET_BANDWIDTH_BYTES_PER_SEC
enumerator HAILO_ANSI_TO_UTF16_CONVERSION_FAILED
Failed converting ANSI string to UNICODE
enumerator HAILO_UTF16_TO_ANSI_CONVERSION_FAILED
Failed converting UNICODE string to ANSI
enumerator HAILO_UNEXPECTED_INTERFACE_INFO_FAILURE
Failed retrieving interface info
enumerator HAILO_UNEXPECTED_ARP_TABLE_FAILURE
Failed retrieving arp table
enumerator HAILO_MAC_ADDRESS_NOT_FOUND
MAC address not found in the arp table
enumerator HAILO_NO_IPV4_INTERFACES_FOUND
No interfaces found with an IPv4 address
enumerator HAILO_SHUTDOWN_EVENT_SIGNALED
A shutdown event has been signaled
enumerator HAILO_THREAD_ALREADY_ACTIVATED
The given thread has already been activated
enumerator HAILO_THREAD_NOT_ACTIVATED
The given thread has not been activated
enumerator HAILO_THREAD_NOT_JOINABLE
The given thread is not joinable
enumerator HAILO_NOT_FOUND
Could not find element
enumerator HAILO_COMMUNICATION_CLOSED
The communication between endpoints is closed
enumerator HAILO_STREAM_ABORT
Stream recv/send was aborted
enumerator HAILO_PCIE_DRIVER_NOT_INSTALLED
Pcie driver is not installed
enumerator HAILO_NOT_AVAILABLE
Component is not available
enumerator HAILO_TRAFFIC_CONTROL_FAILURE
Traffic control failure
Page 139 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_INVALID_SECOND_STAGE
Second stage bin is invalid
enumerator HAILO_INVALID_PIPELINE
Pipeline is invalid
enumerator HAILO_NETWORK_GROUP_NOT_ACTIVATED
Network group is not activated
enumerator HAILO_VSTREAM_PIPELINE_NOT_ACTIVATED
VStream pipeline is not activated
enumerator HAILO_OUT_OF_FW_MEMORY
Cannot allocate more memory at fw
enumerator HAILO_STREAM_NOT_ACTIVATED
Stream is not activated
enumerator HAILO_DEVICE_IN_USE
The device is already in use
enumerator HAILO_OUT_OF_PHYSICAL_DEVICES
There are not enough physical devices
enumerator HAILO_INVALID_DEVICE_ARCHITECTURE
Invalid device architecture
enumerator HAILO_INVALID_DRIVER_VERSION
Invalid driver version
enumerator HAILO_RPC_FAILED
RPC failed
enumerator HAILO_INVALID_SERVICE_VERSION
Invalid service version
enumerator HAILO_NOT_SUPPORTED
Not supported operation
enumerator HAILO_NMS_BURST_INVALID_DATA
Invalid data in NMS burst
enumerator HAILO_OUT_OF_HOST_CMA_MEMORY
Cannot allocate more CMA memory at host
enumerator HAILO_QUEUE_IS_FULL
Cannot push more items into the queue
enumerator HAILO_DMA_MAPPING_ALREADY_EXISTS
DMA mapping already exists
enumerator HAILO_CANT_MEET_BUFFER_REQUIREMENTS
can’t meet buffer requirements
Page 140 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_STATUS_COUNT
Must be last!
enumerator HAILO_STATUS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_dvm_options_e
Enum that represents the type of devices that would be measured
Values:
enumerator HAILO_DVM_OPTIONS_VDD_CORE
VDD_CORE DVM
enumerator HAILO_DVM_OPTIONS_VDD_IO
VDD_IO DVM
enumerator HAILO_DVM_OPTIONS_MIPI_AVDD
MIPI_AVDD DVM
enumerator HAILO_DVM_OPTIONS_MIPI_AVDD_H
MIPI_AVDD_H DVM
enumerator HAILO_DVM_OPTIONS_USB_AVDD_IO
USB_AVDD_IO DVM
enumerator HAILO_DVM_OPTIONS_VDD_TOP
VDD_TOP DVM
enumerator HAILO_DVM_OPTIONS_USB_AVDD_IO_HV
USB_AVDD_IO_HV DVM
enumerator HAILO_DVM_OPTIONS_AVDD_H
AVDD_H DVM
enumerator HAILO_DVM_OPTIONS_SDIO_VDD_IO
SDIO_VDD_IO DVM
enumerator HAILO_DVM_OPTIONS_OVERCURRENT_PROTECTION
OVERCURRENT_PROTECTION DVM
enumerator HAILO_DVM_OPTIONS_COUNT
Must be last!
enumerator HAILO_DVM_OPTIONS_AUTO
Select the default DVM option according to the supported features
enumerator HAILO_DVM_OPTIONS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_power_measurement_types_e
Enum that represents what would be measured on the selected device
Values:
enumerator HAILO_POWER_MEASUREMENT_TYPES__SHUNT_VOLTAGE
SHUNT_VOLTAGE measurement type, measured in mV
Page 141 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_POWER_MEASUREMENT_TYPES__BUS_VOLTAGE
BUS_VOLTAGE measurement type, measured in mV
enumerator HAILO_POWER_MEASUREMENT_TYPES__POWER
POWER measurement type, measured in W
enumerator HAILO_POWER_MEASUREMENT_TYPES__CURRENT
CURRENT measurement type, measured in mA
enumerator HAILO_POWER_MEASUREMENT_TYPES__COUNT
Must be last!
enumerator HAILO_POWER_MEASUREMENT_TYPES__AUTO
Select the default measurement type according to the supported features
enumerator HAILO_POWER_MEASUREMENT_TYPES__MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_sampling_period_e
Enum that represents all the bit options and related conversion times for each bit setting for Bus Voltage and
Shunt Voltage
Values:
enumerator HAILO_SAMPLING_PERIOD_140US
enumerator HAILO_SAMPLING_PERIOD_204US
enumerator HAILO_SAMPLING_PERIOD_332US
enumerator HAILO_SAMPLING_PERIOD_588US
enumerator HAILO_SAMPLING_PERIOD_1100US
enumerator HAILO_SAMPLING_PERIOD_2116US
enumerator HAILO_SAMPLING_PERIOD_4156US
enumerator HAILO_SAMPLING_PERIOD_8244US
enumerator HAILO_SAMPLING_PERIOD_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_averaging_factor_e
Enum that represents all the AVG bit settings and related number of averages for each bit setting
Values:
enumerator HAILO_AVERAGE_FACTOR_1
enumerator HAILO_AVERAGE_FACTOR_4
enumerator HAILO_AVERAGE_FACTOR_16
enumerator HAILO_AVERAGE_FACTOR_64
enumerator HAILO_AVERAGE_FACTOR_128
enumerator HAILO_AVERAGE_FACTOR_256
enumerator HAILO_AVERAGE_FACTOR_512
enumerator HAILO_AVERAGE_FACTOR_1024
Page 142 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_AVERAGE_FACTOR_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_measurement_buffer_index_e
Enum that represents buffers on the device for power measurements storing
Values:
enumerator HAILO_MEASUREMENT_BUFFER_INDEX_0
enumerator HAILO_MEASUREMENT_BUFFER_INDEX_1
enumerator HAILO_MEASUREMENT_BUFFER_INDEX_2
enumerator HAILO_MEASUREMENT_BUFFER_INDEX_3
enumerator HAILO_MEASUREMENT_BUFFER_INDEX_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_device_type_t
Hailo device type
Values:
enumerator HAILO_DEVICE_TYPE_PCIE
enumerator HAILO_DEVICE_TYPE_ETH
enumerator HAILO_DEVICE_TYPE_INTEGRATED
enumerator HAILO_DEVICE_TYPE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_scheduling_algorithm_e
Scheduler algorithm
Values:
enumerator HAILO_SCHEDULING_ALGORITHM_NONE
Scheduling disabled
enumerator HAILO_SCHEDULING_ALGORITHM_ROUND_ROBIN
Round Robin
enumerator HAILO_SCHEDULING_ALGORITHM_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_device_architecture_e
Device architecture
Values:
enumerator HAILO_ARCH_HAILO8_A0
enumerator HAILO_ARCH_HAILO8
enumerator HAILO_ARCH_HAILO8L
enumerator HAILO_ARCH_HAILO15H
enumerator HAILO_ARCH_PLUTO
enumerator HAILO_ARCH_HAILO15M
enumerator HAILO_ARCH_HAILO10H
Page 143 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_ARCH_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_cpu_id_t
Values:
enumerator HAILO_CPU_ID_0
enumerator HAILO_CPU_ID_1
enumerator HAILO_CPU_ID_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_device_boot_source_t
Values:
enumerator HAILO_DEVICE_BOOT_SOURCE_INVALID
enumerator HAILO_DEVICE_BOOT_SOURCE_PCIE
enumerator HAILO_DEVICE_BOOT_SOURCE_FLASH
enumerator HAILO_DEVICE_BOOT_SOURCE_MAX
Max enum value to maintain ABI Integrity
enum hailo_endianness_t
Endianness (byte order)
Values:
enumerator HAILO_BIG_ENDIAN
enumerator HAILO_LITTLE_ENDIAN
enumerator HAILO_ENDIANNESS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_format_type_t
Data format types
Values:
enumerator HAILO_FORMAT_TYPE_AUTO
Chosen automatically to match the format expected by the device, usually UINT8. Can be checked using
hailo_stream_info_t format.type.
enumerator HAILO_FORMAT_TYPE_UINT8
Data format type uint8_t - 1 byte per item, host/device side
enumerator HAILO_FORMAT_TYPE_UINT16
Data format type uint16_t - 2 bytes per item, host/device side
enumerator HAILO_FORMAT_TYPE_FLOAT32
Data format type float32_t - used only on host side (Translated in the quantization process)
enumerator HAILO_FORMAT_TYPE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_format_order_t
Data format orders, i.e. how the rows, columns and features are ordered:
Page 144 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Values:
enumerator HAILO_FORMAT_ORDER_AUTO
Chosen automatically to match the format expected by the device.
enumerator HAILO_FORMAT_ORDER_NHWC
enumerator HAILO_FORMAT_ORDER_NHCW
enumerator HAILO_FORMAT_ORDER_FCR
FCR means first channels (features) are sent to HW:
enumerator HAILO_FORMAT_ORDER_F8CR
F8CR means first 8-channels X width are sent to HW:
• ROW1:
• ROW2:
enumerator HAILO_FORMAT_ORDER_NHW
Output format of argmax layer:
enumerator HAILO_FORMAT_ORDER_NC
Channels only:
enumerator HAILO_FORMAT_ORDER_BAYER_RGB
Bayer format:
Page 145 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_FORMAT_ORDER_12_BIT_BAYER_RGB
Bayer format, same as HAILO_FORMAT_ORDER_BAYER_RGB where Channel is 12 bit
enumerator HAILO_FORMAT_ORDER_HAILO_NMS
NMS bbox
• Host side
struct (packed) {
float32_t bbox_count;
hailo_bbox_float32_t bbox[bbox_count];
};
enumerator HAILO_FORMAT_ORDER_RGB888
• Device side: [N, H, W, C], where channels are 4 (RGB + 1 padded zero byte) and width is padded to 8
elements
enumerator HAILO_FORMAT_ORDER_NCHW
enumerator HAILO_FORMAT_ORDER_YUY2
YUV format, encoding 2 pixels in 32 bits [Y0, U0, Y1, V0] represents [Y0, U0, V0], [Y1, U0, V0]
enumerator HAILO_FORMAT_ORDER_NV12
YUV format, encoding 8 pixels in 96 bits [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, U0, V0, U1, V1] represents [Y0, U0,
V0], [Y1, U0, V0], [Y2, U0, V0], [Y3, U0, V0], [Y4, U1, V1], [Y5, U1, V1], [Y6, U1, V1], [Y7, U1, V1]
enumerator HAILO_FORMAT_ORDER_NV21
YUV format, encoding 8 pixels in 96 bits [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, V0, U0, V1, U1] represents [Y0, V0,
U0], [Y1, V0, U0], [Y2, V0, U0], [Y3, V0, U0], [Y4, V1, U1], [Y5, V1, U1], [Y6, V1, U1], [Y7, V1, U1]
enumerator HAILO_FORMAT_ORDER_HAILO_YYUV
Internal implementation for HAILO_FORMAT_ORDER_NV12 format [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, U0, V0,
U1, V1] is represented by [Y0, Y1, Y2, Y3, U0, V0, Y4, Y5, Y6, Y7, U1, V1]
enumerator HAILO_FORMAT_ORDER_HAILO_YYVU
Internal implementation for HAILO_FORMAT_ORDER_NV21 format [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, V0, U0,
V1, U1] is represented by [Y0, Y1, Y2, Y3, V0, U0, Y4, Y5, Y6, Y7, V1, U1]
Page 146 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_FORMAT_ORDER_RGB4
RGB, where every row is padded to 4.
enumerator HAILO_FORMAT_ORDER_I420
YUV format, encoding 8 pixels in 96 bits [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, U0, U1, V0, V1] represents [Y0, U0,
V0,], [Y1, U0, V0], [Y2, U0, V0], [Y3, U0, V0], [Y4, U1, V1], [Y5, U1, V1], [Y6, U1, V1], [Y7, U1, V1]
enumerator HAILO_FORMAT_ORDER_HAILO_YYYYUV
Internal implementation for HAILO_FORMAT_ORDER_I420 format [Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, U0, U1,
V0, V1] is represented by [Y0, Y1, Y2, Y3, U0, V0, Y4, Y5, Y6, Y7, U1, V1]
enumerator HAILO_FORMAT_ORDER_HAILO_NMS_WITH_BYTE_MASK
NMS_WITH_BYTE_MASK format
• Host side
struct (packed) {
uint16_t detections_count;
hailo_detection_with_byte_mask_t[detections_count];
};
enumerator HAILO_FORMAT_ORDER_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_format_flags_t
Data format flags
Values:
enumerator HAILO_FORMAT_FLAGS_NONE
enumerator HAILO_FORMAT_FLAGS_QUANTIZED
If not set, HailoRT performs the quantization (scaling) step. If set:
• Input data: HailoRT assumes that the data is already quantized (scaled) by the user, so it does not
perform the quantization (scaling) step.
• Output data: The data will be returned to the user without rescaling (i.e., the data won’t be rescaled
by HailoRT).
Note: This flag is deprecated and its usage is ignored. Determine whether to quantize (or de-quantize)
the data will be decided by the src-data and dst-data types.
enumerator HAILO_FORMAT_FLAGS_TRANSPOSED
If set, the frame height/width are transposed. Supported orders:
Page 147 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• HAILO_FORMAT_ORDER_NHWC
• HAILO_FORMAT_ORDER_NHW
• HAILO_FORMAT_ORDER_BAYER_RGB
• HAILO_FORMAT_ORDER_12_BIT_BAYER_RGB
• HAILO_FORMAT_ORDER_FCR
• HAILO_FORMAT_ORDER_F8CR
When set on host side, hailo_stream_info_t shape of the stream will be a transposed version of the host
buffer (The height and width will be swapped)
enumerator HAILO_FORMAT_FLAGS_HOST_ARGMAX
If set, argmax will be called on the feature dimension. Only set on device side.
enumerator HAILO_FORMAT_FLAGS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_stream_transform_mode_t
Indicates how transformations on the data should be done
Values:
enumerator HAILO_STREAM_NO_TRANSFORM
The vstream will not run the transformation (The data will be in hw format)
enumerator HAILO_STREAM_TRANSFORM_COPY
The transformation process will be part of the vstream send/recv (The data will be in host format).
enumerator HAILO_STREAM_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_stream_direction_t
Stream direction - host to device or device to host
Values:
enumerator HAILO_H2D_STREAM
enumerator HAILO_D2H_STREAM
enumerator HAILO_STREAM_DIRECTION_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_stream_flags_t
Stream flags
Values:
enumerator HAILO_STREAM_FLAGS_NONE
No flags
enumerator HAILO_STREAM_FLAGS_ASYNC
Async stream
enumerator HAILO_STREAM_FLAGS_MAX_ENUM
Max enum value to maintain ABI Integrity
Page 148 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enum hailo_dma_buffer_direction_t
Hailo dma buffer direction
Values:
enumerator HAILO_DMA_BUFFER_DIRECTION_H2D
Buffers sent from the host (H) to the device (D). Used for input streams
enumerator HAILO_DMA_BUFFER_DIRECTION_D2H
Buffers received from the device (D) to the host (H). Used for output streams
enumerator HAILO_DMA_BUFFER_DIRECTION_BOTH
Buffers can be used both send to the device and received from the device
enumerator HAILO_DMA_BUFFER_DIRECTION_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_buffer_flags_t
Hailo buffer flags
Values:
enumerator HAILO_BUFFER_FLAGS_NONE
No flags - heap allocated buffer
enumerator HAILO_BUFFER_FLAGS_DMA
Buffer is mapped to DMA (will be page aligned implicitly)
enumerator HAILO_BUFFER_FLAGS_CONTINUOUS
Buffer is physically continuous (will be page aligned implicitly)
enumerator HAILO_BUFFER_FLAGS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_mipi_pixels_per_clock_t
Indicates amount of pixels per clock on a MIPI stream
Values:
enumerator HAILO_MIPI_PIXELS_PER_CLOCK_1
enumerator HAILO_MIPI_PIXELS_PER_CLOCK_2
enumerator HAILO_MIPI_PIXELS_PER_CLOCK_4
enumerator HAILO_MIPI_PIXELS_PER_CLOCK_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_mipi_clock_selection_t
Indicates Range of MIPI clock selection for a MIPI stream
Values:
enumerator HAILO_MIPI_CLOCK_SELECTION_80_TO_100_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_100_TO_120_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_120_TO_160_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_160_TO_200_MBPS
Page 149 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_MIPI_CLOCK_SELECTION_200_TO_240_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_240_TO_280_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_280_TO_320_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_320_TO_360_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_360_TO_400_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_400_TO_480_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_480_TO_560_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_560_TO_640_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_640_TO_720_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_720_TO_800_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_800_TO_880_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_880_TO_1040_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_1040_TO_1200_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_1200_TO_1350_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_1350_TO_1500_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_1500_TO_1750_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_1750_TO_2000_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_2000_TO_2250_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_2250_TO_2500_MBPS
enumerator HAILO_MIPI_CLOCK_SELECTION_AUTOMATIC
The clock selection is calculated from the data rate.
enumerator HAILO_MIPI_CLOCK_SELECTION_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_mipi_data_type_rx_t
Indicates MIPI Rx data type
Values:
enumerator HAILO_MIPI_RX_TYPE_RGB_444
enumerator HAILO_MIPI_RX_TYPE_RGB_555
enumerator HAILO_MIPI_RX_TYPE_RGB_565
enumerator HAILO_MIPI_RX_TYPE_RGB_666
enumerator HAILO_MIPI_RX_TYPE_RGB_888
enumerator HAILO_MIPI_RX_TYPE_RAW_6
enumerator HAILO_MIPI_RX_TYPE_RAW_7
enumerator HAILO_MIPI_RX_TYPE_RAW_8
enumerator HAILO_MIPI_RX_TYPE_RAW_10
enumerator HAILO_MIPI_RX_TYPE_RAW_12
enumerator HAILO_MIPI_RX_TYPE_RAW_14
enumerator HAILO_MIPI_RX_TYPE_MAX_ENUM
Max enum value to maintain ABI Integrity
Page 150 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enum hailo_mipi_isp_image_in_order_t
Indicates ISP input bayer pixel order
Values:
enumerator HAILO_MIPI_ISP_IMG_IN_ORDER_B_FIRST
enumerator HAILO_MIPI_ISP_IMG_IN_ORDER_GB_FIRST
enumerator HAILO_MIPI_ISP_IMG_IN_ORDER_GR_FIRST
enumerator HAILO_MIPI_ISP_IMG_IN_ORDER_R_FIRST
enumerator HAILO_MIPI_ISP_IMG_IN_ORDER_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_mipi_isp_image_out_data_type_t
Indicates ISP output data type
Values:
enumerator HAILO_MIPI_IMG_OUT_DATA_TYPE_RGB_888
enumerator HAILO_MIPI_IMG_OUT_DATA_TYPE_YUV_422
enumerator HAILO_MIPI_IMG_OUT_DATA_TYPE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_mipi_isp_light_frequency_t
Values:
enumerator HAILO_MIPI_ISP_LIGHT_FREQUENCY_60HZ
enumerator HAILO_MIPI_ISP_LIGHT_FREQUENCY_50HZ
enumerator ISP_LIGHT_FREQUENCY_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_stream_interface_t
Values:
enumerator HAILO_STREAM_INTERFACE_PCIE
enumerator HAILO_STREAM_INTERFACE_ETH
enumerator HAILO_STREAM_INTERFACE_MIPI
enumerator HAILO_STREAM_INTERFACE_INTEGRATED
enumerator HAILO_STREAM_INTERFACE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_vstream_stats_flags_t
Virtual stream statistics flags
Values:
enumerator HAILO_VSTREAM_STATS_NONE
No stats
enumerator HAILO_VSTREAM_STATS_MEASURE_FPS
Measure vstream FPS
Page 151 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_VSTREAM_STATS_MEASURE_LATENCY
Measure vstream latency
enumerator HAILO_VSTREAM_STATS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_pipeline_elem_stats_flags_t
Pipeline element statistics flags
Values:
enumerator HAILO_PIPELINE_ELEM_STATS_NONE
No stats
enumerator HAILO_PIPELINE_ELEM_STATS_MEASURE_FPS
Measure element FPS
enumerator HAILO_PIPELINE_ELEM_STATS_MEASURE_LATENCY
Measure element latency
enumerator HAILO_PIPELINE_ELEM_STATS_MEASURE_QUEUE_SIZE
Measure element queue size
enumerator HAILO_PIPELINE_ELEM_STATS_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_pix_buffer_memory_type_t
Values:
enumerator HAILO_PIX_BUFFER_MEMORY_TYPE_USERPTR
enumerator HAILO_PIX_BUFFER_MEMORY_TYPE_DMABUF
enum hailo_nms_burst_type_t
Values:
enumerator HAILO_BURST_TYPE_H8_BBOX
enumerator HAILO_BURST_TYPE_H15_BBOX
enumerator HAILO_BURST_TYPE_H8_PER_CLASS
enumerator HAILO_BURST_TYPE_H15_PER_CLASS
enumerator HAILO_BURST_TYPE_H15_PER_FRAME
enumerator HAILO_BURST_TYPE_COUNT
enum hailo_power_mode_t
Power modes
Values:
enumerator HAILO_POWER_MODE_PERFORMANCE
enumerator HAILO_POWER_MODE_ULTRA_PERFORMANCE
enumerator HAILO_POWER_MODE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_latency_measurement_flags_t
Latency measurement flags
Page 152 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Values:
enumerator HAILO_LATENCY_NONE
enumerator HAILO_LATENCY_MEASURE
enumerator HAILO_LATENCY_CLEAR_AFTER_GET
enumerator HAILO_LATENCY_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_notification_id_t
Notification IDs and structures section start Notification IDs, for each notification, one of the
hailo_notification_message_parameters_t union will be set.
Values:
enumerator HAILO_NOTIFICATION_ID_ETHERNET_RX_ERROR
Matches hailo_notification_message_parameters_t::rx_error_notification.
enumerator HAILO_NOTIFICATION_ID_HEALTH_MONITOR_TEMPERATURE_ALARM
Matches hailo_notification_message_parameters_t::health_monitor_temperature_alarm_notification
enumerator HAILO_NOTIFICATION_ID_HEALTH_MONITOR_DATAFLOW_SHUTDOWN
Matches hailo_notification_message_parameters_t::health_monitor_dataflow_shutdown_notification
enumerator HAILO_NOTIFICATION_ID_HEALTH_MONITOR_OVERCURRENT_ALARM
Matches hailo_notification_message_parameters_t::health_monitor_overcurrent_alert_notification
enumerator HAILO_NOTIFICATION_ID_LCU_ECC_CORRECTABLE_ERROR
Matches hailo_notification_message_parameters_t::health_monitor_lcu_ecc_error_notification
enumerator HAILO_NOTIFICATION_ID_LCU_ECC_UNCORRECTABLE_ERROR
Matches hailo_notification_message_parameters_t::health_monitor_lcu_ecc_error_notification
enumerator HAILO_NOTIFICATION_ID_CPU_ECC_ERROR
Matches hailo_notification_message_parameters_t::health_monitor_cpu_ecc_notification
enumerator HAILO_NOTIFICATION_ID_CPU_ECC_FATAL
Matches hailo_notification_message_parameters_t::health_monitor_cpu_ecc_notification
enumerator HAILO_NOTIFICATION_ID_DEBUG
Matches hailo_notification_message_parameters_t::debug_notification
enumerator HAILO_NOTIFICATION_ID_CONTEXT_SWITCH_BREAKPOINT_REACHED
Matches hailo_notification_message_parameters_t::context_switch_breakpoint_reached_notification
enumerator HAILO_NOTIFICATION_ID_HEALTH_MONITOR_CLOCK_CHANGED_EVENT
Matches hailo_notification_message_parameters_t::health_monitor_clock_changed_notification
enumerator HAILO_NOTIFICATION_ID_HW_INFER_MANAGER_INFER_DONE
Matches hailo_notification_message_parameters_t::hailo_hw_infer_manager_infer_done_notification
enumerator HAILO_NOTIFICATION_ID_CONTEXT_SWITCH_RUN_TIME_ERROR_EVENT
Matches hailo_notification_message_parameters_t::context_switch_run_time_error
enumerator HAILO_NOTIFICATION_ID_START_UPDATE_CACHE_OFFSET
Matched hailo_notification_message_parameters_t::start_update_cache_offset_notification
Page 153 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_NOTIFICATION_ID_COUNT
Must be last!
enumerator HAILO_NOTIFICATION_ID_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_temperature_protection_temperature_zone_t
Values:
enumerator HAILO_TEMPERATURE_PROTECTION_TEMPERATURE_ZONE__GREEN
enumerator HAILO_TEMPERATURE_PROTECTION_TEMPERATURE_ZONE__ORANGE
enumerator HAILO_TEMPERATURE_PROTECTION_TEMPERATURE_ZONE__RED
enum hailo_overcurrent_protection_overcurrent_zone_t
Values:
enumerator HAILO_OVERCURRENT_PROTECTION_OVERCURRENT_ZONE__GREEN
enumerator HAILO_OVERCURRENT_PROTECTION_OVERCURRENT_ZONE__RED
enum hailo_reset_device_mode_t
Hailo device reset modes
Values:
enumerator HAILO_RESET_DEVICE_MODE_CHIP
enumerator HAILO_RESET_DEVICE_MODE_NN_CORE
enumerator HAILO_RESET_DEVICE_MODE_SOFT
enumerator HAILO_RESET_DEVICE_MODE_FORCED_SOFT
enumerator HAILO_RESET_DEVICE_MODE_MAX_ENUM
enum hailo_watchdog_mode_t
Values:
enumerator HAILO_WATCHDOG_MODE_HW_SW
enumerator HAILO_WATCHDOG_MODE_HW_ONLY
enumerator HAILO_WATCHDOG_MODE_MAX_ENUM
enum hailo_sensor_types_t
Values:
enumerator HAILO_SENSOR_TYPES_GENERIC
enumerator HAILO_SENSOR_TYPES_ONSEMI_AR0220AT
enumerator HAILO_SENSOR_TYPES_RASPICAM
enumerator HAILO_SENSOR_TYPES_ONSEMI_AS0149AT
enumerator HAILO_SENSOR_TYPES_HAILO8_ISP
enumerator HAILO_SENSOR_TYPES_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_fw_logger_interface_t
Values:
enumerator HAILO_FW_LOGGER_INTERFACE_PCIE
Page 154 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
enumerator HAILO_FW_LOGGER_INTERFACE_UART
enumerator HAILO_FW_LOGGER_INTERFACE_MAX_ENUM
Max enum value to maintain ABI Integrity
enum hailo_fw_logger_level_t
Values:
enumerator HAILO_FW_LOGGER_LEVEL_TRACE
enumerator HAILO_FW_LOGGER_LEVEL_DEBUG
enumerator HAILO_FW_LOGGER_LEVEL_INFO
enumerator HAILO_FW_LOGGER_LEVEL_WARN
enumerator HAILO_FW_LOGGER_LEVEL_ERROR
enumerator HAILO_FW_LOGGER_LEVEL_FATAL
enumerator HAILO_FW_LOGGER_LEVEL_MAX_ENUM
Max enum value to maintain ABI Integrity
Page 155 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Page 156 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
HAILO_MAX_ENUM
HAILO_INFINITE
HAILO_DEFAULT_ETH_SCAN_TIMEOUT_MS
HAILO_DEFAULT_ETH_CONTROL_PORT
HAILO_DEFAULT_ETH_DEVICE_PORT
HAILO_DEFAULT_ETH_MAX_PAYLOAD_SIZE
HAILO_DEFAULT_ETH_MAX_NUMBER_OF_RETRIES
HAILO_ETH_ADDRESS_ANY
HAILO_ETH_PORT_ANY
HAILO_MAX_NAME_SIZE
HAILO_MAX_STREAM_NAME_SIZE
HAILO_MAX_BOARD_NAME_LENGTH
HAILO_MAX_DEVICE_ID_LENGTH
HAILO_MAX_SERIAL_NUMBER_LENGTH
HAILO_MAX_PART_NUMBER_LENGTH
HAILO_MAX_PRODUCT_NAME_LENGTH
HAILO_DEFAULT_INIT_SAMPLING_PERIOD_US
HAILO_DEFAULT_INIT_AVERAGING_FACTOR
HAILO_DEFAULT_BUFFERS_THRESHOLD
HAILO_DEFAULT_MAX_ETHERNET_BANDWIDTH_BYTES_PER_SEC
HAILO_MAX_STREAMS_COUNT
HAILO_DEFAULT_BATCH_SIZE
HAILO_MAX_NETWORK_GROUPS
HAILO_MAX_NETWORK_GROUP_NAME_SIZE
HAILO_MAX_NETWORK_NAME_SIZE
HAILO_MAX_NETWORKS_IN_NETWORK_GROUP
HAILO_PCIE_ANY_DOMAIN
HAILO_DEFAULT_VSTREAM_QUEUE_SIZE
HAILO_DEFAULT_VSTREAM_TIMEOUT_MS
HAILO_DEFAULT_ASYNC_INFER_TIMEOUT_MS
HAILO_DEFAULT_ASYNC_INFER_QUEUE_SIZE
HAILO_DEFAULT_DEVICE_COUNT
HAILO_SOC_ID_LENGTH
HAILO_ETH_MAC_LENGTH
HAILO_UNIT_LEVEL_TRACKING_BYTES_LENGTH
HAILO_SOC_PM_VALUES_BYTES_LENGTH
Page 157 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
HAILO_MAX_TEMPERATURE_THROTTLING_LEVELS_NUMBER
HAILO_UNIQUE_VDEVICE_GROUP_ID
HAILO_DEFAULT_VDEVICE_GROUP_ID
HAILO_SCHEDULER_PRIORITY_NORMAL
HAILO_SCHEDULER_PRIORITY_MAX
HAILO_SCHEDULER_PRIORITY_MIN
MAX_NUMBER_OF_PLANES
NUMBER_OF_PLANES_NV12_NV21
NUMBER_OF_PLANES_I420
HAILO_STATUS_VARIABLES
HailoRT return codes
HAILO_STREAM_ABORTED_BY_USER
HAILO_DEFAULT_TRANSFORM_PARAMS
HAILO_DEFAULT_SOCKADDR
HAILO_ETH_INPUT_STREAM_PARAMS_DEFAULT
HAILO_ETH_OUTPUT_STREAM_PARAMS_DEFAULT
HAILO_PCIE_STREAM_PARAMS_DEFAULT
HAILO_MIPI_INPUT_STREAM_PARAMS_DEFAULT
HAILO_ACTIVATE_NETWORK_GROUP_PARAMS_DEFAULT
struct hailo_version_t
#include <hailort.h> HailoRT library version
Public Members
uint32_t major
uint32_t minor
uint32_t revision
struct hailo_power_measurement_data_t
#include <hailort.h> Data of the power measurement samples
Public Members
float32_t average_value
float32_t average_time_value_milliseconds
float32_t min_value
float32_t max_value
uint32_t total_number_of_samples
struct hailo_eth_device_info_t
#include <hailort.h> Ethernet device information
Page 158 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint32_t timeout_millis
uint8_t max_number_of_attempts
uint16_t max_payload_size
struct hailo_pcie_device_info_t
#include <hailort.h> PCIe device information
Public Members
uint32_t domain
uint32_t bus
uint32_t device
uint32_t func
struct hailo_device_id_t
#include <hailort.h> Hailo device ID string - BDF for PCIe devices, IP address for Ethernet devices.
Public Members
char id[(32)]
struct hailo_vdevice_params_t
#include <hailort.h> Virtual device parameters
Public Members
uint32_t device_count
Requested number of physical devices. if device_ids is not NULL represents the number of hailo_device_id_t
in device_ids.
hailo_device_id_t *device_ids
Specific device ids to create the vdevice from. If NULL, the vdevice will try to occupy devices from the
available pool.
hailo_scheduling_algorithm_t scheduling_algorithm
The scheduling algorithm to use for network group scheduling
bool multi_process_service
Flag specifies whether to create the VDevice in HailoRT service or not. Defaults to false
struct hailo_firmware_version_t
#include <hailort.h> Hailo firmware version
Page 159 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint32_t major
uint32_t minor
uint32_t revision
struct hailo_device_identity_t
#include <hailort.h> Hailo device identity
Public Members
uint32_t protocol_version
hailo_firmware_version_t fw_version
uint32_t logger_version
uint8_t board_name_length
char board_name[(32)]
bool is_release
bool extended_context_switch_buffer
hailo_device_architecture_t device_architecture
uint8_t serial_number_length
char serial_number[(16)]
uint8_t part_number_length
char part_number[(16)]
uint8_t product_name_length
char product_name[(42)]
struct hailo_core_information_t
Public Members
bool is_release
bool extended_context_switch_buffer
hailo_firmware_version_t fw_version
struct hailo_device_supported_features_t
#include <hailort.h> Hailo device supported features
Public Members
bool ethernet
Is ethernet supported
bool mipi
Is mipi supported
bool pcie
Is pcie supported
bool current_monitoring
Is current monitoring supported
Page 160 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
bool mdio
Is current mdio supported
struct hailo_extended_device_information_t
#include <hailort.h> Hailo extended device information
Public Members
uint32_t neural_network_core_clock_rate
The core clock rate
hailo_device_supported_features_t supported_features
Hailo device supported features
hailo_device_boot_source_t boot_source
Device boot source
uint8_t soc_id[(32)]
SOC id
uint8_t lcs
Device lcs
uint8_t eth_mac_address[(6)]
Device Ethernet Mac address
uint8_t unit_level_tracking_id[(12)]
Hailo device unit level tracking id
uint8_t soc_pm_values[(24)]
Hailo device pm values
struct hailo_i2c_slave_config_t
#include <hailort.h> I2C slave configuration
Public Members
hailo_endianness_t endianness
uint16_t slave_address
uint8_t register_address_size
uint8_t bus_index
bool should_hold_bus
struct hailo_fw_user_config_information_t
#include <hailort.h> Firmware user config information
Page 161 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint32_t version
uint32_t entry_count
uint32_t total_size
struct hailo_format_t
#include <hailort.h> Hailo data format
Public Members
hailo_format_type_t type
hailo_format_order_t order
hailo_format_flags_t flags
struct hailo_buffer_parameters_t
#include <hailort.h> Hailo buffer parameters
Public Members
hailo_buffer_flags_t flags
struct hailo_transform_params_t
#include <hailort.h> Input or output data transform parameters
Public Members
hailo_stream_transform_mode_t transform_mode
hailo_format_t user_buffer_format
struct hailo_demux_params_t
#include <hailort.h> Demuxer params
Public Members
uint8_t reserved
struct hailo_quant_info_t
#include <hailort.h> Quantization information. Property of hailo_stream_info_t, hailo_vstream_info_t .
Hailo devices require input data to be quantized/scaled before it is sent. Similarly, data outputted from the
device needs to be ‘de-quantized’/rescaled as well. Each input/output layer is assigned two floating point values
that are parameters to an input/output transformation: qp_zp (zero_point) and qp_scale. These values are
stored in the HEF.
• Input transformation: Input data is divided by qp_scale and then qp_zp is added to the result.
• Output transformation: qp_zp is subtracted from output data and then the result is multiplied by
qp_scale.
Public Members
float32_t qp_zp
zero_point
float32_t qp_scale
scale
float32_t limvals_min
min limit value
Page 162 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
float32_t limvals_max
max limit value
struct hailo_eth_input_stream_params_t
#include <hailort.h> Ethernet input stream (host to device) parameters
Public Members
port_t device_port
bool is_sync_enabled
uint32_t frames_per_sync
uint16_t max_payload_size
uint32_t rate_limit_bytes_per_sec
Stream may be rate limited by setting this member to te desired rate other than zero. The limition will
only effect the corresponding stream (other network traffic won’t be effected).
• On linux the “Traffic Control” tool will be used to limit the network rate (see man tc):
– This will result in external processes being created at the creation and destruction of the stream
– User-mode rate limiting is designed to consistently keep the stream at the desired rate, however
fluctuations will occur. This member parameter provides an upper bound on the bandwidth at
which the stream will operate.
uint32_t buffers_threshold
struct hailo_eth_output_stream_params_t
#include <hailort.h> Ethernet output stream (device to host) parameters
Public Members
port_t device_port
bool is_sync_enabled
uint16_t max_payload_size
uint32_t buffers_threshold
struct hailo_pcie_input_stream_params_t
#include <hailort.h> PCIe input stream (host to device) parameters
Page 163 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint8_t reserved
struct hailo_pcie_output_stream_params_t
#include <hailort.h> PCIe output stream (device to host) parameters
Public Members
uint8_t reserved
struct hailo_mipi_common_params_t
#include <hailort.h> MIPI params
Public Members
uint16_t img_width_pixels
The width in pixels of the image that enter to the mipi CSI. The sensor output. When isp_enable and
isp_crop_enable is false, is also the stream input.
uint16_t img_height_pixels
The height in pixels of the image that enter to the mipi CSI. The sensor output. When isp_enable and
isp_crop_enable is false, is also the stream input.
hailo_mipi_pixels_per_clock_t pixels_per_clock
Number of pixels transmitted at each clock.
uint8_t number_of_lanes
Number of lanes to use.
hailo_mipi_clock_selection_t clock_selection
Selection of clock range that would be used. Setting HAILO_MIPI_CLOCK_SELECTION_AUTOMATIC means that
the clock selection is calculated from the data rate.
uint8_t virtual_channel_index
The virtual channel index of the MIPI dphy.
uint32_t data_rate
Rate of the passed data (MHz).
struct hailo_isp_params_t
#include <hailort.h> ISP params
Public Members
hailo_mipi_isp_image_in_order_t isp_img_in_order
The ISP Rx bayer pixel order. Only relevant when the ISP is enabled.
hailo_mipi_isp_image_out_data_type_t isp_img_out_data_type
The data type that the mipi will take out. Only relevant when the ISP is enabled.
bool isp_crop_enable
Enable the crop feature in the ISP. Only relevant when the ISP is enabled.
uint16_t isp_crop_output_width_pixels
The width in pixels of the output window that the ISP take out. The stream input. Useful when
isp_crop_enable is True. Only relevant when the ISP is enabled.
Page 164 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
uint16_t isp_crop_output_height_pixels
The height in pixels of the output window that the ISP take out. The stream input. Useful when
isp_crop_enable is True. Only relevant when the ISP is enabled.
uint16_t isp_crop_output_width_start_offset_pixels
The width start point of the output window that the ISP take out. Useful when isp_crop_enable is True.
Only relevant when the ISP is enabled.
uint16_t isp_crop_output_height_start_offset_pixels
The height start point of the output window that the ISP take out. Useful when isp_crop_enable is True.
Only relevant when the ISP is enabled.
bool isp_test_pattern_enable
Enable Test pattern from the ISP. Only relevant when the ISP is enabled.
bool isp_configuration_bypass
Don’t load the ISP configuration file from the FLASH. Only relevant when the ISP is enabled.
bool isp_run_time_ae_enable
Enable the run-time Auto Exposure in the ISP. Only relevant when the ISP is enabled.
bool isp_run_time_awb_enable
Enable the run-time Auto White Balance in the ISP. Only relevant when the ISP is enabled.
bool isp_run_time_adt_enable
Enable the run-time Adaptive Function in the ISP. Only relevant when the ISP is enabled.
bool isp_run_time_af_enable
Enable the run-time Auto Focus in the ISP. Only relevant when the ISP is enabled.
uint16_t isp_run_time_calculations_interval_ms
Interval in milliseconds between ISP run time calculations. Only relevant when the ISP is enabled.
hailo_mipi_isp_light_frequency_t isp_light_frequency
Selection of the light frequency. This parameter varies depending on the power grid of the country where
the product is running. Only relevant when the ISP is enabled.
struct hailo_mipi_input_stream_params_t
#include <hailort.h> MIPI input stream (host to device) parameters
Public Members
hailo_mipi_common_params_t mipi_common_params
uint8_t mipi_rx_id
Selection of which MIPI Rx device to use.
hailo_mipi_data_type_rx_t data_type
The data type which will be passed over the MIPI.
bool isp_enable
Enable the ISP block in the MIPI dataflow. The ISP is not supported yet.
hailo_isp_params_t isp_params
struct hailo_integrated_input_stream_params_t
#include <hailort.h> Core input stream (host to device) parameters
Page 165 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint8_t reserved
struct hailo_integrated_output_stream_params_t
#include <hailort.h> Core output stream (device to host) parameters
Public Members
uint8_t reserved
struct hailo_stream_parameters_t
#include <hailort.h> Hailo stream parameters
Public Members
hailo_stream_interface_t stream_interface
hailo_stream_direction_t direction
hailo_stream_flags_t flags
hailo_pcie_input_stream_params_t pcie_input_params
hailo_integrated_input_stream_params_t integrated_input_params
hailo_eth_input_stream_params_t eth_input_params
hailo_mipi_input_stream_params_t mipi_input_params
hailo_pcie_output_stream_params_t pcie_output_params
hailo_integrated_output_stream_params_t integrated_output_params
hailo_eth_output_stream_params_t eth_output_params
struct hailo_stream_parameters_by_name_t
#include <hailort.h> Hailo stream parameters per stream_name
Public Members
char name[((128))]
hailo_stream_parameters_t stream_params
struct hailo_vstream_params_t
#include <hailort.h> Virtual stream params
Public Members
hailo_format_t user_buffer_format
uint32_t timeout_ms
uint32_t queue_size
hailo_vstream_stats_flags_t vstream_stats_flags
hailo_pipeline_elem_stats_flags_t pipeline_elements_stats_flags
struct hailo_input_vstream_params_by_name_t
#include <hailort.h> Input virtual stream parameters
Page 166 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
char name[((128))]
hailo_vstream_params_t params
struct hailo_output_vstream_params_by_name_t
#include <hailort.h> Output virtual stream parameters
Public Members
char name[((128))]
hailo_vstream_params_t params
struct hailo_output_vstream_name_by_group_t
#include <hailort.h> Output virtual stream name by group
Public Members
char name[((128))]
uint8_t pipeline_group_index
struct hailo_3d_image_shape_t
#include <hailort.h> Image shape
Public Members
uint32_t height
uint32_t width
uint32_t features
struct hailo_pix_buffer_plane_t
#include <hailort.h> image buffer plane
Public Members
uint32_t bytes_used
actual data
uint32_t plane_size
void *user_ptr
int fd
struct hailo_pix_buffer_t
#include <hailort.h> image buffer
Public Members
uint32_t index
hailo_pix_buffer_plane_t planes[(4)]
uint32_t number_of_planes
hailo_pix_buffer_memory_type_t memory_type
struct hailo_dma_buffer_t
#include <hailort.h> dma buffer - intended for use with Linux’s dma-buf sub system
Page 167 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
int fd
size_t size
struct hailo_nms_defuse_info_t
Public Members
uint32_t class_group_index
char original_name[((128))]
struct hailo_nms_info_t
#include <hailort.h> NMS Internal HW Info
Public Members
uint32_t number_of_classes
Amount of NMS classes
uint32_t max_bboxes_per_class
Maximum amount of bboxes per nms class
uint32_t bbox_size
Internal usage
uint32_t chunks_per_frame
Internal usage
bool is_defused
hailo_nms_defuse_info_t defuse_info
uint32_t burst_size
Size of NMS burst in bytes
hailo_nms_burst_type_t burst_type
NMS burst type
struct hailo_nms_fuse_input_t
#include <hailort.h> NMS Fuse Input
Public Members
void *buffer
size_t size
hailo_nms_info_t nms_info
struct hailo_nms_shape_t
#include <hailort.h> Shape of nms result
Page 168 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint32_t number_of_classes
Amount of NMS classes
uint32_t max_bboxes_per_class
Maximum amount of bboxes per nms class
uint32_t max_accumulated_mask_size
Maximum accumulated mask size for all of the detections in a frame. Used only with
‘HAILO_FORMAT_ORDER_HAILO_NMS_WITH_BYTE_MASK’ format order. The default value is
(input_image_size * 2)
struct hailo_bbox_t
Public Members
uint16_t y_min
uint16_t x_min
uint16_t y_max
uint16_t x_max
uint16_t score
struct hailo_bbox_float32_t
Public Members
float32_t y_min
float32_t x_min
float32_t y_max
float32_t x_max
float32_t score
struct hailo_rectangle_t
Public Members
float32_t y_min
float32_t x_min
float32_t y_max
float32_t x_max
struct hailo_detection_with_byte_mask_t
Page 169 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
hailo_rectangle_t box
Detection’s box coordinates
float32_t score
Detection’s score
uint16_t class_id
Detection’s class id
size_t mask_size
Mask size in bytes
uint8_t *mask
Byte Mask: The mask is a binary mask that defines a region of interest (ROI) of the image. Mask pixel
values of 1 indicate image pixels that belong to the ROI. Mask pixel values of 0 indicate image pixels that
are part of the background.
The size of the mask is the size of the box, in the original input image’s dimensions. Mask width =
ceil((box.x_max - box.x_min) * image_width) Mask height = ceil((box.y_max - box.y_min) * image_height)
First pixel represents the pixel (x_min * image_width, y_min * image_height) in the original input image.
struct hailo_stream_write_async_completion_info_t
#include <hailort.h> Completion info struct passed to the hailo_stream_write_async_callback_t after the async
operation is done or has failed.
Public Members
hailo_status status
Status of the async transfer:
• HAILO_STREAM_ABORT - The transfer was canceled (can happen after network deactivation).
size_t buffer_size
Size of the buffer passed to the async operation.
void *opaque
User specific data. Can be used as a context for the callback.
struct hailo_stream_read_async_completion_info_t
#include <hailort.h> Completion info struct passed to the hailo_stream_read_async_callback_t after the async op-
eration is done or has failed.
Page 170 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
hailo_status status
Status of the async transfer:
• HAILO_STREAM_ABORT - The transfer was canceled (can happen after network deactivation).
void *buffer_addr
Address of the buffer passed to the async operation
size_t buffer_size
Size of the buffer passed to the async operation.
void *opaque
User specific data. Can be used as a context for the callback.
struct hailo_stream_info_t
#include <hailort.h> Input or output stream information. In case of multiple inputs or outputs, each one has its
own stream.
Public Members
hailo_3d_image_shape_t shape
hailo_3d_image_shape_t hw_shape
hailo_nms_info_t nms_info
uint32_t hw_data_bytes
uint32_t hw_frame_size
hailo_format_t format
hailo_stream_direction_t direction
uint8_t index
char name[((128))]
hailo_quant_info_t quant_info
bool is_mux
struct hailo_vstream_info_t
#include <hailort.h> Input or output vstream information.
Public Members
char name[((128))]
hailo_stream_direction_t direction
hailo_format_t format
hailo_3d_image_shape_t shape
hailo_nms_shape_t nms_shape
Page 171 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
hailo_quant_info_t quant_info
struct hailo_network_parameters_t
Public Members
uint16_t batch_size
Sets the batch size of the InferModel. This parameter determines the number of frames that be sent for
inference in a single batch. If a scheduler is enabled, this parameter determines the ‘burst size’ - the max
number of frames after which the scheduler will attempt to switch to another model.
struct hailo_network_parameters_by_name_t
Public Members
hailo_network_parameters_t network_params
struct hailo_configure_network_group_params_t
#include <hailort.h> Hailo configure parameters per network_group
Public Members
char name[((128))]
uint16_t batch_size
This parameter is only used in multi-context network_groups. In case of name missmatch, default value
HAILO_DEFAULT_BATCH_SIZE is used
hailo_power_mode_t power_mode
hailo_latency_measurement_flags_t latency
size_t stream_params_by_name_count
hailo_stream_parameters_by_name_t stream_params_by_name[(40)]
size_t network_params_by_name_count
hailo_network_parameters_by_name_t network_params_by_name[(8)]
struct hailo_configure_params_t
#include <hailort.h> Hailo configure parameters
Public Members
size_t network_group_params_count
hailo_configure_network_group_params_t network_group_params[(8)]
struct hailo_activate_network_group_params_t
#include <hailort.h> Hailo network_group parameters
Page 172 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint8_t reserved
struct hailo_network_group_info_t
#include <hailort.h> Hailo network group info
Public Members
char name[((128))]
bool is_multi_context
struct hailo_layer_name_t
#include <hailort.h> Hailo layer name
Public Members
char name[((128))]
struct hailo_network_info_t
Public Members
struct hailo_rx_error_notification_message_t
#include <hailort.h> Rx error notification message
Public Members
uint32_t error
uint32_t queue_number
uint32_t rx_errors_count
struct hailo_debug_notification_message_t
#include <hailort.h> Debug notification message
Public Members
uint32_t connection_status
uint32_t connection_type
uint32_t vdma_is_active
uint32_t host_port
uint32_t host_ip_addr
struct hailo_health_monitor_dataflow_shutdown_notification_message_t
#include <hailort.h> Health monitor - Dataflow shutdown notification message
Public Members
uint32_t closed_input_streams
Bit mask of closed input streams indices
uint32_t closed_output_streams
Bit mask of closed output streams indices
float32_t ts0_temperature
float32_t ts1_temperature
Page 173 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
struct hailo_health_monitor_temperature_alarm_notification_message_t
#include <hailort.h> Health monitor - Temperature alarm notification message
Public Members
hailo_temperature_protection_temperature_zone_t temperature_zone
uint32_t alarm_ts_id
float32_t ts0_temperature
float32_t ts1_temperature
struct hailo_health_monitor_overcurrent_alert_notification_message_t
#include <hailort.h> Health monitor - Overcurrent alert notification message
Public Members
hailo_overcurrent_protection_overcurrent_zone_t overcurrent_zone
float32_t exceeded_alert_threshold
bool is_last_overcurrent_violation_reached
struct hailo_health_monitor_lcu_ecc_error_notification_message_t
#include <hailort.h> Health monitor - LCU ECC error notification message
Public Members
uint16_t cluster_error
struct hailo_health_monitor_cpu_ecc_notification_message_t
#include <hailort.h> Health monitor - CPU ECC error notification message
Public Members
uint32_t memory_bitmap
struct hailo_context_switch_breakpoint_reached_message_t
#include <hailort.h> Context switch - breakpoint reached notification message
Public Members
uint8_t network_group_index
uint16_t batch_index
uint16_t context_index
uint16_t action_index
struct hailo_health_monitor_clock_changed_notification_message_t
#include <hailort.h> Health monitor - System’s clock has been changed notification message
Public Members
uint32_t previous_clock
uint32_t current_clock
struct hailo_hw_infer_manager_infer_done_notification_message_t
Page 174 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Members
uint32_t infer_cycles
struct hailo_start_update_cache_offset_notification_message_t
Public Members
uint64_t cache_id_bitmask
struct hailo_context_switch_run_time_error_message_t
Public Members
uint32_t exit_status
uint8_t network_group_index
uint16_t batch_index
uint16_t context_index
uint16_t action_index
union hailo_notification_message_parameters_t
#include <hailort.h> Union of all notification messages parameters. See hailo_notification_t
Public Members
hailo_rx_error_notification_message_t rx_error_notification
Ethernet rx error
hailo_debug_notification_message_t debug_notification
Internal usage
hailo_health_monitor_dataflow_shutdown_notification_message_t
health_monitor_dataflow_shutdown_notification
Dataflow shutdown due to health monitor event
hailo_health_monitor_temperature_alarm_notification_message_t
health_monitor_temperature_alarm_notification
Chip temperature alarm
hailo_health_monitor_overcurrent_alert_notification_message_t
health_monitor_overcurrent_alert_notification
Chip overcurrent alert
hailo_health_monitor_lcu_ecc_error_notification_message_t
health_monitor_lcu_ecc_error_notification
Core ecc error notification
hailo_health_monitor_cpu_ecc_notification_message_t health_monitor_cpu_ecc_notification
Chip ecc error notification
hailo_context_switch_breakpoint_reached_message_t
context_switch_breakpoint_reached_notification
Internal usage
hailo_health_monitor_clock_changed_notification_message_t
health_monitor_clock_changed_notification
Neural network core clock changed due to health monitor event
Page 175 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
hailo_hw_infer_manager_infer_done_notification_message_t
hw_infer_manager_infer_done_notification
hailo_context_switch_run_time_error_message_t context_switch_run_time_error
context switch run time error event
hailo_start_update_cache_offset_notification_message_t
start_update_cache_offset_notification
Start cache offset update notification
struct hailo_notification_t
#include <hailort.h> Notification data that will be passed to the callback passed in hailo_notification_callback
Public Members
hailo_notification_id_t id
uint32_t sequence
hailo_notification_message_parameters_t body
struct hailo_chip_temperature_info_t
Public Members
float32_t ts0_temperature
float32_t ts1_temperature
uint16_t sample_count
struct hailo_throttling_level_t
Public Members
float32_t temperature_threshold
float32_t hysteresis_temperature_threshold
uint32_t throttling_nn_clock_freq
struct hailo_health_info_t
Public Members
bool overcurrent_protection_active
uint8_t current_overcurrent_zone
float32_t red_overcurrent_threshold
bool overcurrent_throttling_active
bool temperature_throttling_active
uint8_t current_temperature_zone
int8_t current_temperature_throttling_level
hailo_throttling_level_t temperature_throttling_levels[(4)]
int32_t orange_temperature_threshold
int32_t orange_hysteresis_temperature_threshold
int32_t red_temperature_threshold
int32_t red_hysteresis_temperature_threshold
Page 176 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
uint32_t requested_overcurrent_clock_freq
uint32_t requested_temperature_clock_freq
struct hailo_stream_raw_buffer_t
Public Members
void *buffer
size_t size
struct hailo_stream_raw_buffer_by_name_t
Public Members
char name[((128))]
hailo_stream_raw_buffer_t raw_buffer
struct hailo_latency_measurement_result_t
Public Members
float64_t avg_hw_latency_ms
struct hailo_rate_limit_t
Public Members
char stream_name[((128))]
uint32_t rate
struct hailo_cache_info_t
Public Members
uint32_t cache_size
uint32_t current_read_offset
int32_t write_offset_delta
Page 177 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: (for C++ API users) In order to maintain ABI Integrity between libhailort and your application that uses the C++
API, you should compile libhailort instead of using the pre-compiled binaries.
class hailort::Device
Represents the Hailo device (chip).
Public Types
enum Type
The device type
Values:
enumerator PCIE
enumerator ETH
enumerator INTEGRATED
Public Functions
Expected<NetworkGroupsParamsMap> create_configure_params(Hef &hef ) const
Create the default configure params from an hef.
Parameters
Parameters
Returns Upon success, returns Expected of a vector of configured network groups. Otherwise,
returns Unexpected of hailo_status error.
Page 178 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• buffer – [in] A buffer that would receive the debug log data.
• cpu_id – [in] The cpu source of the debug log.
Returns Upon success, returns Expected of the number of bytes that were read. Otherwise,
returns Unexpected of hailo_status error.
Expected<hailo_device_identity_t> identify()
Sends identify control to a Hailo device.
Expected<hailo_core_information_t> core_identify()
Receive information about the core cpu.
Expected<hailo_extended_device_information_t> get_extended_device_information()
Get extended device information about the Hailo device.
Parameters
Parameters
Parameters
Page 179 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Expected<bool> get_throttling_state()
Get current throttling state of temperature protection and overcurrent protection components. If any
throttling is enabled, the function return true.
Returns Upon success, returns Expected of bool, indicates whether the throttling state is active
or not. Otherwise, returns Unexpected of hailo_status error.
Parameters
Page 180 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• data – [in] A buffer that contains the data to be written to the slave.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns an hailo_status error.
Parameters
Returns Upon success, returns uint32_t mesuremenet. Measured units are determined due to
hailo_power_measurement_types_t. Otherwise, returns a hailo_status error.
Parameters
Page 181 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• should_clear – [in] Flag indicating if the results saved at the firmware will be
deleted after reading.
hailo_status stop_power_measurement()
Stop performing a long power measurement.
Expected<hailo_chip_temperature_info_t> get_chip_temperature()
Get temperature information on the device
Note: Calling this function while running other operations on the device (including inference) will lead
to unexpected results!
Note: The object used to call this function is not to be used after calling this function! A new instance
should be created.
Page 182 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
hailo_status test_chip_memories()
Test chip memories using BIST.
Note: This is an advanced API. Please be advised not to use this API, unless supported by Hailo.
Note: Calling this function while running other operations on the device (including inference) will lead
to unexpected results!
Note: The object used to call this function is not to be used after calling this function! A new instance
should be created.
Parameters
Page 183 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Calling this function while running other operations on the device (including inference) will lead
to unexpected results!
Note: The object used to call this function is not to be used after calling this function! A new instance
should be created.
Parameters
Parameters
Parameters
Returns Upon success, returns Expected of a buffer containing the sensor’s sections informa-
tion. Otherwise, returns Unexpected of hailo_status error.
Page 184 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Parameters section_index – [in] Flash section index to load config from. [0-6]
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns a hailo_status error.
Parameters section_index – [in] Flash section index to load config from. [0-6]
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns a hailo_status error.
Parameters
Returns Upon success, returns Expected of a buffer containing the data read. Otherwise, re-
turns Unexpected of hailo_status error.
Returns Upon success, returns Expected of a buffer containing the data read. Otherwise, re-
turns Unexpected of hailo_status error.
Page 185 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns An identification string of the device. For Pcie device, returns the BDF. For Ethernet
device, returns the IP address. For Core device, returns “Core”.
For high level API (aka InferModel), buffers bound using ConfiguredInfer-
Model::Bindings::InferStream::set_buffer can be mapped.
For low level API (aka InputStream/OutputStream), buffers passed to InputStream::write_async and Out-
putStream::read_async can be mapped.
Note: The DMA mapping will be released upon calling dma_unmap() with address, size and data_direction,
or when the VDevice object is destroyed.
Note: The buffer pointed to by address cannot be released until it is unmapped (via dma_unmap() or
Device destruction).
Parameters
Page 186 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• direction – [in] The direction of the mapping. For input streams, use
HAILO_DMA_BUFFER_DIRECTION_H2D and for output streams, use
HAILO_DMA_BUFFER_DIRECTION_D2H.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns a hailo_status error.
Parameters
For high level API (aka InferModel), buffers bound using ConfiguredInfer-
Model::Bindings::InferStream::set_buffer can be mapped.
For low level API (aka InputStream/OutputStream), buffers passed to InputStream::write_async and Out-
putStream::read_async can be mapped.
Note: The DMA mapping will be released upon calling dma_unmap() with dmabuf_fd, size and
data_direction, or when the Device object is destroyed.
Parameters
Parameters
Page 187 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: ethernet devices are not considered “devices in the system”, so they are not scanned in this
function. use :scan_eth for ethernet devices.
Returns Upon success, returns Expected of a vector of std::string containing the information.
Otherwise, returns Unexpected of hailo_status error.
Parameters
Parameters
Returns Upon success, returns Expected of a unique_ptr to Device object. Otherwise, returns
Unexpected of hailo_status error.
Parameters device_id – [in] Device id string, can represent several device types: [-] for pcie
devices - pcie bdf (XXXX:XX:XX.X) [-] for ethernet devices - ip address (xxx.xxx.xxx.xxx)
Returns Upon success, returns Expected of a unique_ptr to Device object. Otherwise, returns
Unexpected of hailo_status error.
Returns Upon success, returns Expected of a unique_ptr to Device object. Otherwise, returns
Unexpected of hailo_status error.
Page 188 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Returns Upon success, returns Expected of a string containing the information. Otherwise,
returns Unexpected of hailo_status error.
Parameters
Page 189 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailort::VDevice
Represents a bundle of physical devices.
Public Functions
virtual Expected<ConfiguredNetworkGroupVector> configure(Hef &hef, const ...)
Configures the vdevice from an hef.
Parameters
Returns Upon success, returns Expected of a vector of configured network groups. Otherwise,
returns Unexpected of hailo_status error.
Note: the Hef file must be maintained until the completion of the configuration phase.
Parameters
Note: the Hef buffer must be maintained until the completion of the configuration phase.
Parameters
Note: The returned physical devices are held in the scope of vdevice.
Returns Upon success, returns Expected of a vector of device objects. Otherwise, returns Un-
expected of hailo_status error.
Page 190 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns Expected of a vector of std::string device ids objects. Otherwise,
returns Unexpected of hailo_status error.
Parameters
For high level API (aka InferModel), buffers bound using ConfiguredInfer-
Model::Bindings::InferStream::set_buffer can be mapped.
For low level API (aka InputStream/OutputStream), buffers passed to InputStream::write_async and Out-
putStream::read_async can be mapped.
Note: The DMA mapping will be released upon calling dma_unmap() with address, size and data_direction,
or when the VDevice object is destroyed.
Note: The buffer pointed to by address cannot be released until it is unmapped (via dma_unmap() or
VDevice destruction).
Parameters
Parameters
Page 191 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
For high level API (aka InferModel), buffers bound using ConfiguredInfer-
Model::Bindings::InferStream::set_buffer can be mapped.
For low level API (aka InputStream/OutputStream), buffers passed to InputStream::write_async and Out-
putStream::read_async can be mapped.
Note: The DMA mapping will be released upon calling dma_unmap_dmabuf() with dmabuf_fd, size and
data_direction, or when the VDevice object is destroyed.
Parameters
Parameters
Note: calling this create method will apply default vdevice params.
Returns Upon success, returns Expected of a unique_ptr to VDevice object. Otherwise, returns
Unexpected of hailo_status error.
Page 192 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: calling this create method will apply default vdevice params.
Returns Upon success, returns Expected of a unique_ptr to VDevice object. Otherwise, returns
Unexpected of hailo_status error.
struct hailort::ConfigureNetworkParams
Hailo configure parameters per network_group. Analogical to hailo_configure_network_group_params_t
Public Functions
ConfigureNetworkParams() = default
Public Members
uint16_t batch_size
hailo_power_mode_t power_mode
hailo_latency_measurement_flags_t latency
class hailort::Hef
HEF model that can be loaded to Hailo devices
Public Functions
Expected<std::vector<hailo_stream_info_t» get_input_stream_infos(const std::string &name = ...)
Gets input streams informations.
Parameters name – [in] The name of the network or network_group which contains the input
stream_infos. In case network group name is given, the function returns the input stream
infos of all the networks of the given network group. In case network name is given (pro-
vided by get_network_infos), the function returns the input stream infos of the given network.
If NULL is passed, the function returns the input stream infos of all the networks of the first
network group.
Returns Upon success, returns a vector of hailo_stream_info_t, containing each stream’s infor-
mation. Otherwise, returns a hailo_status error.
Parameters name – [in] The name of the network or network_group which contains the out-
put stream_infos. In case network group name is given, the function returns the output
stream infos of all the networks of the given network group. In case network name is given
(provided by get_network_infos), the function returns the output stream infos of the given
Page 193 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
network. If NULL is passed, the function returns the output stream infos of all the networks
of the first network group.
Returns Upon success, returns a vector of hailo_stream_info_t, containing each stream’s infor-
mation. Otherwise, returns a hailo_status error.
Parameters name – [in] The name of the network or network_group which contains the
stream_infos. In case network group name is given, the function returns all stream infos
of all the networks of the given network group. In case network name is given (provided
by get_network_infos), the function returns all stream infos of the given network. If NULL
is passed, the function returns all the stream infos of all the networks of the first network
group.
Parameters
Parameters name – [in] The name of the network or network_group which contains the input
virtaul stream_infos. In case network group name is given, the function returns the input
virtual stream infos of all the networks of the given network group. In case network name
is given (provided by get_network_infos), the function returns the input virtual stream infos
of the given network. If NULL is passed, the function returns the input virtual stream infos
of all the networks of the first network group.
Parameters name – [in] The name of the network or network_group which contains the output
virtual stream_infos. In case network group name is given, the function returns the output
virtual stream infos of all the networks of the given network group. In case network name
is given (provided by get_network_infos), the function returns the output virtual stream infos
of the given network. If NULL is passed, the function returns the output virtual stream infos
of all the networks of the first network group.
Parameters name – [in] The name of the network or network_group which contains the vir-
tual stream_infos. In case network group name is given, the function returns all virtual
stream infos of all the networks of the given network group. In case network name is given
Page 194 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
(provided by get_network_infos), the function returns all virtual stream infos of the given net-
work. If NULL is passed, the function returns all the virtual stream infos of all the networks
of the first network group.
Parameters net_group_name – [in] The name of the network_group which contains the
streams information. If not passed, the first network_group in the Hef will be addressed.
Returns Upon success, returns Expected of a sorted vector of output vstreams names. Other-
wise, returns Unexpected of hailo_status error.
Parameters net_group_name – [in] The name of the network_group which contains the
streams information. If not passed, the first network_group in the Hef will be addressed.
Returns Upon success, returns Expected containing the number of low-level input streams.
Otherwise, returns Unexpected of hailo_status error.
Parameters net_group_name – [in] The name of the network_group which contains the
streams information. If not passed, the first network_group in the Hef will be addressed.
Returns Upon success, returns Expected containing the number of low-level output streams.
Otherwise, returns Unexpected of hailo_status error.
Parameters net_group_name – [in] The name of the network_group which contains the
information. If not passed, the first network_group in the Hef will be addressed.
Returns Upon success, returns Expected containing the bottleneck FPS number. Otherwise,
returns Unexpected of hailo_status error.
Returns Upon success, returns Expected containing the device architecture the HEF was com-
piled for. Otherwise, returns Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected of a vector of all stream names linked to the provided
vstream. Otherwise, returns Unexpected of hailo_status error.
Parameters
Page 195 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns Expected of a vector of all stream names linked to the provided
vstream.
Returns Upon success, returns of a vector of all vstream names linked to the provided stream.
Otherwise, returns Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected containing the vstream’s name. Otherwise, returns
Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected of a vector of all original names linked to the provided
vstream. Otherwise, returns Unexpected of hailo_status error.
Parameters
Parameters
Page 196 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• net_group_name – [in] The name of the network_group for which to create the
stream parameters for. If an empty string is given, the first network_group in the Hef
will be addressed.
Returns Upon success, returns Expected of a map of stream name to stream params. Other-
wise, returns Unexpected of hailo_status error.
Parameters net_group_name – [in] The name of the network_group for which to create
the network parameters for. If an empty string is given, the first network_group in the Hef
will be addressed.
Returns Upon success, returns Expected of a map of network name to network params. Oth-
erwise, returns Unexpected of hailo_status error.
Parameters
• net_group_name – [in] The name of the network_group for which to create the
stream parameters for. If an empty string is given, the first network_group in the Hef
will be addressed.
Returns Upon success, returns Expected of a map of input stream name to stream params.
Otherwise, returns Unexpected of hailo_status error.
Parameters
Page 197 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• name – [in] The name of the network or network_group which user wishes to create
input virtual stream params for. In case network group name is given, the function re-
turns the input virtual stream params of all the networks of the given network group.
In case network name is given (provided by get_network_infos), the function returns the
input virtual stream params of the given network. If NULL is passed, the function returns
the input virtual stream params of all the networks of the first network group.
Parameters
• name – [in] The name of the network or network_group which user wishes to create out-
put virtual stream params for. In case network group name is given, the function returns
the output virtual stream params of all the networks of the given network group. In case
network name is given (provided by get_network_infos), the function returns the output
virtual stream params of the given network. If NULL is passed, the function returns the
output virtual stream params of all the networks of the first network group.
Parameters net_group_name – [in] The name of the network_group which contains the
network information. If NULL is passed, the function returns the network infos of all the
networks of the first network group.
Returns A unique string hash for the Hef . Hefs created based on identical files will return
identical hashes.
Returns Upon success, returns Expected of Hef . Otherwise, returns Unexpected of hailo_status
error.
Page 198 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns Expected of Hef . Otherwise, returns Unexpected of hailo_status
error.
Returns Upon success, returns string representing the device architecture the HEF was com-
piled for. Otherwise, returns Unexpected of hailo_status error.
class hailort::ActivatedNetworkGroup
Activated network_group that can be used to send/receive data
Public Functions
virtual const std::string &get_network_group_name() const = 0
class hailort::ConfiguredNetworkGroup
Loaded network_group that can be activated
Public Functions
virtual const std::string &get_network_group_name() const = 0
Page 199 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters network_name – [in] Network name of the requested input streams. If not
passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of vector InputStream. Otherwise, returns Unexpected
of hailo_status error.
Parameters network_name – [in] Network name of the requested output streams. If not
passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of vector OutputStream. Otherwise, returns Unex-
pected of hailo_status error.
Note: The output streams returned here are streams that corresponds to the names in outputs_params.
If outputs_params contains a demux edge name, then all its predecessors names must be in out-
puts_params as well and the return value will contain the stream that corresponds to those edges.
Expected<std::unique_ptr<ActivatedNetworkGroup» activate()
Activates hailo device inner-resources for inference.
Page 200 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters timeout – [in] The timeout in milliseconds. If timeout is zero, the function re-
turns immediately. If timeout is HAILO_INFINITE, the function returns only when the event
is signaled.
Note: Calling this function is optional, and it is used to shutdown network group while there is still
ongoing inference.
Parameters
Returns Upon success, returns Expected of a map of name to vstream params. Otherwise,
returns Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected of a map of name to vstream params. Otherwise,
returns Unexpected of hailo_status error.
Parameters
Page 201 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Upon success, returns Expected of a map of vstream name to group index. Otherwise,
returns Unexpected of hailo_status error.
Returns Upon success, returns Expected of a vector of all network infos of the configured net-
work group. Otherwise, returns Unexpected of hailo_status error.
Parameters network_name – [in] Network name of the requested stream infos. If not
passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of all stream infos of the configured network group.
Otherwise, returns Unexpected of hailo_status error.
Parameters network_name – [in] Network name of the requested virtual stream infos. If
not passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of all input vstreams infos of the configured network
group. Otherwise, returns Unexpected of hailo_status error.
Parameters network_name – [in] Network name of the requested virtual stream infos. If
not passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of all output vstreams infos of the configured network
group. Otherwise, returns Unexpected of hailo_status error.
Parameters network_name – [in] Network name of the requested virtual stream infos. If
not passed, all the networks in the network group will be addressed.
Returns Upon success, returns Expected of all vstreams infos of the configured network group.
Otherwise, returns Unexpected of hailo_status error.
Page 202 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: The new time period will be measured after the previous time the scheduler allocated run time to
this network group.
Note: Currently, setting the timeout for a specific network is not supported.
Parameters
Note: If at least one send request has been sent, but the threshold is not reached within a set time period
(e.g. timeout - see hailo_set_scheduler_timeout()), the scheduler will consider the network ready regardless.
Note: Currently, setting the threshold for a specific network is not supported.
Parameters
Page 203 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Currently, setting the priority for a specific network is not supported.
Parameters
• network_name – [in] Network name for which to set the Priority. If not passed, the
priority will be set for all the networks in the network group.
Returns The configuration parameters this network group was initialized with.
class hailort::InputStream
Input (host to device) stream representation
Public Types
Public Functions
virtual hailo_status set_timeout(std::chrono::milliseconds timeout) = 0
Set new timeout value to the input stream
Page 204 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: This function is deprecated. To reuse network after shutdown, reconfigure it.
EventPtr &get_network_group_activated_event()
Parameters
Page 205 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• If timeout has passed and the stream is not ready, returns HAILO_TIMEOUT.
Returns Upon success, returns Expected of a the queue size. Otherwise, returns Unexpected of
hailo_status error.
• If the function call succeeds (i.e., write_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete buffer.
• If the function call fails (i.e., write_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a pointer to the transferred buffer (buffer_addr) and
the transfer status (status).
Note: The buffer’s format comes from the format field inside get_info() and the shape comes from the
hw_shape field inside get_info().
Note: The address provided must be aligned to the system’s page size, and the rest of the page should
not be in use by any other part of the program to ensure proper functioning of the DMA operation. Mem-
ory for the provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on
Windows.
Note: Pre-mapping buffer to DMA via Device::dma_map() may improve performance, if buffer is
used for multiple async transfers.
Parameters
• buffer – [in] The buffer to be written. The buffer must be aligned to the system page
size.
Page 206 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• user_callback – [in] The callback that will be called when the transfer is complete
or has failed.
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case please wait until
user_callback is called on previous writes, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
virtual hailo_status write_async(const void *buffer, size_t size, const TransferDoneCallback ...)
Writes the contents of buffer to the stream asynchronously, initiating a deferred operation that will be
completed later.
• If the function call succeeds (i.e., write_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete buffer.
• If the function call fails (i.e., write_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a pointer to the transferred buffer (buffer_addr) and
the transfer status (status).
Note: The buffer’s format comes from the format field inside get_info() and the shape comes from the
hw_shape field inside get_info().
Note: The address provided must be aligned to the system’s page size, and the rest of the page should
not be in use by any other part of the program to ensure proper functioning of the DMA operation. Mem-
ory for the provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on
Windows.
Note: Pre-mapping buffer to DMA via Device::dma_map() may improve performance, if buffer is
used for multiple async transfers.
Parameters
• buffer – [in] The buffer to be written. The buffer must be aligned to the system page
size.
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case please wait until
user_callback is called on previous writes, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
Page 207 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If the function call succeeds (i.e., write_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete dmabuf_fd.
• If the function call fails (i.e., write_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete dmabuf_fd.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a fd representing the transferred buffer (dmabuf_fd)
and the transfer status (status).
Note: The dmabuf fd must be a linux-system dmabuf fd - otherwise behavior will fail.
Parameters
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case please wait until
user_callback is called on previous writes, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
Page 208 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
struct CompletionInfo
Context passed to the TransferDoneCallback after the async operation is done or has failed.
Public Members
hailo_status status
Status of the async transfer.
• HAILO_SUCCESS - When transfer is complete successfully.
• HAILO_STREAM_ABORT - The transfer was canceled (can happen after network deactivation).
• Any other hailo_status on unexpected errors.
class hailort::OutputStream
Output (device to host) stream representation
Public Types
Public Functions
virtual hailo_status set_timeout(std::chrono::milliseconds timeout) = 0
Set new timeout value to the output stream
Note: This function is deprecated. To reuse network after shutdown, reconfigure it.
EventPtr &get_network_group_activated_event()
Page 209 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters buffer – [in] A buffer that receives the data read from the stream.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns an hailo_status error.
Parameters
• buffer – [in] A pointer to a buffer that receives the data read from the stream.
• size – [in] The size of the given buffer.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns an hailo_status error.
Parameters
Page 210 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If timeout has passed and the stream is not ready, returns HAILO_TIMEOUT.
Returns Upon success, returns Expected of a the queue size. Otherwise, returns Unexpected of
hailo_status error.
• If the function call succeeds (i.e., read_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete buffer.
• If the function call fails (i.e., read_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a pointer to the transferred buffer (buffer_addr) and
the transfer status (status). If the operation has completed successfully, the contents of buffer will
have been updated by the read operation.
Note: The buffer’s format is determined by the format field inside get_info(), and the shape is determined
by the hw_shape field inside get_info().
Note: The address provided must be aligned to the system’s page size, and the rest of the page should
not be in use by any other part of the program to ensure proper functioning of the DMA operation. Mem-
ory for the provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on
Windows.
Note: Pre-mapping buffer to DMA via Device::dma_map() may improve performance, if buffer is
used for multiple async transfers.
Parameters
• buffer – [in] The buffer to be read into. The buffer must be aligned to the system
page size.
• user_callback – [in] The callback that will be called when the transfer is complete
or has failed.
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case, please wait until
user_callback is called on previous reads, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
Page 211 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If the function call succeeds (i.e., read_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete buffer.
• If the function call fails (i.e., read_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete buffer.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a pointer to the transferred buffer (buffer_addr) and
the transfer status (status). If the operation has completed successfully, the contents of buffer will
have been updated by the read operation.
Note: The buffer’s format is determined by the format field inside get_info(), and the shape is determined
by the hw_shape field inside get_info()
Note: The address provided must be aligned to the system’s page size, and the rest of the page should
not be in use by any other part of the program to ensure proper functioning of the DMA operation. Mem-
ory for the provided address can be allocated using mmap on Unix-like systems or VirtualAlloc on
Windows.
Note: Pre-mapping buffer to DMA via Device::dma_map() may improve performance, if buffer is
used for multiple async transfers.
Parameters
• buffer – [in] The buffer to be read into. The buffer must be aligned to the system
page size.
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case, please wait until
user_callback is called on previous reads, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
• If the function call succeeds (i.e., read_async() returns HAILO_SUCCESS), the deferred operation has
been initiated. Until user_callback is called, the user cannot change or delete dmabuf_fd.
Page 212 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• If the function call fails (i.e., read_async() returns a status other than HAILO_SUCCESS), the deferred
operation will not be initiated and user_callback will not be invoked. The user is free to change or
delete dmabuf_fd.
• user_callback is triggered upon successful completion or failure of the deferred operation. The call-
back receives a CompletionInfo object containing a fd representing the transferred buffer (dmabuf_fd)
and the transfer status (status). If the operation has completed successfully, the contents of the
dmabuf will have been updated by the read operation.
Note: The dmabuf fd must be a linux-system dmabuf fd - otherwise behavior will fail.
Parameters
• If the stream queue is full, returns HAILO_QUEUE_IS_FULL. In this case, please wait until
user_callback is called on previous reads, or call wait_for_async_ready(). The size of the
queue can be determined by calling get_async_max_queue_size().
struct CompletionInfo
Context passed to the TransferDoneCallback after the async operation is done or has failed.
Public Members
hailo_status status
Status of the async transfer.
• HAILO_SUCCESS - When transfer is complete successfully.
• HAILO_STREAM_ABORT - The transfer was canceled (can happen after network deactivation).
• Any other hailo_status on unexpected errors.
Parameters
Page 213 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns The size of transpose buffer by its src shape and dst format type.
Parameters
• dst – [out] A pointer to a buffer which will contain the fused buffer.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns a hailo_status error.
class hailort::InputTransformContext
Object used for input stream transformation
Public Functions
hailo_status transform(const MemoryView src, MemoryView dst)
Transforms an input frame referred by src directly to the buffer referred by dst.
Parameters
Returns The size of the src frame on the host side in bytes.
Parameters
Page 214 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• dst_format – [in] The format of the dst buffer that receives the transformed data.
• dst_quant_infos – [in] A vector of hailo_quant_info_t object containing quantiza-
tion information per feature. Might also contain a vector with a single hailo_quant_info_t
object.
Parameters
• dst_format – [in] The format of the dst buffer that receives the transformed data.
• dst_quant_info – [in] A hailo_quant_info_t object containing quantization informa-
tion.
Parameters
Parameters
Parameters
Page 215 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: In case the function returns false, the src frame is ready to be sent to HW without any transfor-
mation.
Parameters
Note: In case the function returns false, the src frame is ready to be sent to HW without any transfor-
mation.
Parameters
class hailort::OutputTransformContext
Object used for output stream transformation
Public Functions
virtual hailo_status transform(const MemoryView src, MemoryView dst) = 0
Transforms an output frame referred by src directly to the buffer referred by dst.
Parameters
Page 216 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns The size of the dst frame on the host side in bytes.
Parameters
• dst_format – [in] The format of the dst buffer that receives the transformed data.
• dst_quant_infos – [in] A vector of hailo_quant_info_t object containing quantiza-
tion information per feature. Might also contain a vector with a single hailo_quant_info_t
object.
Parameters
• dst_format – [in] The format of the dst buffer that receives the transformed data.
• dst_quant_info – [in] A hailo_quant_info_t object containing quantization informa-
tion.
Parameters
Page 217 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
Note: In case the function returns false, the src frame is already in the required format without any
transformation.
Parameters
Note: In case the function returns false, the src frame is already in the required format without any
transformation.
Parameters
Page 218 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailort::OutputDemuxer
Object used to demux muxed stream
Public Functions
virtual std::vector<hailo_stream_info_t> get_edges_stream_info() = 0
Parameters
Note: The order of raw_buffers should be the same as returned from the function ‘get_edges_stream_info()’.
Parameters
class hailort::Quantization
Hailo device requires input data to be quantized/scaled before it is sent. Similarly, data outputted from the de-
vice needs to be ‘de-quantized’/rescaled as well. When a neural network is compiled, each input/output layer in
the neural network is assigned two floating point values that are parameters to an input/output transformation:
hailo_quant_info_t::qp_zp (zero_point) and hailo_quant_info_t::qp_scale (fields of the struct hailo_quant_info_t).
These values are stored in the Hef .
Page 219 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• Output transformation: hailo_quant_info_t::qp_zp is subtracted from output data and then the result is
multiplied by hailo_quant_info_t::qp_scale.
Parameters
• src_ptr – [in] A pointer to the buffer containing the data that will be de-quantized.
• dst_ptr – [out] A pointer to the buffer that will contain the output de-quantized data.
• buffer_elements_count – [in] The number of elements in src_ptr and dst_ptr
arrays.
Parameters
Parameters
Parameters
• src_ptr – [in] A pointer to the buffer containing the data that will be quantized.
• dst_ptr – [out] A pointer to the buffer that will contain the output quantized data.
• buffer_elements_count – [in] The number of elements in src_ptr and dst_ptr
arrays.
Parameters
• src_ptr – [in] A pointer to the buffer containing the data that will be de-quantized.
Page 220 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• dst_ptr – [out] A pointer to the buffer that will contain the output de-quantized data.
• buffer_elements_count – [in] The number of elements in src_ptr and dst_ptr
arrays.
Parameters
Parameters
Note: QP will be invalid in case HEF file was compiled with multiple QPs, and then the user will try
working with API for single QP. For example - if HEF was compiled with multiple QPs and then the user
calls hailo_get_input_stream_info, The hailo_quant_info_t object of the hailo_stream_info_t object will be
invalid.
class hailort::InferModel
Contains all of the necessary information for configuring the network for inference. This class is used to set up
the model for inference and includes methods for setting and getting the model’s parameters. By calling the
configure function, the user can create a ConfiguredInferModel object, which is used to run inference.
Page 221 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Functions
virtual const Hef &hef() const = 0
Returns A constant reference to the Hef object associated with this InferModel.
Returns Upon success, returns Expected of ConfiguredInferModel, which can be used to perform
an asynchronous inference. Otherwise, returns Unexpected of hailo_status error.
Note: If InferModel has multiple inputs, will return HAILO_INVALID_OPERATION. In that case - use input(const
std::string &name) instead.
Returns Upon success, returns Expected of the single input’s InferStream object. Otherwise,
returns Unexpected of hailo_status error.
Note: If InferModel has multiple outputs, will return HAILO_INVALID_OPERATION. In that case - use out-
put(const std::string &name) instead.
Returns Upon success, returns Expected of the single output’s InferStream object. Otherwise,
returns Unexpected of hailo_status error.
Page 222 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns A constant reference to the vector of input InferStream objects, each representing an
input edge.
Returns A constant reference to the vector of output InferStream objects, each representing an
output edge.
Returns A constant reference to a vector of strings, each representing the name of an input
stream.
Returns A constant reference to a vector of strings, each representing the name of an output
stream.
class InferStream
Represents the parameters of a stream. In default, the stream’s parameters are set to the default values
of the model. The user can change the stream’s parameters by calling the set_ functions.
Public Functions
const std::string name() const
Returns The shape of the image that the stream will use for inference.
Returns The format that the stream will use for inference.
Returns The size in bytes of a frame that the stream will use for inference.
Returns upon success, an Expected of hailo_nms_shape_t, the NMS shape for the stream.
Otherwise, returns Unexpected of hailo_status error.
Page 223 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: : Used in order to change the output buffer frame size in cases where the output buffer is
too small for all the segmentation detections.
class hailort::AsyncInferJob
Asynchronous inference job representation is used to manage and control an inference job that is running
asynchronously.
Public Functions
hailo_status wait(std::chrono::milliseconds timeout)
Waits for the asynchronous inference job to finish.
void detach()
Detaches the job. Without detaching, the job’s destructor will block until the job finishes.
class hailort::ConfiguredInferModel
Configured infer_model that can be used to perform an asynchronous inference
Page 224 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Functions
Expected<Bindings> create_bindings()
Creates a Bindings object.
Parameters
• timeout – [in] Amount of time to wait until the model is ready in milliseconds.
• frames_count – [in] The count of buffers you intent to infer in the next request.
Useful for batch inference.
• If timeout has passed and the model is not ready, returns HAILO_TIMEOUT.
hailo_status activate()
Activates hailo device inner-resources for inference.
hailo_status deactivate()
Deactivates hailo device inner-resources for inference.
Parameters
• bindings – [in] The bindings for the inputs and outputs of the model.
• timeout – [in] The maximum amount of time to wait for the inference operation to
complete.
Note: The bindings’ buffers should be kept intact until the async job is completed
Page 225 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• bindings – [in] The bindings for the inputs and outputs of the model.
• callback – [in] The function to be called upon completion of the asynchronous infer-
ence operation.
Note: The bindings’ buffers should be kept intact until the async job is completed
Parameters
• bindings – [in] The bindings for the inputs and outputs of the model.
• callback – [in] The function to be called upon completion of the asynchronous infer-
ence operation.
Expected<LatencyMeasurementResult> get_hw_latency_measurement()
Note: The new time period will be measured after the previous time the scheduler allocated run time to
this network group.
Page 226 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: If at least one send request has been sent, but the threshold is not reached within a set time period
(e.g. timeout - see hailo_set_scheduler_timeout()), the scheduler will consider the network ready regardless.
Expected<size_t> get_async_queue_size()
Returns Upon success, returns Expected of a the number of inferences that can be queued
simultaneously for execution. Otherwise, returns Unexpected of hailo_status error.
hailo_status shutdown()
Shuts the inference down. After calling this method, the model is no longer usable.
class Bindings
Represents an asynchronous infer request - holds the input and output buffers of the request
Public Functions
Expected<InferStream> input()
Returns the single input’s InferStream object.
Note: If Bindings has multiple inputs, will return HAILO_INVALID_OPERATION. In that case - use in-
put(const std::string &name) instead.
Returns Upon success, returns Expected of the single input’s InferStream object. Otherwise,
returns Unexpected of hailo_status error.
Expected<InferStream> output()
Returns the single output’s InferStream object.
Page 227 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: If Bindings has multiple outputs, will return HAILO_INVALID_OPERATION. In that case - use out-
put(const std::string &name) instead.
Returns Upon success, returns Expected of the single output’s InferStream object. Other-
wise, returns Unexpected of hailo_status error.
class InferStream
Holds the input and output buffers of the Bindings infer request
Public Functions
hailo_status set_buffer(MemoryView view)
Sets the edge’s buffer to a new one, of type MemoryView.
For best performance and to avoid memory copies, buffers should be aligned to the system
PAGE_SIZE.
On output streams, the actual buffer allocated size must be aligned to PAGE_SIZE as well - other-
wise some memory corruption might occur at the end of the last page. For example, if the buffer
size is 4000 bytes, the actual buffer size should be at least 4096 bytes. To fill all requirements, it
is recommended to allocate the buffer with standard page allocation function provided by the
os (mmap on linux, VirtualAlloc in windows).
Parameters view – [in] The new buffer to be set.
Returns Upon success, returns HAILO_SUCCESS. Otherwise, returns a hailo_status error.
Expected<MemoryView> get_buffer()
Returns Upon success, returns Expected of the MemoryView buffer of the edge. Other-
wise, returns Unexpected of hailo_status error.
Each plane in the hailo_pix_buffer_t must feet the requirements listed in set_buffer.
Page 228 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Expected<hailo_pix_buffer_t> get_pix_buffer()
Returns Upon success, returns Expected of the hailo_pix_buffer_t buffer of the edge. Oth-
erwise, returns Unexpected of hailo_status error.
Expected<hailo_dma_buffer_t> get_dma_buffer()
Returns Upon success, returns Expected of the hailo_dma_buffer_t buffer of the edge. Oth-
erwise, returns Unexpected of hailo_status error.
class hailort::InputVStream
Public Functions
hailo_status write(const MemoryView &buffer)
Writes buffer to hailo device.
Parameters buffer – [in] The buffer containing the data to be sent to device. The buffer’s
format can be obtained by get_user_buffer_format(), and the buffer’s shape can be obtained
by calling get_info().shape.
Parameters buffer – [in] The buffer containing pointers to the planes where the data to be
sent to the device is stored.
hailo_status flush()
Flushes the vstream pipeline buffers. This will block until the vstream pipeline is clear.
Page 229 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
hailo_status abort()
Aborts vstream until its resumed.
hailo_status resume()
Resumes vstream after it was aborted.
Note: The size could be affected by the format type - using UINT16, or by the data not being quantized
yet.
Returns the size of a virtual stream’s frame on the host side in bytes.
Note: FPS accumulators are created for pipeline elements, if the vstream is created with
the flag HAILO_PIPELINE_ELEM_STATS_MEASURE_FPS set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective fps
accumulators.
Page 230 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Latency accumulators are created for pipeline elements, if the vstream is created with the
flag HAILO_PIPELINE_ELEM_STATS_MEASURE_LATENCY set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective la-
tency accumulators.
Note: Queue size accumulators are created for pipeline elements, if the vstream is created with the
flag HAILO_PIPELINE_ELEM_STATS_MEASURE_QUEUE_SIZE set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective queue
size accumulators.
• For InputVStreams: The time it takes a frame from the call to InputVStream::write, until the frame is
written to the HW.
• For OutputVStreams: The time it takes a frame from being read from the HW, until it’s returned to the
user via OutputVStream::read.
Note: A pipeline-wide latency accumulator is created for the vstream, if the vstream is cre-
ated with the flag HAILO_VSTREAM_STATS_MEASURE_LATENCY set under the vstream_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to the PipelineElements that this vstream is comprised of.
class hailort::OutputVStream
Page 231 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Functions
hailo_status read(MemoryView buffer)
Reads data from hailo device into buffer.
Parameters buffer – [in] The buffer to read data into. The buffer’s format can be ob-
tained by get_user_buffer_format(), and the buffer’s shape can be obtained by calling
get_info().shape.
hailo_status abort()
Aborts vstream until its resumed.
hailo_status resume()
Resumes vstream after it was aborted.
Note: The size could be affected by the format type - using UINT16, or by the data not being quantized
yet.
Returns the size of a virtual stream’s frame on the host side in bytes.
Note: FPS accumulators are created for pipeline elements, if the vstream is created with
the flag HAILO_PIPELINE_ELEM_STATS_MEASURE_FPS set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective fps
accumulators.
Page 232 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: Latency accumulators are created for pipeline elements, if the vstream is created with the
flag HAILO_PIPELINE_ELEM_STATS_MEASURE_LATENCY set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective la-
tency accumulators.
Note: Queue size accumulators are created for pipeline elements, if the vstream is created with the
flag HAILO_PIPELINE_ELEM_STATS_MEASURE_QUEUE_SIZE set under the pipeline_elements_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to a map between pipeline element names to their respective queue
size accumulators.
• For InputVStreams: The time it takes a frame from the call to InputVStream::write, until the frame is
written to the HW.
• For OutputVStreams: The time it takes a frame from being read from the HW, until it’s returned to the
user via OutputVStream::read.
Note: A pipeline-wide latency accumulator is created for the vstream, if the vstream is cre-
ated with the flag HAILO_VSTREAM_STATS_MEASURE_LATENCY set under the vstream_stats_flags field of
hailo_vstream_params_t.
Returns A const reference to the PipelineElements that this vstream is comprised of.
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
Page 233 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
Note: This function must be called before starting inference! This function will fail in cases where the
output vstream has no NMS operations on the CPU.
Note: Used in order to change the output buffer frame size, in cases where the output buffer is too small
for all the segmentation detections.
Note: This function must be called before starting inference! This function will fail in cases where the
output vstream has no NMS operations on the CPU.
class hailort::VStreamsBuilder
Contains the virtual streams creation functions
Page 234 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Returns Upon success, returns Expected of a pair of input vstreams and output vstreams. Oth-
erwise, returns Unexpected of hailo_status error.
Parameters
• network_name – [in] Request to create vstreams of specific network inside the con-
figured network group. If not passed, all the networks in the network group will be ad-
dressed.
Returns Upon success, returns Expected of a vector of input virtual streams. Otherwise, returns
Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected of a vector of input virtual streams. Otherwise, returns
Unexpected of hailo_status error.
Note: If not creating all output vstreams together, one should make sure all vstreams from the same
group are created together. See ConfiguredNetworkGroup::make_output_vstream_params_groups
Parameters
Returns Upon success, returns Expected of a vector of output virtual streams. Otherwise, re-
turns Unexpected of hailo_status error.
Page 235 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailort::InferVStreams
Pipeline used to run inference
Public Functions
hailo_status infer(const std::map<std::string, MemoryView> &input_data, std::map<std::string, ...)
Run inference on dataset input_data.
Note: The size of each element in input_data and output_data must match the frame size of the matching
vstream name multiplied by frames_count.
Note: If at least one input/output of some network is present, all inputs and outputs of that network
must also be present.
Parameters
std::vector<std::reference_wrapper<InputVStream» get_input_vstreams()
std::vector<std::reference_wrapper<OutputVStream» get_output_vstreams()
Note: This function will fail in cases where there is no output with NMS operations on the CPU.
Page 236 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: This function will fail in cases where there is no output with NMS operations on the CPU.
Note: This function must be called before starting inference! This function will fail in cases where there
is no output with NMS operations on the CPU.
Note: Used in order to change the output buffer frame size, in cases where the output buffer is too small
for all the segmentation detections.
Note: This function must be called before starting inference! This function will fail in cases where the
output vstream has no NMS operations on the CPU.
Note: If at least one input/output of some network is present, all inputs and outputs of that network
must also be present.
Parameters
Page 237 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailort::DmaMappedBuffer
A wrapper class for mapping and unmapping buffers using VDevice::dma_map and VDevice::dma_unmap (or their
variants for Device).
The DmaMappedBuffer class provides a convenient way to keep a DMA mapping on a buffer active. It encap-
sulates the functionality of mapping and unmapping buffers using VDevice::dma_map and VDevice::dma_unmap,
as well as their variants for Device.
Example:
if (!mapped_buffer.has_value()) {
// Handle error
} else {
// Use the mapped buffer
}
Note: The buffer pointed to by address cannot be released until this object is destroyed.
Public Functions
~DmaMappedBuffer()
The destructor automatically unmaps the buffer.
Parameters
Parameters
Page 238 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
namespace hailort
class HailoRTCommon
#include <hailort_common.hpp>
Parameters nms_info – [in] The NMS info to get shape size from.
Returns The host shape size (number of elements).
Page 239 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Page 240 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• shape – [in] A hailo_3d_image_shape_t object.
• format – [in] A hailo_format_t object.
Returns The periph frame’s size in bytes.
Page 241 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailort::AccumulatorResults
Results obtained by an Accumulator at a given point in time via Accumulator::get_and_clear or Accumulator::get
Public Functions
inline Expected<size_t> count() const
Returns Returns Expected of the minimal value added to the Accumulator, or Unexpected of
HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the maximal value added to the Accumulator, or Unexpected of
HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the mean of the values added to the Accumulator, or Unexpected
of HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the sample variance of the values added to the Accumulator, or
Unexpected of HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the sample standard deviation of the values added to the Accu-
mulator, or Unexpected of HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the sample standard deviation of the mean of values added to the
Accumulator, or Unexpected of HAILO_UNINITIALIZED if no data has been added.
class hailort::Accumulator
The Accumulator interface supports the measurement of various statistics incrementally. I.e. upon each ad-
dition of a measurement to the Accumulator, via Accumulator::add_data_point, all the statistics are updated.
Implementations of this interface are to be thread-safe, meaning that adding measurements in one thread,
while another thread reads the current statistics (via the various getters provided by the interface) will produce
correct values.
Page 242 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Public Functions
inline Accumulator(const std::string &data_type)
Constructs a new Accumulator with a given data_type
Parameters data_type – The type of data that will be measured by the Accumulator. Used
to differentiate between different types of measurements (e.g. fps, latency).
Note: Implementations of this interface are to update the statistics in constant time
Parameters
Returns Returns Expected of the minimal value added to the Accumulator, or Unexpected of
HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the maximal value added to the Accumulator, or Unexpected of
HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the mean of the values added to the Accumulator, or Unexpected
of HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the sample variance of the values added to the Accumulator, or
Unexpected of HAILO_UNINITIALIZED if no data has been added.
Returns Returns Expected of the sample standard deviation of the values added to the Accu-
mulator, or Unexpected of HAILO_UNINITIALIZED if no data has been added.
Page 243 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Returns Expected of the sample standard deviation of the mean of values added to the
Accumulator, or Unexpected of HAILO_UNINITIALIZED if no data has been added.
class Unexpected
Unexpected is an object containing hailo_status error, used when an unexpected outcome occurred.
template<typename T>
class hailort::Expected
Expected<T> is either a T or the hailo_status preventing T to be created.
Public Functions
inline bool has_value() const
Checks whether the object contains a value.
Note: You must call this method with a valid value inside! otherwise it can lead to undefined behavior.
Note: You must call this method with a valid value inside! otherwise it can lead to undefined behavior.
inline T release()
Releases ownership of its stored value, by returning its value and making this object Unexpected.
Note: You must call this method with a valid value inside! otherwise it can lead to undefined behavior.
class hailort::NetworkUdpRateCalculator
Public Functions
Expected<std::map<std::string, uint32_t» calculate_inputs_bandwith(uint32_t fps, uint32_t ...)
Calculate the inputs bandwidths supported by the configured network. Rate limiting of this manner is to
be used for ethernet input streams.
Note: There are two options to limit the rate of an ethernet input stream to the desired bandwidth:
• On Unix platforms:
Page 244 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
– You may use the command line tool hailortcli udpratelimiter instead of using
this API
Parameters
Returns Upon success, returns Expected of a map of stream names and their corresponding
rates. Otherwise, returns Unexpected of hailo_status error.
Parameters
Returns Upon success, returns Expected of a map of stream ports and their corresponding
rates. Otherwise, returns Unexpected of hailo_status error.
Page 245 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
14.1. hailo_platform.pyhailort.hw_object
class hailo_platform.pyhailort.hw_object.InferenceTargets
Bases: object
UNINITIALIZED = 'uninitialized'
UDP_CONTROLLER = 'udp'
PCIE_CONTROLLER = 'pcie'
exception hailo_platform.pyhailort.hw_object.HailoHWObjectException
Bases: Exception
class hailo_platform.pyhailort.hw_object.HailoHWObject
Bases: object
NAME = 'uninitialized'
IS_HARDWARE = True
__init__()
Create the Hailo hardware object.
property name
The name of this target. Valid values are defined by InferenceTargets (deprecated)
Type str
property is_hardware
Indicates this target runs on a physical hardware device. (deprecated)
Type bool
property device_id
Getter for the device_id. :returns: A string ID of the device. BDF for PCIe devices, IP address for Ethernet
devices, “Core” for core devices. :rtype: str
property sorted_output_layer_names
Getter for the property sorted_output_names (deprecated). :returns: Sorted list of the output layer
names. :rtype: list of str
use_device(*args, **kwargs)
A context manager that wraps the usage of the device. (deprecated)
get_output_device_layer_to_original_layer_map()
Get a mapping between the device outputs to the layers’ names they represent (deprecated).
Returns Keys are device output names and values are lists of layers’ names.
get_original_layer_to_device_layer_map()
Get a mapping between the layer names and the device outputs that contain them (deprecated).
Returns Keys are the names of the layers and values are device outputs names.
Page 246 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
property device_input_layers
Get a list of the names of the device’s inputs. (deprecated)
property device_output_layers
Get a list of the names of the device’s outputs. (deprecated)
hef_loaded()
Return True if this object has loaded the model HEF to the hardware device. (deprecated)
outputs_count()
Return the amount of output tensors that are returned from the hardware device for every input image
(deprecated).
property model_name
Get the name of the current model (deprecated).
get_output_shapes()
Get the model output shapes, as returned to the user (without any hardware padding) (deprecated).
class hailo_platform.pyhailort.hw_object.HailoChipObject
Bases: hailo_platform.pyhailort.hw_object.HailoHWObject
__init__()
Create the Hailo Chip hardware object.
property control
Returns the control object of this device, which implements the control API of the Hailo device. .. atten-
tion:: Use the low level control API with care.
Type HailoControl
get_all_input_layers_dtype()
Get the model inputs dtype (deprecated).
Returns obj:’numpy.dtype’: where the key is model input_layer name, and the value is dtype
as the device expect to get for this input.
get_input_vstream_infos(network_name=None)
Get input vstreams information of a specific network group (deprecated).
get_output_vstream_infos(network_name=None)
Get output vstreams information of a specific network group (deprecated).
get_all_vstream_infos(network_name=None)
Get input and output vstreams information (deprecated).
Page 247 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
get_input_stream_infos(network_name=None)
Get the input low-level streams information of a specific network group (deprecated).
get_output_stream_infos(network_name=None)
Get the output low-level streams information of a specific network group (deprecated).
get_all_stream_infos(network_name=None)
Get input and output streams information of a specific network group (deprecated).
property loaded_network_groups
Getter for the property _loaded_network_groups. :returns: List of the the configured network groups
loaded on the device. :rtype: list of ConfiguredNetwork
configure(hef, configure_params_by_name={})
Configures target device from HEF object. :param hef: HEF to configure the device from :type hef: HEF
:param configure_params_by_name: Maps between each net_group_name to configure_params. If not
provided, default params will be applied :type configure_params_by_name: dict, optional
get_input_shape(name=None)
Get the input shape (not padded) of a network (deprecated).
Parameters name (str, optional) – The name of the desired input. If a name is not
provided, return the first input_dataflow shape.
get_index_from_name(name)
Get the index in the output list from the name (deprecated).
release()
Release the allocated resources of the device. This function should be called when working with the device
not as context-manager. Note: After calling this function, the device will not be usable.
Page 248 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Represents any Hailo hardware device that supports UDP control and dataflow (deprecated)
NAME = 'udp'
__init__(remote_ip, remote_control_port=22401)
Create the Hailo UDP hardware object.
Parameters
Parameters
property remote_ip
Return the IP of the remote device (deprecated).
class hailo_platform.pyhailort.hw_object.PcieDevice(device_info=None)
Bases: hailo_platform.pyhailort.hw_object.HailoChipObject
NAME = 'pcie'
__init__(device_info=None)
Create the Hailo PCIe hardware object.
14.2. hailo_platform.pyhailort.pyhailort
class hailo_platform.pyhailort.pyhailort.HailoRTException
Bases: Exception
class hailo_platform.pyhailort.pyhailort.UdpRecvError
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.InvalidProtocolVersionException
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class
hailo_platform.pyhailort.pyhailort.HailoRTFirmwareControlFailedException
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTInvalidFrameException
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
Page 249 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class
hailo_platform.pyhailort.pyhailort.HailoRTUnsupportedOpcodeException
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTTimeout
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTStreamAborted
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTStreamAbortedByUser
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HEF(hef_source)
Bases: object
Python representation of the Hailo Executable Format, which contains one or more compiled models.
__init__(hef_source)
Constructor for the HEF class.
Parameters hef_source (str or bytes) – The source from which the HEF object will
be created. If the source type is str, it is treated as a path to an hef file. If the source type is
bytes, it is treated as a buffer. Any other type will raise a ValueError.
get_networks_names(network_group_name=None)
Gets the names of all networks in a specific network group.
property path
HEF file path.
get_network_group_names()
Get the names of the network groups in this HEF.
get_network_groups_infos()
Get information about the network groups in this HEF.
get_input_vstream_infos(name=None)
Get input vstreams information.
Page 250 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns with all the information objects of all input and output vstreams
Returns with all the information objects of all input and output streams
get_vstream_name_from_original_name(original_name, network_group_name=None)
Get vstream name from original layer name for a specific network group.
Parameters
Returns the matching vstream name for the provided original name.
get_original_names_from_vstream_name(vstream_name, network_group_name=None)
Get original names list from vstream name for a specific network group.
Parameters
Returns all the matching original layers names for the provided vstream name.
Page 251 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
get_vstream_names_from_stream_name(stream_name, network_group_name=None)
Get vstream names list from their underlying stream name for a specific network group.
Parameters
Returns All the matching vstream names for the provided stream name.
get_stream_names_from_vstream_name(vstream_name, network_group_name=None)
Get stream name from vstream name for a specific network group.
Parameters
Returns All the underlying streams names for the provided vstream name.
Represents pcie device info, includeing domain, bus, device and function.
classmethod argument_type(board_location_str)
PcieDeviceInfo Argument type for argparse parsers
class hailo_platform.pyhailort.pyhailort.ConfiguredNetwork(configured_network)
Bases: object
__init__(configured_network)
get_networks_names()
activate(network_group_params=None)
Activate this network group in order to infer data through it.
Note: Usage of activate when scheduler enabled is deprecated. On this case, this function will return
None and print deprecation warning.
wait_for_activation(timeout_ms=None)
Block until activated, or until timeout_ms is passed.
Page 252 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns hailo_platform.pyhailort._pyhailort.
ActivateNetworkGroupParams.
property name
get_output_shapes()
get_sorted_output_names()
get_input_vstream_infos(network_name=None)
Get input vstreams information.
Returns with all the information objects of all input and output vstreams
Page 253 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns with all the information objects of all input and output streams
get_vstream_names_from_stream_name(stream_name)
Get vstream names list from their underlying stream name for a specific network group.
set_scheduler_timeout(timeout_ms, network_name=None)
Sets the maximum time period that may pass before receiving run time from the scheduler.
This will occur providing at least one send request has been sent, there is no mini-
mum requirement for send requests, (e.g. threshold - see ConfiguredNetwork.
set_scheduler_threshold()).
set_scheduler_threshold(threshold)
Sets the minimum number of send requests required before the network is considered ready to get run time from th
If at least one send request has been sent, but the threshold is not reached within a set time period
(e.g. timeout - see ConfiguredNetwork.set_scheduler_timeout()), the scheduler
will consider the network ready regardless.
set_scheduler_priority(priority )
Sets the priority of the network. When the model scheduler will choose the next network, networks
with higher priority will be prioritized in the selection. bigger number represent higher priority.
init_cache(read_offset, write_offset_delta)
get_cache_info()
update_cache_offset(offset_delta_bytes)
class hailo_platform.pyhailort.pyhailort.ActivatedNetworkContextManager(configured_network, ...
Bases: object
A context manager that returns the activated network group upon enter.
__init__(configured_network, activated_network)
Page 254 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
__init__(configured_network, activated_network)
get_number_of_invalid_frames(clear=True)
Returns number of invalid frames.
Parameters clear (bool) – If set, the returned value will be the number of invalid frames
read since the last call to this function.
validate_all_frames_are_valid()
Validates that all of the frames so far are valid (no invalid frames).
class hailo_platform.pyhailort.pyhailort.FormatType
Bases: pybind11_builtins.pybind11_object
Members:
AUTO : Chosen automatically to match the format expected by the device, usually UINT8.
UINT8
UINT16
FLOAT32
__init__(*args, **kwargs)
property average_time_value_milliseconds
float, Average time in milliseconds between sampels
property average_value
float, The average value of the samples that were sampled
property min_value
float, The minimum value of the samples that were sampled
property total_number_of_samples
uint, The number of samples that were sampled
Page 255 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailo_platform.pyhailort.pyhailort.MeasurementBufferIndex
Bases: pybind11_builtins.pybind11_object
Members:
MEASUREMENT_BUFFER_INDEX_0
MEASUREMENT_BUFFER_INDEX_1
MEASUREMENT_BUFFER_INDEX_2
MEASUREMENT_BUFFER_INDEX_3
MEASUREMENT_BUFFER_INDEX_0 =
<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: 0>
MEASUREMENT_BUFFER_INDEX_1 =
<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_1: 1>
MEASUREMENT_BUFFER_INDEX_2 =
<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_2: 2>
MEASUREMENT_BUFFER_INDEX_3 =
<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_3: 3>
__init__(self: hailo_platform.pyhailort._pyhailort.MeasurementBufferIndex, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.PowerMeasurementTypes
Bases: pybind11_builtins.pybind11_object
Enum-like class representing the different power measurement types. This determines what would be mea-
sured on the device.
Members:
Enum-like class representing the different DVMs that can be measured. This determines the device that would
be measured.
Members:
Page 256 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
VDD_CORE : Perform measurements over the core. Exists only in Hailo-8 EVB.
VDD_IO : Perform measurements over the IO. Exists only in Hailo-8 EVB.
MIPI_AVDD : Perform measurements over the MIPI avdd. Exists only in Hailo-8 EVB.
MIPI_AVDD_H : Perform measurements over the MIPI avdd_h. Exists only in Hailo-8 EVB.
USB_AVDD_IO : Perform measurements over the IO. Exists only in Hailo-8 EVB.
VDD_TOP : Perform measurements over the top. Exists only in Hailo-8 EVB.
USB_AVDD_IO_HV : Perform measurements over the USB_AVDD_IO_HV. Exists only in Hailo-8 EVB.
AVDD_H : Perform measurements over the AVDD_H. Exists only in Hailo-8 EVB.
SDIO_VDD_IO : Perform measurements over the SDIO_VDDIO. Exists only in Hailo-8 EVB.
Enum-like class representing all bit options and related conversion times for each bit setting for Bus Voltage
and Shunt Voltage.
Members:
Page 257 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Enum-like class representing all the AVG bit settings and related number of averages for each bit setting.
Members:
Members:
RGB_444
RGB_555
RGB_565
RGB_666
Page 258 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
RGB_888
RAW_6
RAW_7
RAW_8
RAW_10
RAW_12
RAW_14
Members:
PIXELS_PER_CLOCK_1
PIXELS_PER_CLOCK_2
PIXELS_PER_CLOCK_4
Members:
SELECTION_80_TO_100_MBPS
SELECTION_100_TO_120_MBPS
SELECTION_120_TO_160_MBPS
SELECTION_160_TO_200_MBPS
Page 259 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
SELECTION_200_TO_240_MBPS
SELECTION_240_TO_280_MBPS
SELECTION_280_TO_320_MBPS
SELECTION_320_TO_360_MBPS
SELECTION_360_TO_400_MBPS
SELECTION_400_TO_480_MBPS
SELECTION_480_TO_560_MBPS
SELECTION_560_TO_640_MBPS
SELECTION_640_TO_720_MBPS
SELECTION_720_TO_800_MBPS
SELECTION_800_TO_880_MBPS
SELECTION_880_TO_1040_MBPS
SELECTION_1040_TO_1200_MBPS
SELECTION_1200_TO_1350_MBPS
SELECTION_1350_TO_1500_MBPS
SELECTION_1500_TO_1750_MBPS
SELECTION_1750_TO_2000_MBPS
SELECTION_2000_TO_2250_MBPS
SELECTION_2250_TO_2500_MBPS
SELECTION_AUTOMATIC
SELECTION_100_TO_120_MBPS =
<MipiClockSelection.SELECTION_100_TO_120_MBPS: 1>
SELECTION_1040_TO_1200_MBPS =
<MipiClockSelection.SELECTION_1040_TO_1200_MBPS: 16>
SELECTION_1200_TO_1350_MBPS =
<MipiClockSelection.SELECTION_1200_TO_1350_MBPS: 17>
SELECTION_120_TO_160_MBPS =
<MipiClockSelection.SELECTION_120_TO_160_MBPS: 2>
SELECTION_1350_TO_1500_MBPS =
<MipiClockSelection.SELECTION_1350_TO_1500_MBPS: 18>
SELECTION_1500_TO_1750_MBPS =
<MipiClockSelection.SELECTION_1500_TO_1750_MBPS: 19>
SELECTION_160_TO_200_MBPS =
<MipiClockSelection.SELECTION_160_TO_200_MBPS: 3>
SELECTION_1750_TO_2000_MBPS =
<MipiClockSelection.SELECTION_1750_TO_2000_MBPS: 20>
SELECTION_2000_TO_2250_MBPS =
<MipiClockSelection.SELECTION_2000_TO_2250_MBPS: 21>
SELECTION_200_TO_240_MBPS =
<MipiClockSelection.SELECTION_200_TO_240_MBPS: 4>
SELECTION_2250_TO_2500_MBPS =
<MipiClockSelection.SELECTION_2250_TO_2500_MBPS: 22>
Page 260 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
SELECTION_240_TO_280_MBPS =
<MipiClockSelection.SELECTION_240_TO_280_MBPS: 5>
SELECTION_280_TO_320_MBPS =
<MipiClockSelection.SELECTION_280_TO_320_MBPS: 6>
SELECTION_320_TO_360_MBPS =
<MipiClockSelection.SELECTION_320_TO_360_MBPS: 7>
SELECTION_360_TO_400_MBPS =
<MipiClockSelection.SELECTION_360_TO_400_MBPS: 8>
SELECTION_400_TO_480_MBPS =
<MipiClockSelection.SELECTION_400_TO_480_MBPS: 9>
SELECTION_480_TO_560_MBPS =
<MipiClockSelection.SELECTION_480_TO_560_MBPS: 10>
SELECTION_560_TO_640_MBPS =
<MipiClockSelection.SELECTION_560_TO_640_MBPS: 11>
SELECTION_640_TO_720_MBPS =
<MipiClockSelection.SELECTION_640_TO_720_MBPS: 12>
SELECTION_720_TO_800_MBPS =
<MipiClockSelection.SELECTION_720_TO_800_MBPS: 13>
SELECTION_800_TO_880_MBPS =
<MipiClockSelection.SELECTION_800_TO_880_MBPS: 14>
SELECTION_80_TO_100_MBPS =
<MipiClockSelection.SELECTION_80_TO_100_MBPS: 0>
SELECTION_880_TO_1040_MBPS =
<MipiClockSelection.SELECTION_880_TO_1040_MBPS: 15>
SELECTION_AUTOMATIC = <MipiClockSelection.SELECTION_AUTOMATIC: 63>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiClockSelection, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiIspImageInOrder
Bases: pybind11_builtins.pybind11_object
Members:
B_FIRST
GB_FIRST
GR_FIRST
R_FIRST
Page 261 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailo_platform.pyhailort.pyhailort.MipiIspImageOutDataType
Bases: pybind11_builtins.pybind11_object
Members:
RGB_888
YUV_422
Members:
LIGHT_FREQ_60_HZ
LIGHT_FREQ_50_HZ
Members:
BIG_ENDIAN
LITTLE_ENDIAN
Parameters
• quantized – Unused.
Page 262 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• format_type (FormatType) – The default format type of the data for all input
virtual streams. The default is AUTO, which means the data is fed in the same format
expected by the device (usually uint8).
• timeout_ms (int) – The default timeout in milliseconds for all input virtual streams.
Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout
will be raised.
Returns The created virtual streams params. The keys are the vstreams names. The values
are the params.
Parameters
• quantized – Unused.
• format_type (FormatType) – The default format type of the data for all input
virtual streams. The default is AUTO, which means the data is fed in the same format
expected by the device (usually uint8).
• timeout_ms (int) – The default timeout in milliseconds for all input virtual streams.
Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout
will be raised.
Returns The created virtual streams params. The keys are the vstreams names. The values
are the params.
class hailo_platform.pyhailort.pyhailort.OutputVStreamParams
Bases: object
Parameters
• quantized – Unused.
• format_type (FormatType) – The default format type of the data for all output
virtual streams. The default is AUTO, which means the returned data is in the same
format returned from the device (usually uint8).
Page 263 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• timeout_ms (int) – The default timeout in milliseconds for all output virtual streams.
Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout
will be raised.
Returns The created virtual streams params. The keys are the vstreams names. The values
are the params.
Parameters
• quantized – Unused.
• format_type (FormatType) – The default format type of the data for all output
virtual streams. The default is AUTO, which means the returned data is in the same
format returned from the device (usually uint8).
• timeout_ms (int) – The default timeout in milliseconds for all output virtual streams.
Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout
will be raised.
Returns The created virtual streams params. The keys are the vstreams names. The values
are the params.
Parameters
• quantized – Unused.
• format_type (FormatType) – The default format type of the data for all output
virtual streams. The default is AUTO, which means the returned data is in the same
format returned from the device (usually uint8).
• timeout_ms (int) – The default timeout in milliseconds for all output virtual streams.
Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout
will be raised.
Page 264 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Each element in the list represent a group of params, where the keys are the vstreams
names, and the values are the params. The params groups are splitted with respect to their
underlying streams for multi process usges.
Input vstreams pipelines that allows to send data, to be used as a context manager.
__init__(configured_network, input_vstreams_params)
Constructor for the InputVStreams class.
Parameters
get(name=None)
Return a single input vstream by its name.
Parameters name (str) – The vstream name. If name=None and there is a single input
vstream, that single (InputVStream) will be returned. Otherwise, if name=None and
there are multiple input vstreams, an exception will be thrown.
Output virtual streams pipelines that allows to receive data, to be used as a context manager.
Parameters
Parameters name (str) – The vstream name. If name=None and there is a single output
vstream, that single (OutputVStream) will be returned. Otherwise, if name=None and
there are multiple output vstreams, an exception will be thrown.
Page 265 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailo_platform.pyhailort.pyhailort.InputVStream(send_object)
Bases: object
__init__(send_object)
property shape
property dtype
property name
property network_name
send(input_data)
Send frames to inference.
property info
class hailo_platform.pyhailort.pyhailort.OutputVStream(configured_network, ...)
Bases: object
Returns The output of the inference for a single frame. The returned tensor does not in-
clude the batch dimension. In case of nms output and tf_nms_format=False, returns list
of numpy.ndarray.
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_iou_threshold(threshold)
Set NMS intersection over union overlap Threshold, used in the NMS iterative elimination process
where potential duplicates of detected items are suppressed.
Page 266 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_max_proposals_per_class(max_proposals_per_class)
Set a limit for the maximum number of boxes per class.
Note: This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)
Set maximum accumulated mask size for all the detections in a frame. Used in order to change the
output buffer frame size, in cases where the output buffer is too small for all the segmentation
detections.
Note: This function must be called before starting inference! This function will fail in cases where there
is no output with NMS operations on the CPU.
Parameters
Parameters input_data (dict of numpy.ndarray) – Where the key is the name of the
input_layer, and the value is the data to run inference on.
Page 267 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Returns Output tensors of all output layers. The keys are outputs names and the values are
output data tensors as numpy.ndarray (or list of numpy.ndarray in case of nms
output and tf_nms_format=False).
get_hw_time()
Get the hardware device operation time it took to run inference over the last batch.
get_total_time()
Get the total time it took to run inference over the last batch.
set_nms_score_threshold(threshold)
Set NMS score threshold, used for filtering out candidates. Any box with score<TH is suppressed.
Note: This function will fail in cases where there is no output with NMS operations on the CPU.
set_nms_iou_threshold(threshold)
Set NMS intersection over union overlap Threshold, used in the NMS iterative elimination process
where potential duplicates of detected items are suppressed.
Note: This function will fail in cases where there is no output with NMS operations on the CPU.
set_nms_max_proposals_per_class(max_proposals_per_class)
Set a limit for the maximum number of boxes per class.
Note: This function must be called before starting inference! This function will fail in cases where there
is no output with NMS operations on the CPU.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)
Set maximum accumulated mask size for all the detections in a frame. Used in order to change the
output buffer frame size, in cases where the output buffer is too small for all the segmentation
detections.
Note: This function must be called before starting inference! This function will fail in cases where there
is no output with NMS operations on the CPU.
Page 268 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
__init__(*args, **kwargs)
equals(self: hailo_platform.pyhailort._pyhailort.TemperatureInfo, arg0: ...)
property sample_count
property ts0_temperature
property ts1_temperature
class hailo_platform.pyhailort.pyhailort.Control(device: ...)
Bases: object
The control object of this device, which implements the control API of the Hailo device. Should be used only
from Device.control
WORD_SIZE = 4
__init__(device: hailo_platform.pyhailort._pyhailort.Device)
property device_id
Getter for the device_id.
Returns A string ID of the device. BDF for PCIe devices, IP address for Ethernet devices, “Inte-
grated” for integrated nnc devices.
open()
Initializes the resources needed for using a control device.
close()
Releases the resources that were allocated for the control device.
chip_reset()
Resets the device (chip reset).
nn_core_reset()
Resets the nn_core.
soft_reset()
reloads the device firmware (soft reset)
forced_soft_reset()
reloads the device firmware (forced soft reset)
read_memory(address, data_length)
Reads memory from the Hailo chip. Byte order isn’t changed. The core uses little-endian byte order.
Parameters
Page 269 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
write_memory(address, data_buffer)
Write memory to Hailo chip. Byte order isn’t changed. The core uses little-endian byte order.
Parameters
Parameters
Parameters
• dvm (DvmTypes) – Which DVM will be measured. Default (AUTO) will be different
according to the board:
Returns
For PowerMeasurementTypes:
Note: This function can perform measurements for more than just power. For all supported measure-
ment types, please look at PowerMeasurementTypes.
Parameters
Page 270 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
[ms] and checks the sensor. If there is a new‘ value to read from the sensor, the firmware
reads it. Note that the average calculated by the firmware is “average of averages”, be-
cause it averages values that have already been averaged by the sensor.
stop_power_measurement()
Stop performing a long power measurement. Deletes all saved results from the firmware. Calling the
function eliminates the start function settings for the averaging the samples, and returns to the default
values, so the sensor will return a new value every 2.2 ms without averaging values.
set_power_measurement(buffer_index=<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: ...)
Set parameters for long power measurement on an Hailo chip.
Parameters
Note: This function can perform measurements for more than just power. For all supported measure-
ment types view PowerMeasurementTypes
get_power_measurement(buffer_index=<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: ...)
Read measured power from a long power measurement
Parameters
Returns
For PowerMeasurementTypes:
Note: This function can perform measurements for more than just power. For all supported measure-
ment types view PowerMeasurementTypes.
Page 271 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
read_user_config()
Read the user configuration section as binary data.
write_user_config(configuration)
Write the user configuration.
read_board_config()
Read the board configuration section as binary data.
write_board_config(configuration)
Write the static configuration.
identify()
Gets the Hailo chip identification.
Returns BoardInformation
core_identify()
Gets the Core Hailo chip identification.
Returns CoreInformation
set_fw_logger(level, interface_mask)
Configure logger level and interface of sending.
Parameters
get_throttling_state()
Get the current throttling state of temperature protection and overcurrent protection components.
If any throttling is enabled, the function return true.
Parameters
Page 272 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• register_address (int) – The address of the register to which the data will be
written.
Parameters
• register_address (int) – The address of the register from which the data will
be read.
read_register(address)
Read the value of a register from a given address.
set_bit(address, bit_index)
Set (turn on) a specific bit at a register from a given address.
Parameters
Parameters
Parameters
second_stage_update(second_stage_binary )
Update second stage binary on the flash
Parameters
Page 273 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Returns Sensor sections info read from the chip flash memory.
Parameters
Parameters
Parameters section_index (int) – Flash section index to load config from. [0-6]
reset_sensor(section_index)
Reset the sensor that is related to the section index config.
Page 274 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Returns Temperature in celsius of the 2 internal temperature sensors (TS), and a sample count
(a running 16-bit counter)
Returns
Parameters
Note: The notifications thread is started and closed in the use_device() context, so notifications can only
be received there.
remove_notification_callback(notification_id)
Remove a notification callback which was already set.
Page 275 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
class hailo_platform.pyhailort.pyhailort.Device(device_id=None)
Bases: object
classmethod scan()
Scans for all devices on the system.
__init__(device_id=None)
Create the Hailo device object.
Parameters device_id (str) – Device id string, can represent several device types: [-] for
pcie devices - pcie bdf (XXXX:XX:XX.X) [-] for ethernet devices - ip address (xxx.xxx.xxx.xxx)
release()
Release the allocated resources of the device. This function should be called when working with the device
not as context-manager.
property device_id
Getter for the device_id.
Returns A string ID of the device. BDF for PCIe devices, IP address for Ethernet devices, “Inte-
grated” for integrated nnc devices.
configure(hef, configure_params_by_name={})
Configures target device from HEF object.
Parameters
property control
Returns the control object of this device, which implements the control API of the Hailo device.
read_log(count, cpu_id)
Parameters
Returns List of the the configured network groups loaded on the device.
Page 276 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
__init__(params=None, *, device_ids=None)
Create the Hailo virtual device object.
Parameters
• params (hailo_platform.pyhailort.pyhailort.
VDeviceParams, optional) – VDevice params, call VDevice.
create_params() to get default params. Excludes ‘device_ids’.
• device_ids (list of str, optional) – devices ids to create VDevice from,
call Device.scan() to get list of all available devices. Excludes ‘params’. Cannot be
used together with device_id.
release()
Release the allocated resources of the device. This function should be called when working with the device
not as context-manager.
static create_params()
configure(hef, configure_params_by_name={})
Configures target vdevice from HEF object.
Parameters
get_physical_devices()
Gets the underlying physical devices.
get_physical_devices_ids()
Gets the physical devices ids.
Parameters
• hef_source (str or bytes) – The source from which the HEF object will be cre-
ated. If the source type is str, it is treated as a path to an hef file. If the source type is
bytes, it is treated as a buffer. Any other type will raise a ValueError.
Note: create_infer_model must be called from the same process the VDevice is created in, otherwise an
HailoRTException will be raised.
Page 277 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Note: as long as the InferModel object is alive, the VDevice object is alive as well.
property loaded_network_groups
Getter for the property _loaded_network_groups.
Returns List of the the configured network groups loaded on the device.
Contains all of the necessary information for configuring the network for inference. This class is used to set up
the model for inference and includes methods for setting and getting the model’s parameters. By calling the
configure function, the user can create a ConfiguredInferModel object, which is used to run inference.
class InferStream(infer_stream)
Bases: object
Represents the parameters of a stream. In default, the stream’s parameters are set to the default values
of the model. The user can change the stream’s parameters by calling the setter functions.
__init__(infer_stream)
property name
Returns: name (str): the name of the edge.
property shape
Returns: shape (list[int]): the shape of the edge.
property format
Returns: format (_pyhailort.hailo_format_t): the format of the edge.
set_format_type(type)
Set the format type of the stream.
Parameters type (_pyhailort.hailo_format_type_t) – the format type
set_format_order(order)
Set the format order of the stream.
Parameters order (_pyhailort.hailo_format_order_t) – the format or-
der
property quant_infos
Returns: quant_infos (list[_pyhailort.hailo_quant_info_t]): List of the quantization information of the
edge.
property is_nms
Returns: is_nms (bool): whether the stream is NMS.
set_nms_score_threshold(threshold)
Set NMS score threshold, used for filtering out candidates. Any box with score<TH is suppressed.
Parameters threshold (float) – NMS score threshold to set.
Note: This function is invalid in cases where the edge has no NMS operations on the CPU. It will not
fail, but make the configure() function fail.
set_nms_iou_threshold(threshold)
Set NMS intersection over union overlap Threshold, used in the NMS iterative elimination process
where potential duplicates of detected items are suppressed.
Parameters threshold (float) – NMS IoU threshold to set.
Note: This function is invalid in cases where the edge has no NMS operations on the CPU. It will not
fail, but make the configure() function fail.
Page 278 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
set_nms_max_proposals_per_class(max_proposals)
Set a limit for the maximum number of boxes per class.
Parameters max_proposals (int) – NMS max proposals per class to set.
Note: This function is invalid in cases where the edge has no NMS operations on the CPU. It will not
fail, but make the configure() function fail.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)
Set maximum accumulated mask size for all the detections in a frame.
Parameters max_accumalated_mask_size (int) – NMS max accumulated mask
size.
Note: Used in order to change the output buffer frame size in cases where the output buffer is too
small for all the segmentation detections.
Note: This function is invalid in cases where the edge has no NMS operations on the CPU. It will not
fail, but make the configure() function fail.
__init__(infer_model, hef_path)
property hef
Returns: HEF: the HEF object of the model
set_batch_size(batch_size)
Sets the batch size of the InferModel. This parameter determines the number of frames to be sent for
inference in a single batch. If a scheduler is enabled, this parameter determines the ‘burst size’: the max
number of frames after which the scheduler will attempt to switch to another model.
set_power_mode(power_mode)
Sets the power mode of the InferModel
configure()
Configures the InferModel object. Also checks the validity of the configuration’s formats.
Note: A ConfiguredInferModel should be used inside a context manager, and should not be
passed to a different process.
property input_names
Returns: names (list[str]): The input names of the InferModel.
property output_names
Returns: names (list[str]): The output names of the InferModel.
Page 279 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
property inputs
Returns: inputs (list[InferStream]): List of input InferModel.InferStream.
property outputs
Returns: outputs (list[InferStream]): List of output InferModel.InferStream.
input(name=” )
Gets an input’s InferModel.InferStream.
Parameters name (str, optional) – the name of the input stream. Required in case of
multiple inputs.
Raises
• HailoRTNotFoundException –
• but multiple inputs exist. –
output(name=” )
Gets an output’s InferModel.InferStream.
Parameters name (str, optional) – the name of the output stream. Required in case of
multiple outputs.
Raises
• HailoRTNotFoundException –
• but multiple outputs exist. –
class hailo_platform.pyhailort.pyhailort.ConfiguredInferModel(configured_infer_model, ...)
Bases: object
Note: Passing an instance of ConfiguredInferModel to a different process is not supported and would
lead to an undefined behavior.
format_order: hailo_platform.pyhailort._pyhailort.FormatOrder
input_height: int
input_width: int
number_of_classes: int
max_bboxes_per_class: int
quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo
output_dtype: numpy.dtype = dtype('float32')
batch_size: int = 1
__init__(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, ...)
class NmsHailoTransformationInfo(format_order: ...)
Bases: hailo_platform.pyhailort.pyhailort.ConfiguredInferModel.
NmsTransformationInfo
Page 280 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Represents an asynchronous infer request - holds the input and output buffers of the request. A request
represents a single frame.
Holds the input and output buffers of the Bindings infer request
__init__(infer_stream, nms_info=None)
set_buffer(buffer)
Sets the edge’s buffer to a new one.
Parameters buffer (numpy.array) – The new buffer to set. The array’s shape
should match the edge’s shape.
get_buffer(tf_format=False)
Gets the edge’s buffer.
Parameters tf_format (bool, optional) – Whether the output format is tf or
hailo. Relevant for NMS outputs. The output can be re-formatted into two formats (TF,
Hailo) and the user through choosing the True/False function parameter, can decide
which format to receive. For detection outputs: TF format is an numpy.array with
shape [number of classes, bounding box params, max bounding boxes per class] where
the 3rd dimension (bounding box params) is of a fixed length of 5 (y_min, x_min, y_max,
x_max, score).
Hailo format is a list of detections per class: [[class_0 detections], [class_1 detections], …
[class_n-1 detections]] where each detection is an numpy.array with shape (y_min,
x_min, y_max, x_max, score).
Page 281 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Raises
• HailoRTNotFoundException –
• but multiple inputs exist. –
output(name=” )
Gets an output’s InferStream object.
Parameters name (str, optional) – the name of the output stream. Required in cae
of multiple outputs.
Returns ConfiguredInferModel.Bindings.InferStream - the output in-
fer stream of the configured infer model.
Raises
• HailoRTNotFoundException –
• but multiple outputs exist. –
get()
Gets the internal bindings object.
Returns the internal bindings object.
Return type _bindings (_pyhailort.ConfiguredInferModelBindingsWrapper)
__init__(configured_infer_model, infer_model)
activate()
Activates hailo device inner-resources for inference. Calling this function is invalid in case scheduler is
enabled.
Raises HailoRTException –
deactivate()
Deactivates hailo device inner-resources for inference. Calling this function is invalid in case scheduler is
enabled.
Raises HailoRTException –
create_bindings(input_buffers=None, output_buffers=None)
Creates a Bindings object.
Parameters
• (dict[str – numpy.array], optional): The output buffers for the Bindings ob-
ject. Keys are the output names, and values are their corresponding buffers. See
get_buffer() for more information.
Returns Bindings object
Parameters
• timeout_ms (int, optional) – Amount of time to wait until the model is ready
in milliseconds.
• frames_count (int, optional) – The count of buffers you intent to infer in the
next request. Useful for batch inference. Default is 1
Raises
• HailoRTTimeout –
• HailoRTException –
Page 282 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
run(bindings, timeout)
Launches a synchronous inference operation with the provided bindings.
Parameters
• bindings (list of) – The bindings for the inputs and outputs of the model. A list
with a single binding is valid. Multiple bindings are useful for batch inference.
• HailoRTException –
• HailoRTTimeout –
run_async(bindings, callback=None)
Launches an asynchronous inference operation with the provided bindings.
Parameters
• bindings (list of) – The bindings for the inputs and outputs of the model. A list
with a single binding is valid. Multiple bindings are useful for batch inference.
Note: As a standard, callbacks should be executed as quickly as possible. In case of an error, the pipeline
will be shut down.
Raises HailoRTException –
set_scheduler_timeout(timeout_ms)
Sets the minimum number of send requests required before the network is considered ready to get
run time from the scheduler. Sets the maximum time period that may pass before receiving run
time from the scheduler. This will occur providing at least one send request has been sent, there is
no minimum requirement for send requests, (e.g. threshold - see ConfiguredInferModel.
set_scheduler_threshold()).
The new time period will be measured after the previous time the scheduler allocated run time
to this network group. Using this function is only allowed when scheduling_algorithm is not
HAILO_SCHEDULING_ALGORITHM_NONE. The default timeout is 0ms.
Parameters timeout_ms (int) – The maximum time to wait for the scheduler to provide
run time, in milliseconds.
Raises HailoRTException –
set_scheduler_threshold(threshold)
Sets the minimum number of send requests required before the network is considered ready to get run
time from the scheduler.
Page 283 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Raises HailoRTException –
set_scheduler_priority(priority )
Sets the priority of the network. When the network group scheduler will choose the next network, net-
works with higher priority will be prioritized in the selection. bigger number represent higher priority.
Raises HailoRTException –
get_async_queue_size()
Returns Expected of a the number of inferences that can be queued simultaneously for execution.
Returns the number of inferences that can be queued simultaneously for execution
Raises HailoRTException –
shutdown()
Shuts the inference down. After calling this method, the model is no longer usable.
class hailo_platform.pyhailort.pyhailort.AsyncInferJob(job)
Bases: object
Hailo Asynchronous Inference Job Wrapper. It holds the result of the inference job (once ready), and provides
an async poll method to check the job status.
MILLISECOND = 0.001
__init__(job)
wait(timeout_ms)
Waits for the asynchronous inference job to finish. If the async job and its callback have not completed
within the given timeout, a HailoRTTimeout exception will be raised.
__init__(exception)
property exception
Returns the exception that was set on this Infer job. if the job finished succesfully, returns None.
class hailo_platform.pyhailort.pyhailort.HailoRTTransformUtils
Bases: object
static get_dtype(data_bytes)
Get data type from the number of bytes.
Parameters
Page 284 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
Parameters
• dst_buffer (numpy.ndarray) – The buffer that will contain the quantized data.
The buffer’s data type is the destination data type.
14.3. hailo_platform.pyhailort.control_object
exception hailo_platform.pyhailort.control_object.ControlObjectException
Bases: Exception
exception hailo_platform.pyhailort.control_object.FirmwareUpdateException
Bases: Exception
Control object that uses the HCP protocol for controlling the device.
Page 285 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
Parameters
• remote_ip (str) – The IPv4 address of the remote Hailo device (X.X.X.X).
• remote_control_port (int, optional) – The port that the remote Hailo de-
vice listens on.
__init__(device=None, device_info=None)
Initializes a new HailoPcieController object.
14.4. hailo_platform.pyhailort.hailo_controller.i2c_slaves
hailo_platform.pyhailort.i2c_slaves.NO_I2C_SWITCH = 5
Variable which defines that the I2C slave is not behind a switch.
exception hailo_platform.pyhailort.i2c_slaves.I2CSlavesException
Bases: Exception
Parameters
property bus_index
Get bus index the I2C slave is connected to.
property slave_address
Get the address of the salve.
Page 286 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
property register_address_size
Get the slave register address length (in bytes). This number represents how many bytes are in the reg-
ister address the slave can access.
property switch_number
Get the switch number the slave is connected to.
property endianness
Get the slave endianness.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_MIPI_AVDD
Class which represents the MIPI AVDD I2C slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_USB_AVDD_IO
Class which represents the USB AVDD IO slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_VDD_CORE
Class which represents the V_CORE slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_VDD_TOP
Class which represents the VDD TOP slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_MIPI_AVDD_H
Class which represents the MIPI AVDD_H I2C slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_USB_AVDD_IO_HV
Class which represents the DVM USB AVDD IO HV slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_VDD_IO
Class which represents the DVM_VDDIO slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_AVDD_H
Class which represents the DVM_AVDD_H slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_SDIO_VDD_IO
Class which represents the DVM_SDIO_VDDIO slave.
hailo_platform.pyhailort.i2c_slaves.
I2C_SLAVE_M_DOT_2_OVERCURREN_PROTECTION
Class which represents the DVM_SDIO_VDDIO slave.
Page 287 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_I2S_CODEC
Class which represents the I2S codec I2C slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_I2C_TO_GPIO
Class which represents the I2C to gpio I2C slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_SWITCH
Class which represents the I2C switch slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_TEMP_SENSOR_0
Class which represents the I2C TEMP_sensor_0 slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_TEMP_SENSOR_1
Class which represents the I2S TEMP_sensor_1 slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_EEPROM
Class which represents the EEPROM I2C slave.
hailo_platform.pyhailort.i2c_slaves.I2C_SLAVE_RASPICAM
Class which represents the raspicam I2C slave.
Parameters
14.5. hailo_platform.tools.udp_rate_limiter
Tool for limiting the packet sending rate via UDP. Needed to ensure the board will not get more traffic than it can
handle, which would cause packet loss.
exception hailo_platform.tools.udp_rate_limiter.RateLimiterException
Bases: Exception
exception hailo_platform.tools.udp_rate_limiter.BadTCParamError
Bases: Exception
exception hailo_platform.tools.udp_rate_limiter.BadTCCallError
Bases: Exception
Parameters
Page 288 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
• fps_factor (float) – Safety factor by which to multiply the calculated UDP rate.
• remote_ip (str) – Device IP address.
class hailo_platform.tools.udp_rate_limiter.UDPRateLimiter(remote_ip, port, ...)
Bases: object
Parameters
Returns Maps between each input default dport to its calculated Rate in Kbits/sec.
Page 289 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.
HailoRT User Guide
h
hailo_platform.drivers, 246
hailo_platform.pyhailort.control_object,
285
hailo_platform.pyhailort.hw_object,
246
hailo_platform.pyhailort.i2c_slaves,
286
hailo_platform.pyhailort.pyhailort,
249
hailo_platform.tools.udp_rate_limiter,
288
Page 290 Release 4.18.0 Confidential and Proprietary | Copyright © 2024 – Hailo Technologies Ltd.