* v4.16.0
This commit is contained in:
HailoRT-Automation
2023-12-28 16:14:01 +02:00
committed by GitHub
parent 459eaf0234
commit 35d9282f36
276 changed files with 14513 additions and 8725 deletions

View File

@@ -14,6 +14,8 @@
#include <windows.h>
#include "spdlog/sinks/win_eventlog_sink.h"
#define CACHE_LEVEL_INDEX (1)
namespace hailort
{
@@ -78,6 +80,45 @@ size_t OsUtils::get_page_size()
return page_size;
}
size_t OsUtils::get_dma_able_alignment()
{
// // Return value if was saved already
// if (0 != DMA_ABLE_ALIGNMENT) {
// return Expected<size_t>(DMA_ABLE_ALIGNMENT);
// }
// size_t cacheline_size = 0;
// DWORD proc_info_struct_size = 0;
// // We call this function to fail and get the size needed for SYSTEM_LOGICAL_PROCESSOR_INFORMATION struct
// BOOL ret_val = GetLogicalProcessorInformation(0, &proc_info_struct_size);
// CHECK_AS_EXPECTED((FALSE == ret_val) && (ERROR_INSUFFICIENT_BUFFER == GetLastError()), HAILO_INTERNAL_FAILURE,
// "GetLogicalProcessorInformation Failed with error {}", GetLastError());
// std::shared_ptr<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> proc_info(
// static_cast<SYSTEM_LOGICAL_PROCESSOR_INFORMATION *>(malloc(proc_info_struct_size)), free);
// ret_val = GetLogicalProcessorInformation(static_cast<SYSTEM_LOGICAL_PROCESSOR_INFORMATION *>(proc_info.get()),
// &proc_info_struct_size);
// CHECK_AS_EXPECTED(ret_val, HAILO_INTERNAL_FAILURE, "GetLogicalProcessorInformation Failed with error {}",
// GetLastError());
// for (DWORD i = 0; i < proc_info_struct_size; i++) {
// // Assume same cache line for all processors
// if ((RelationCache == proc_info.get()[i].Relationship) && (CACHE_LEVEL_INDEX == proc_info.get()[i].Cache.Level)) {
// cacheline_size = proc_info.get()[i].Cache.LineSize;
// break;
// }
// }
// // Set static variable to value - so dont need to fetch actual value every function call
// // TODO HRT-12459: Currently use DMA_ABLE_ALIGNMENT_WRITE_HW_LIMITATION as minimum until after debug - seeing as all
// // Funtions currently calling this function are for write
// DMA_ABLE_ALIGNMENT = std::max(HailoRTCommon::DMA_ABLE_ALIGNMENT_WRITE_HW_LIMITATION, static_cast<size_t>(cacheline_size));
// return Expected<size_t>(DMA_ABLE_ALIGNMENT);
// TODO: HRT-12495 support page-aligned address on windows
return get_page_size();
}
CursorAdjustment::CursorAdjustment()
{
// Enables Vitual Terminal Processing - enables ANSI Escape Sequences on Windows