RuntimeConfigList.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //==============================================================================
  2. //
  3. // Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
  4. // All Rights Reserved.
  5. // Confidential and Proprietary - Qualcomm Technologies, Inc.
  6. //
  7. //==============================================================================
  8. #ifndef PSNPE_RUNTIMECONFIGLIST_HPP
  9. #define PSNPE_RUNTIMECONFIGLIST_HPP
  10. #include <iostream>
  11. #include "DlContainer/IDlContainer.hpp"
  12. #include "DlSystem/DlEnums.hpp"
  13. #include "DlSystem/RuntimeList.hpp"
  14. #include "DlSystem/TensorShapeMap.hpp"
  15. #include "DlSystem/ZdlExportDefine.hpp"
  16. namespace zdl {
  17. namespace PSNPE {
  18. /** @addtogroup c_plus_plus_apis C++
  19. @{ */
  20. /**
  21. * @brief .
  22. *
  23. * The structure for configuring a BulkSNPE runtime
  24. *
  25. */
  26. struct ZDL_EXPORT RuntimeConfig final {
  27. zdl::DlSystem::Runtime_t runtime;
  28. zdl::DlSystem::RuntimeList runtimeList;
  29. zdl::DlSystem::PerformanceProfile_t perfProfile;
  30. zdl::DlSystem::TensorShapeMap inputDimensionsMap;
  31. bool enableCPUFallback;
  32. RuntimeConfig()
  33. : runtime{zdl::DlSystem::Runtime_t::CPU_FLOAT32},
  34. perfProfile{zdl::DlSystem::PerformanceProfile_t::HIGH_PERFORMANCE},
  35. enableCPUFallback{false} {}
  36. RuntimeConfig(const RuntimeConfig& other) {
  37. runtime = other.runtime;
  38. runtimeList = other.runtimeList;
  39. perfProfile = other.perfProfile;
  40. enableCPUFallback = other.enableCPUFallback;
  41. inputDimensionsMap = other.inputDimensionsMap;
  42. }
  43. RuntimeConfig& operator=(const RuntimeConfig& other) {
  44. this->runtimeList = other.runtimeList;
  45. this->runtime = other.runtime;
  46. this->perfProfile = other.perfProfile;
  47. this->enableCPUFallback = other.enableCPUFallback;
  48. this->inputDimensionsMap = other.inputDimensionsMap;
  49. return *this;
  50. }
  51. ~RuntimeConfig() {}
  52. };
  53. /**
  54. * @brief .
  55. *
  56. * The class for creating a RuntimeConfig container.
  57. *
  58. */
  59. class ZDL_EXPORT RuntimeConfigList final {
  60. public:
  61. RuntimeConfigList();
  62. RuntimeConfigList(const size_t size);
  63. void push_back(const RuntimeConfig& runtimeConfig);
  64. RuntimeConfig& operator[](const size_t index);
  65. RuntimeConfigList& operator=(const RuntimeConfigList& other);
  66. size_t size() const noexcept;
  67. size_t capacity() const noexcept;
  68. void clear() noexcept;
  69. ~RuntimeConfigList() = default;
  70. private:
  71. void swap(const RuntimeConfigList& other);
  72. std::vector<RuntimeConfig> m_runtimeConfigs;
  73. };
  74. /** @} */ /* end_addtogroup c_plus_plus_apis C++ */
  75. } // namespace PSNPE
  76. } // namespace zdl
  77. #endif // PSNPE_RUNTIMECONFIGLIST_HPP