Files
sunnypilot/third_party/snpe/include/SNPE/RuntimeConfigList.hpp
Jason Wen acd46aa94b modeld: retain SNPE and thneed drive model support (#555)
* modeld: Retain pre-20hz drive model support

* Method not available anymore on OP

* some fixes

* Revert "Long planner get accel: new function args (#34288)"

* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"

* Revert "long planner: allow throttle reflects usage (#33792)"

* Revert "Gate acceleration on model gas press predictions (#33643)"

* Reapply "Gate acceleration on model gas press predictions (#33643)"

This reverts commit 76b08e37cb.

* Reapply "long planner: allow throttle reflects usage (#33792)"

This reverts commit c75244ca4e.

* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"

This reverts commit b2b7d21b7b.

* Reapply "Long planner get accel: new function args (#34288)"

This reverts commit 74dca2fccf.

* don't need

* retain snpe

* wrong

* they're symlinks

* remove

* put back into VCS

* add back

* don't include built

* Refactor model runner retrieval with caching support

Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.

* Update model runner determination logic with caching fix

Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.

* default to none

* enable in next PR

* more

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-10 18:34:06 -05:00

86 lines
2.5 KiB
C++

//==============================================================================
//
// Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//==============================================================================
#ifndef PSNPE_RUNTIMECONFIGLIST_HPP
#define PSNPE_RUNTIMECONFIGLIST_HPP
#include <iostream>
#include "DlContainer/IDlContainer.hpp"
#include "DlSystem/DlEnums.hpp"
#include "DlSystem/RuntimeList.hpp"
#include "DlSystem/TensorShapeMap.hpp"
#include "DlSystem/ZdlExportDefine.hpp"
namespace zdl {
namespace PSNPE {
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* The structure for configuring a BulkSNPE runtime
*
*/
struct ZDL_EXPORT RuntimeConfig final {
zdl::DlSystem::Runtime_t runtime;
zdl::DlSystem::RuntimeList runtimeList;
zdl::DlSystem::PerformanceProfile_t perfProfile;
zdl::DlSystem::TensorShapeMap inputDimensionsMap;
bool enableCPUFallback;
RuntimeConfig()
: runtime{zdl::DlSystem::Runtime_t::CPU_FLOAT32},
perfProfile{zdl::DlSystem::PerformanceProfile_t::HIGH_PERFORMANCE},
enableCPUFallback{false} {}
RuntimeConfig(const RuntimeConfig& other) {
runtime = other.runtime;
runtimeList = other.runtimeList;
perfProfile = other.perfProfile;
enableCPUFallback = other.enableCPUFallback;
inputDimensionsMap = other.inputDimensionsMap;
}
RuntimeConfig& operator=(const RuntimeConfig& other) {
this->runtimeList = other.runtimeList;
this->runtime = other.runtime;
this->perfProfile = other.perfProfile;
this->enableCPUFallback = other.enableCPUFallback;
this->inputDimensionsMap = other.inputDimensionsMap;
return *this;
}
~RuntimeConfig() {}
};
/**
* @brief .
*
* The class for creating a RuntimeConfig container.
*
*/
class ZDL_EXPORT RuntimeConfigList final {
public:
RuntimeConfigList();
RuntimeConfigList(const size_t size);
void push_back(const RuntimeConfig& runtimeConfig);
RuntimeConfig& operator[](const size_t index);
RuntimeConfigList& operator=(const RuntimeConfigList& other);
size_t size() const noexcept;
size_t capacity() const noexcept;
void clear() noexcept;
~RuntimeConfigList() = default;
private:
void swap(const RuntimeConfigList& other);
std::vector<RuntimeConfig> m_runtimeConfigs;
};
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
} // namespace PSNPE
} // namespace zdl
#endif // PSNPE_RUNTIMECONFIGLIST_HPP