This commit is contained in:
HailoRT-Automation
2025-07-14 15:13:59 +03:00
committed by GitHub
parent 0df636dcb6
commit 8445792b5e
52 changed files with 298 additions and 94 deletions

View File

@@ -29,7 +29,7 @@ endif()
# Set firmware version
add_definitions( -DFIRMWARE_VERSION_MAJOR=4 )
add_definitions( -DFIRMWARE_VERSION_MINOR=21 )
add_definitions( -DFIRMWARE_VERSION_MINOR=22 )
add_definitions( -DFIRMWARE_VERSION_REVISION=0 )
if(HAILO_BUILD_SERVICE)
add_definitions( -DHAILO_SUPPORT_MULTI_PROCESS )

View File

@@ -7,7 +7,7 @@
#define _HAILO_IOCTL_COMMON_H_
#define HAILO_DRV_VER_MAJOR 4
#define HAILO_DRV_VER_MINOR 21
#define HAILO_DRV_VER_MINOR 22
#define HAILO_DRV_VER_REVISION 0
#define _STRINGIFY_EXPANDED( x ) #x

View File

@@ -11,12 +11,29 @@
#include "firmware_header_utils.h"
#include "common/utils.hpp"
static const char *NOT_CONFIGURED_ATTR = "<N/A>";
static const uint8_t INVALID_LCS = 0;
#define MHz (1000 * 1000)
// returns a valid string if the attribute is not empty, otherwise returns an empty string
static std::string valid_attr_str(const std::string& key, const char *attr, size_t attr_max_len)
{
size_t actual_len = strnlen(attr, attr_max_len);
if (0 == actual_len) {
return "";
}
return key + ": " + std::string(attr, actual_len) + "\n";
}
static std::string valid_attr_str(const std::string& key, uint8_t attr, uint8_t invalid_value)
{
if (attr == invalid_value) {
return "";
}
return key + ": " + std::to_string(attr);
}
static std::string extended_device_information_boot_string(hailo_device_boot_source_t boot_source)
{
switch (boot_source) {
@@ -72,14 +89,6 @@ static bool extended_device_information_is_array_not_empty(const uint8_t *array_
return false;
}
static std::string lcs_string(uint8_t lcs)
{
if (INVALID_LCS == lcs) {
return NOT_CONFIGURED_ATTR;
}
return std::to_string(lcs);
}
static void print_extended_device_information(const hailo_extended_device_information_t &device_info)
{
std::cout << "Boot source: " << extended_device_information_boot_string(device_info.boot_source) << std::endl;
@@ -89,7 +98,8 @@ static void print_extended_device_information(const hailo_extended_device_inform
if(supported_features_str.length() > 0) {
std::cout << "Device supported features: " << supported_features_str << std::endl;
}
std::cout << "LCS: " << lcs_string(device_info.lcs) << std::endl;
std::cout << valid_attr_str("LCS", device_info.lcs, INVALID_LCS);
if(extended_device_information_is_array_not_empty(device_info.soc_id, sizeof(device_info.soc_id))){
std::cout << "SoC ID: ";
@@ -157,15 +167,6 @@ static std::string identity_arch_string(const hailo_device_identity_t &identity)
}
}
static std::string identity_attr_string(const char *attr, size_t attr_max_len)
{
size_t actual_len = strnlen(attr, attr_max_len);
if (actual_len == 0) {
return NOT_CONFIGURED_ATTR;
}
return std::string(attr, actual_len);
}
FwControlIdentifyCommand::FwControlIdentifyCommand(CLI::App &parent_app) :
DeviceCommand(parent_app.add_subcommand("identify", "Displays general information about the device")),
m_is_extended(false)
@@ -184,12 +185,9 @@ hailo_status FwControlIdentifyCommand::execute_on_device(Device &device)
std::cout << "Logger Version: " << identity.logger_version << std::endl;
std::cout << "Board Name: " << std::string(identity.board_name, identity.board_name_length) << std::endl;
std::cout << "Device Architecture: " << identity_arch_string(identity) << std::endl;
std::cout << "Serial Number: " <<
identity_attr_string(identity.serial_number, identity.serial_number_length) << std::endl;
std::cout << "Part Number: " <<
identity_attr_string(identity.part_number, identity.part_number_length) << std::endl;
std::cout << "Product Name: " <<
identity_attr_string(identity.product_name, identity.product_name_length) << std::endl;
std::cout << valid_attr_str("Serial Number", identity.serial_number, identity.serial_number_length);
std::cout << valid_attr_str("Part Number", identity.part_number, identity.part_number_length);
std::cout << valid_attr_str("Product Name", identity.product_name, identity.product_name_length);
if (m_is_extended) {
TRY(auto device_info, device.get_extended_device_information());

View File

@@ -248,7 +248,15 @@ hailo_status MonCommand::run_monitor()
std::vector<ProtoMon> mon_messages;
if (mon_dir_valid) {
TRY(auto scheduler_mon_files, Filesystem::get_latest_files_in_dir_flat(SCHEDULER_MON_TMP_DIR, time_interval));
TRY(auto scheduler_mon_files_with_tmp, Filesystem::get_latest_files_in_dir_flat(SCHEDULER_MON_TMP_DIR, time_interval));
// Filter out .tmp files - these files are created for temporary use and should not be considered
std::vector<std::string> scheduler_mon_files;
std::copy_if(scheduler_mon_files_with_tmp.begin(), scheduler_mon_files_with_tmp.end(), std::back_inserter(scheduler_mon_files),
[](const std::string &file) {
return !Filesystem::has_suffix(file, ".tmp");
});
print_warning_msg = scheduler_mon_files.empty();
mon_messages.reserve(scheduler_mon_files.size());

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5.0)
# set(CMAKE_C_CLANG_TIDY "clang-tidy;-checks=*")
set(HAILORT_MAJOR_VERSION 4)
set(HAILORT_MINOR_VERSION 21)
set(HAILORT_MINOR_VERSION 22)
set(HAILORT_REVISION_VERSION 0)
# Add the cmake folder so the modules there are found

View File

@@ -4,7 +4,7 @@ project(gsthailo)
include(GNUInstallDirs)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
# GST_PLUGIN_DEFINE needs PACKAGE to be defined
set(GST_HAILO_PACKAGE_NAME "hailo")

View File

@@ -87,4 +87,50 @@ bool do_versions_match(GstElement *self)
return false;
}
return true;
}
}
hailo_tensor_metadata_t tensor_metadata_from_vstream_info(const hailo_vstream_info_t &vstream_info)
{
hailo_tensor_metadata_t tensor_metadata;
auto name_length = strnlen(vstream_info.name, HAILO_MAX_STREAM_NAME_SIZE);
memcpy(tensor_metadata.name, vstream_info.name, name_length);
tensor_metadata.name[name_length] = '\0';
tensor_metadata.format.type = tensor_format_type_from_vstream_format_type(vstream_info.format.type);
tensor_metadata.format.is_nms = (HAILO_FORMAT_ORDER_HAILO_NMS_BY_CLASS == vstream_info.format.order) ||
(HAILO_FORMAT_ORDER_HAILO_NMS_WITH_BYTE_MASK == vstream_info.format.order) ||
(HAILO_FORMAT_ORDER_HAILO_NMS_BY_SCORE == vstream_info.format.order);
if (tensor_metadata.format.is_nms) {
tensor_metadata.nms_shape.number_of_classes = vstream_info.nms_shape.number_of_classes;
tensor_metadata.nms_shape.max_bboxes_per_class = vstream_info.nms_shape.max_bboxes_per_class;
tensor_metadata.nms_shape.max_bboxes_total = vstream_info.nms_shape.max_bboxes_total;
tensor_metadata.nms_shape.max_accumulated_mask_size = vstream_info.nms_shape.max_accumulated_mask_size;
} else {
tensor_metadata.shape.height = vstream_info.shape.height;
tensor_metadata.shape.width = vstream_info.shape.width;
tensor_metadata.shape.features = vstream_info.shape.features;
}
tensor_metadata.quant_info.qp_zp = vstream_info.quant_info.qp_zp;
tensor_metadata.quant_info.qp_scale = vstream_info.quant_info.qp_scale;
tensor_metadata.quant_info.limvals_min = vstream_info.quant_info.limvals_min;
tensor_metadata.quant_info.limvals_max = vstream_info.quant_info.limvals_max;
return tensor_metadata;
}
HailoTensorFormatType tensor_format_type_from_vstream_format_type(hailo_format_type_t format_type)
{
switch (format_type) {
case HAILO_FORMAT_TYPE_AUTO:
return HailoTensorFormatType::HAILO_FORMAT_TYPE_AUTO;
case HAILO_FORMAT_TYPE_UINT8:
return HailoTensorFormatType::HAILO_FORMAT_TYPE_UINT8;
case HAILO_FORMAT_TYPE_UINT16:
return HailoTensorFormatType::HAILO_FORMAT_TYPE_UINT16;
case HAILO_FORMAT_TYPE_FLOAT32:
return HailoTensorFormatType::HAILO_FORMAT_TYPE_FLOAT32;
default:
return HailoTensorFormatType::HAILO_FORMAT_TYPE_MAX_ENUM;
}
}

View File

@@ -23,6 +23,7 @@
#include "hailo/device.hpp"
#include "hailo/network_group.hpp"
#include "hailo/vstream.hpp"
#include "hailo/hailo_gst_tensor_metadata.hpp"
#include "include/hailo_gst.h"
#include <vector>
@@ -282,4 +283,7 @@ GType gst_hailo_format_type_get_type (void);
bool do_versions_match(GstElement *self);
hailo_tensor_metadata_t tensor_metadata_from_vstream_info(const hailo_vstream_info_t &vstream_info);
HailoTensorFormatType tensor_format_type_from_vstream_format_type(hailo_format_type_t format_type);
#endif /* _GST_HAILO_COMMON_HPP_ */

View File

@@ -22,6 +22,8 @@
#include "hailo/buffer.hpp"
#include "hailo/hailort_common.hpp"
#include "hailo/hailort_defaults.hpp"
#include "hailo/hailo_gst_tensor_metadata.hpp"
#include "common.hpp"
#include <algorithm>
#include <unordered_map>
@@ -937,7 +939,7 @@ static void gst_hailonet_push_buffer_to_thread(GstHailoNet *self, GstBuffer *buf
// TODO: This function should be refactored. It does many unrelated things and the user need to know that he should unmap the buffer
// in case of an error. AND it does not print errors nor return an indicative status (also the comments are confusing - "continue"?)
static bool set_infos(GstParentBufferMeta *parent_buffer_meta, hailo_vstream_info_t &vstream_info, GstMapInfo &info)
static bool set_infos(GstParentBufferMeta *parent_buffer_meta, hailo_tensor_metadata_t &tensor_meta_info, GstMapInfo &info)
{
gboolean map_succeeded = gst_buffer_map(parent_buffer_meta->buffer, &info, GST_MAP_READ);
if (!map_succeeded) {
@@ -950,7 +952,7 @@ static bool set_infos(GstParentBufferMeta *parent_buffer_meta, hailo_vstream_inf
gst_buffer_unmap(parent_buffer_meta->buffer, &info);
return false;
}
vstream_info = tensor_meta->info;
tensor_meta_info = tensor_meta->info;
return true;
}
@@ -967,8 +969,8 @@ static Expected<std::unordered_map<std::string, hailo_dma_buffer_t>> gst_hailone
}
GstParentBufferMeta *parent_buffer_meta = reinterpret_cast<GstParentBufferMeta*>(meta);
GstMapInfo info;
hailo_vstream_info_t vstream_info;
bool result = set_infos(parent_buffer_meta, vstream_info, info);
hailo_tensor_metadata_t tensor_meta_info;
bool result = set_infos(parent_buffer_meta, tensor_meta_info, info);
if (result) {
TRY(auto is_dma_buf_memory, HailoDmaBuffAllocator::is_dma_buf_memory(info));
CHECK_AS_EXPECTED(is_dma_buf_memory, HAILO_INTERNAL_FAILURE, "GstMemory is not a DMA buf as expected!");
@@ -977,7 +979,7 @@ static Expected<std::unordered_map<std::string, hailo_dma_buffer_t>> gst_hailone
CHECK_AS_EXPECTED(fd != -1, HAILO_INTERNAL_FAILURE, "Failed to get FD from GstMemory!");
hailo_dma_buffer_t dma_buffer = {fd, info.size};
input_buffer_metas[vstream_info.name] = dma_buffer;
input_buffer_metas[tensor_meta_info.name] = dma_buffer;
gst_buffer_unmap(parent_buffer_meta->buffer, &info);
}
}
@@ -1015,10 +1017,10 @@ static Expected<std::unordered_map<std::string, uint8_t*>> gst_hailonet_read_inp
}
GstParentBufferMeta *parent_buffer_meta = reinterpret_cast<GstParentBufferMeta*>(meta);
GstMapInfo info;
hailo_vstream_info_t vstream_info;
bool result = set_infos(parent_buffer_meta, vstream_info, info);
hailo_tensor_metadata_t tensor_meta_info;
bool result = set_infos(parent_buffer_meta, tensor_meta_info, info);
if (result) {
input_buffer_metas[vstream_info.name] = static_cast<uint8_t*>(info.data);
input_buffer_metas[tensor_meta_info.name] = static_cast<uint8_t*>(info.data);
gst_buffer_unmap(parent_buffer_meta->buffer, &info);
}
}
@@ -1130,7 +1132,7 @@ static hailo_status gst_hailonet_call_run_async(GstHailoNet *self, const std::un
gst_buffer_unmap(info.buffer, &info.buffer_info);
GstHailoTensorMeta *buffer_meta = GST_TENSOR_META_ADD(info.buffer);
buffer_meta->info = self->impl->output_vstream_infos[output.name()];
buffer_meta->info = tensor_metadata_from_vstream_info(self->impl->output_vstream_infos[output.name()]);
(void)gst_buffer_add_parent_buffer_meta(buffer, info.buffer);
gst_buffer_unref(info.buffer);

View File

@@ -20,7 +20,7 @@
#ifndef __TENSOR_META_HPP__
#define __TENSOR_META_HPP__
#include "hailo/hailort.h"
#include "hailo/hailo_gst_tensor_metadata.hpp"
#include "include/hailo_gst.h"
#define TENSOR_META_API_NAME "GstHailoTensorMetaAPI"
@@ -50,8 +50,8 @@ inline const void *get_tensor_data(GstStructure *s) {
* inference result tensor. This metadata instances is attached to buffer by gvainference elements
*/
struct HAILORTAPI GstHailoTensorMeta {
GstMeta meta; /**< parent meta object */
hailo_vstream_info_t info; /**< struct that holds vstream info, e.g. shape, quant_info, layer_name etc... */
GstMeta meta; /**< parent meta object */
hailo_tensor_metadata_t info; /**< struct that holds tensor metadata, e.g. shape, quant_info, layer_name etc... */
};
/**

View File

@@ -254,7 +254,7 @@ hailo_status HailoRecvImpl::write_tensors_to_metadata(GstVideoFrame *frame, bool
std::chrono::time_point<std::chrono::system_clock> start_time = std::chrono::system_clock::now();
for (auto &output_info : m_output_infos) {
GstHailoTensorMeta *buffer_meta = GST_TENSOR_META_ADD(output_info.last_acquired_buffer());
buffer_meta->info = output_info.vstream_info();
buffer_meta->info = tensor_metadata_from_vstream_info(output_info.vstream_info());
(void)gst_buffer_add_parent_buffer_meta(frame->buffer, output_info.last_acquired_buffer());
output_info.unref_last_acquired_buffer();

View File

@@ -43,7 +43,7 @@ def _verify_pyhailort_lib_exists():
_verify_pyhailort_lib_exists()
__version__ = "4.21.0"
__version__ = "4.22.0"
if _pyhailort.__version__ != __version__:
raise ImportError(
f"_pyhailort version ({_pyhailort.__version__}) does not match pyhailort version ({__version__})"

View File

@@ -1588,7 +1588,7 @@ class HailoFormatFlags(_pyhailort.FormatFlags):
SUPPORTED_PROTOCOL_VERSION = 2
SUPPORTED_FW_MAJOR = 4
SUPPORTED_FW_MINOR = 21
SUPPORTED_FW_MINOR = 22
SUPPORTED_FW_REVISION = 0
MEGA_MULTIPLIER = 1000.0 * 1000.0

View File

@@ -146,6 +146,6 @@ if __name__ == "__main__":
"linux_aarch64",
],
url="https://hailo.ai/",
version="4.21.0",
version="4.22.0",
zip_safe=False,
)

View File

@@ -76,7 +76,7 @@ if(LIBHAILORT_PATH AND HAILORT_INCLUDE_DIR)
_pyhailort
PUBLIC
HAILORT_MAJOR_VERSION=4
HAILORT_MINOR_VERSION=21
HAILORT_MINOR_VERSION=22
HAILORT_REVISION_VERSION=0
)
set_target_properties(
@@ -88,7 +88,7 @@ if(LIBHAILORT_PATH AND HAILORT_INCLUDE_DIR)
elseif(LIBHAILORT_PATH OR HAILORT_INCLUDE_DIR)
message(FATAL_ERROR "Both LIBHAILORT_PATH and HAILORT_INCLUDE_DIR must be defined or none of them. LIBHAILORT_PATH: '${LIBHAILORT_PATH}', HAILORT_INCLUDE_DIR: '${HAILORT_INCLUDE_DIR}'")
else()
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
target_link_libraries(_pyhailort PRIVATE HailoRT::libhailort)
endif()

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(data_quantization_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(infer_pipeline_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(multi_device_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(multi_network_vstream_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(notification_callback_example.c PROPERTIES LANGUAGE C)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(power_measurement_example.c PROPERTIES LANGUAGE C)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(raw_async_streams_single_thread_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(raw_streams_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(switch_network_groups_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(switch_network_groups_manually_example.c PROPERTIES LANGUAGE C)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
SET_SOURCE_FILES_PROPERTIES(vstreams_example.c PROPERTIES LANGUAGE C)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_async_infer_advanced_example async_infer_advanced_example.cpp)
target_link_libraries(cpp_async_infer_advanced_example PRIVATE HailoRT::libhailort)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_async_infer_basic_example async_infer_basic_example.cpp)
target_link_libraries(cpp_async_infer_basic_example PRIVATE HailoRT::libhailort)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_infer_pipeline_example infer_pipeline_example.cpp)
target_link_libraries(cpp_infer_pipeline_example PRIVATE HailoRT::libhailort)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_multi_device_example multi_device_example.cpp)
target_link_libraries(cpp_multi_device_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_multi_network_vstream_example multi_network_vstream_example.cpp)
target_link_libraries(cpp_multi_network_vstream_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_multi_process_example multi_process_example.cpp)
target_link_libraries(cpp_multi_process_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_notification_callback_example notification_callback_example.cpp)
target_link_libraries(cpp_notification_callback_example PRIVATE HailoRT::libhailort)

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.0)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_power_measurement_example power_measurement_example.cpp)
target_link_libraries(cpp_power_measurement_example PRIVATE HailoRT::libhailort)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_raw_async_streams_multi_thread_example raw_async_streams_multi_thread_example.cpp)
target_link_libraries(cpp_raw_async_streams_multi_thread_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_raw_async_streams_single_thread_example raw_async_streams_single_thread_example.cpp)
target_link_libraries(cpp_raw_async_streams_single_thread_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_raw_streams_example raw_streams_example.cpp)
target_link_libraries(cpp_raw_streams_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_switch_network_groups_example switch_network_groups_example.cpp)
target_link_libraries(cpp_switch_network_groups_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_switch_network_groups_manually_example switch_network_groups_manually_example.cpp)
target_link_libraries(cpp_switch_network_groups_manually_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(HailoRT 4.21.0 EXACT REQUIRED)
find_package(HailoRT 4.22.0 EXACT REQUIRED)
add_executable(cpp_vstreams_example vstreams_example.cpp)
target_link_libraries(cpp_vstreams_example PRIVATE HailoRT::libhailort Threads::Threads)

View File

@@ -0,0 +1,97 @@
/**
* Copyright (c) 2019-2025 Hailo Technologies Ltd. All rights reserved.
* Distributed under the MIT license (https://opensource.org/licenses/MIT)
**/
/**
* @file hailo_gst_tensor_metadata.hpp
* @brief Definitions for hailo tensor metadata
**/
#ifndef _HAILO_GST_TENSOR_METADATA_HPP_
#define _HAILO_GST_TENSOR_METADATA_HPP_
#include "hailo/platform.h"
#include <limits.h>
#define HAILO_MAX_ENUM (INT_MAX)
#define HAILO_MAX_NAME_SIZE (128)
#define HAILO_MAX_STREAM_NAME_SIZE (HAILO_MAX_NAME_SIZE)
typedef float float32_t;
enum class HailoTensorFormatType {
/** Chosen automatically to match the format expected by the device, usually UINT8 */
HAILO_FORMAT_TYPE_AUTO = 0,
/** Data format type uint8_t - 1 byte per item, host/device side */
HAILO_FORMAT_TYPE_UINT8 = 1,
/** Data format type uint16_t - 2 bytes per item, host/device side */
HAILO_FORMAT_TYPE_UINT16 = 2,
/** Data format type float32_t - used only on host side (Translated in the quantization process) */
HAILO_FORMAT_TYPE_FLOAT32 = 3,
/** Max enum value to maintain ABI Integrity */
HAILO_FORMAT_TYPE_MAX_ENUM = HAILO_MAX_ENUM
};
/** Hailo data format */
struct hailo_tensor_format_t {
HailoTensorFormatType type;
bool is_nms;
};
struct hailo_tensor_3d_image_shape_t {
uint32_t height;
uint32_t width;
uint32_t features;
};
struct hailo_tensor_nms_shape_t {
/** Amount of NMS classes */
uint32_t number_of_classes;
/** Maximum amount of bboxes per nms class */
uint32_t max_bboxes_per_class;
/** Maximum amount of total bboxes */
uint32_t max_bboxes_total;
/** 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)
*/
uint32_t max_accumulated_mask_size;
};
struct hailo_tensor_quant_info_t {
/** zero_point */
float32_t qp_zp;
/** scale */
float32_t qp_scale;
/** min limit value */
float32_t limvals_min;
/** max limit value */
float32_t limvals_max;
};
struct HAILORTAPI hailo_tensor_metadata_t {
char name[HAILO_MAX_STREAM_NAME_SIZE];
hailo_tensor_format_t format;
union
{
/* Frame shape */
hailo_tensor_3d_image_shape_t shape;
/* NMS shape, only valid if format.is_nms is true */
hailo_tensor_nms_shape_t nms_shape;
};
hailo_tensor_quant_info_t quant_info;
hailo_tensor_metadata_t() = default;
};
#endif // _HAILO_GST_TENSOR_METADATA_HPP_

View File

@@ -123,6 +123,7 @@ set(HAILORT_PUBLIC_HEADERS
${HAILORT_INC_DIR}/hailo/hailort_defaults.hpp
${HAILORT_INC_DIR}/hailo/dma_mapped_buffer.hpp
${HAILORT_INC_DIR}/hailo/hailo_session.hpp
${HAILORT_INC_DIR}/hailo/hailo_gst_tensor_metadata.hpp
# GenAI
${HAILORT_INC_DIR}/hailo/genai/vdevice_genai.hpp

View File

@@ -377,7 +377,7 @@ Expected<hailo_health_stats_t> Device::query_health_stats()
#ifndef __linux__
LOGGER__ERROR("Query health stats is supported only on Linux systems");
return make_unexpected(HAILO_NOT_SUPPORTED);
#endif
#else
TRY(auto device_arch, get_architecture());
if ((device_arch != HAILO_ARCH_HAILO15H) && (device_arch != HAILO_ARCH_HAILO15L) && (device_arch != HAILO_ARCH_HAILO15M) && (device_arch != HAILO_ARCH_HAILO10H)) {
@@ -393,6 +393,7 @@ Expected<hailo_health_stats_t> Device::query_health_stats()
// TODO (HRT-16224): add on_die_voltage and startup_bist_mask (currently APIs does not exist)
return health_stats;
#endif
}
Expected<hailo_performance_stats_t> Device::query_performance_stats()
@@ -400,7 +401,7 @@ Expected<hailo_performance_stats_t> Device::query_performance_stats()
#ifndef __linux__
LOGGER__ERROR("Query performance stats is supported only on Linux systems");
return make_unexpected(HAILO_NOT_SUPPORTED);
#endif
#else
TRY(auto device_arch, get_architecture());
if ((device_arch != HAILO_ARCH_HAILO15H) && (device_arch != HAILO_ARCH_HAILO15L) && (device_arch != HAILO_ARCH_HAILO15M) && (device_arch != HAILO_ARCH_HAILO10H)) {
@@ -439,6 +440,7 @@ Expected<hailo_performance_stats_t> Device::query_performance_stats()
}
return performance_stats;
#endif
}
hailo_status Device::test_chip_memories()

View File

@@ -620,6 +620,13 @@ hailo_status DeviceBase::check_hef_is_compatible(Hef &hef)
LOGGER__WARNING("HEF was compiled for Hailo15M device, while the device itself is Hailo15H. " \
"This will result in lower performance.");
}
if (!verify_legacy_hef_only(static_cast<HEFHwArch>(hef.pimpl->get_device_arch()))) {
auto hef_arch_str =
HailoRTCommon::get_device_arch_str(hef_arch_to_device_arch(static_cast<HEFHwArch>(hef.pimpl->get_device_arch())));
LOGGER__ERROR("HEF arch {} is not valid. Please use HailoRT v5.x instead.",
hef_arch_str.c_str());
return HAILO_HEF_NOT_COMPATIBLE_WITH_DEVICE;
}
return HAILO_SUCCESS;
}
@@ -713,6 +720,22 @@ hailo_status DeviceBase::validate_fw_version_for_platform(const hailo_device_ide
return validate_binary_version_for_platform(&fw_version, &min_supported_fw_version, fw_binary_type);
}
bool DeviceBase::verify_legacy_hef_only(HEFHwArch hef_arch)
{
switch (hef_arch) {
case HEFHwArch::HW_ARCH__SAGE_A0:
case HEFHwArch::HW_ARCH__HAILO8:
case HEFHwArch::HW_ARCH__HAILO8P:
case HEFHwArch::HW_ARCH__HAILO8R:
case HEFHwArch::HW_ARCH__SAGE_B0:
case HEFHwArch::HW_ARCH__PAPRIKA_B0:
case HEFHwArch::HW_ARCH__HAILO8L:
return true;
default:
return false;
}
}
bool DeviceBase::is_hef_compatible(hailo_device_architecture_t device_arch, HEFHwArch hef_arch)
{
switch (device_arch) {

View File

@@ -161,6 +161,7 @@ private:
static hailo_status validate_fw_version_for_platform(const hailo_device_identity_t &board_info,
firmware_version_t fw_version, FW_BINARY_TYPE_t fw_binary_type);
static bool is_hef_compatible(hailo_device_architecture_t device_arch, HEFHwArch hw_arch);
static bool verify_legacy_hef_only(HEFHwArch hef_arch);
static void check_clock_rate_for_hailo8(uint32_t clock_rate, HEFHwArch hef_hw_arch);
hailo_status store_sensor_control_buffers(const std::vector<SENSOR_CONFIG__operation_cfg_t> &control_buffers, uint32_t section_index, hailo_sensor_types_t sensor_type,
uint32_t reset_config_size, uint16_t config_height, uint16_t config_width, uint16_t config_fps, const std::string &config_name);

View File

@@ -699,10 +699,23 @@ void ConfiguredInferModelBase::mark_callback_done(std::shared_ptr<AsyncInferJobI
hailo_status ConfiguredInferModelBase::run(const ConfiguredInferModel::Bindings &bindings, std::chrono::milliseconds timeout)
{
auto job = run_async(bindings, [] (const AsyncInferCompletionInfo &) {});
CHECK_EXPECTED_AS_STATUS(job);
TimeoutGuard timeout_guard(timeout);
AsyncInferJob job;
auto status = job->wait(timeout);
std::unique_lock<std::timed_mutex> lock(m_run_mutex, std::defer_lock);
if (lock.try_lock_for(timeout_guard.get_remaining_timeout())) {
auto status = wait_for_async_ready(timeout_guard.get_remaining_timeout(), 1);
CHECK_SUCCESS(status);
TRY(job, run_async(bindings, [] (const AsyncInferCompletionInfo &) {}));
} else {
LOGGER__ERROR("Failed to acquire lock for run(), timeout: {}ms", timeout.count());
return HAILO_TIMEOUT;
}
auto status = job.wait(timeout_guard.get_remaining_timeout());
CHECK_SUCCESS(status);
return HAILO_SUCCESS;

View File

@@ -214,6 +214,7 @@ private:
protected:
std::unordered_map<std::string, size_t> m_inputs_frame_sizes;
std::unordered_map<std::string, size_t> m_outputs_frame_sizes;
std::timed_mutex m_run_mutex;
};

View File

@@ -281,9 +281,15 @@ void MonitorHandler::write_utilization_to_file(const double utilization_percenta
void MonitorHandler::dump_state()
{
auto file = LockedFile::create(m_mon_tmp_output->name(), "w");
if (HAILO_SUCCESS != file.status()) {
LOGGER__ERROR("Failed to open and lock file {}, with status: {}", m_mon_tmp_output->name(), file.status());
/**
* Write to a temporary file first, then rename it to the target path.
* This ensures the monitor file is never seen in an empty or partially written state.
*/
std::string tmp_path = m_mon_tmp_output->name() + ".tmp";
auto tmp_file = LockedFile::create(tmp_path, "w");
if (HAILO_SUCCESS != tmp_file.status()) {
LOGGER__ERROR("Failed to open and lock tmp file {}, status: {}", tmp_path, tmp_file.status());
return;
}
@@ -296,8 +302,13 @@ void MonitorHandler::dump_state()
clear_accumulators();
if (!mon.SerializeToFileDescriptor(file->get_fd())) {
LOGGER__ERROR("Failed to SerializeToFileDescriptor(), with errno: {}", errno);
if (!mon.SerializeToFileDescriptor(tmp_file->get_fd())) {
LOGGER__ERROR("Failed to SerializeToFileDescriptor() to tmp file, errno: {}", errno);
return;
}
if (std::rename(tmp_path.c_str(), m_mon_tmp_output->name().c_str()) != 0) {
LOGGER__ERROR("Failed to rename tmp file to monitor file: errno = {}", errno);
}
}
#endif

View File

@@ -561,7 +561,8 @@ Expected<std::unique_ptr<VDevice>> VDevice::create(const hailo_vdevice_params_t
TRY(acc_type, VDeviceBase::get_accelerator_type(params.device_ids, params.device_count));
}
if ((acc_type == HailoRTDriver::AcceleratorType::SOC_ACCELERATOR) || should_force_hrpc_client()) {
TRY(vdevice, VDeviceHrpcClient::create(params));
LOGGER__ERROR("Hailo1X Devices are only supported in versions 5.0.0 and above. ");
return make_unexpected(HAILO_NOT_SUPPORTED);
} else {
TRY(vdevice, VDeviceHandle::create(params));
}

View File

@@ -80,12 +80,8 @@ Expected<std::unique_ptr<Device>> PcieDevice::create(const hailo_pcie_device_inf
auto device_info = find_device_info(pcie_device_info);
CHECK_EXPECTED(device_info);
if ((get_env_variable(HAILO_SOCKET_COM_ADDR_CLIENT_ENV_VAR).has_value()) || (HailoRTDriver::AcceleratorType::SOC_ACCELERATOR == device_info->accelerator_type)) {
TRY(auto pcie_device, PcieDeviceHrpcClient::create(device_info->device_id));
// Upcasting to Device unique_ptr (from PcieDeviceHrpcClient unique_ptr)
auto device = std::unique_ptr<Device>(std::move(pcie_device));
return device;
}
CHECK(HailoRTDriver::AcceleratorType::NNC_ACCELERATOR == device_info->accelerator_type,
HAILO_NOT_SUPPORTED, "Hailo1X Devices are only supported in versions 5.0.0 and above. ");
auto driver = HailoRTDriver::create(device_info->device_id, device_info->dev_path);
CHECK_EXPECTED(driver);

View File

@@ -1,7 +1,7 @@
:: cmd
@ECHO OFF
set BASE_URI=https://hailo-hailort.s3.eu-west-2.amazonaws.com
set HRT_VERSION=4.21.0
set HRT_VERSION=4.22.0
set REMOTE_HEF_DIR=Hailo8/%HRT_VERSION%/HEFS
set LOCAL_EXAMPLES_HEF_DIR=..\libhailort\examples\hefs
set LOCAL_TUTORIALS_HEF_DIR=..\libhailort\bindings\python\platform\hailo_tutorials\hefs

View File

@@ -2,7 +2,7 @@
set -e
readonly BASE_URI="https://hailo-hailort.s3.eu-west-2.amazonaws.com"
readonly HRT_VERSION=4.21.0
readonly HRT_VERSION=4.22.0
readonly REMOTE_HEF_DIR="Hailo8/${HRT_VERSION}/HEFS"
readonly LOCAL_EXAMPLES_HEF_DIR="../libhailort/examples/hefs"
readonly LOCAL_TUTORIALS_HEF_DIR="../libhailort/bindings/python/platform/hailo_tutorials/hefs"