You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					86 lines
				
				2.5 KiB
			
		
		
			
		
	
	
					86 lines
				
				2.5 KiB
			| 
								 
											6 years ago
										 
									 | 
							
								//==============================================================================
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								//  Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								//  All Rights Reserved.
							 | 
						||
| 
								 | 
							
								//  Confidential and Proprietary - Qualcomm Technologies, Inc.
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//==============================================================================
							 | 
						||
| 
								 | 
							
								#ifndef PSNPE_RUNTIMECONFIGLIST_HPP
							 | 
						||
| 
								 | 
							
								#define PSNPE_RUNTIMECONFIGLIST_HPP
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <iostream>
							 | 
						||
| 
								 | 
							
								#include "DlContainer/IDlContainer.hpp"
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include "DlSystem/DlEnums.hpp"
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								#include "DlSystem/RuntimeList.hpp"
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include "DlSystem/TensorShapeMap.hpp"
							 | 
						||
| 
								 | 
							
								#include "DlSystem/ZdlExportDefine.hpp"
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								namespace zdl {
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								namespace PSNPE {
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								/** @addtogroup c_plus_plus_apis C++
							 | 
						||
| 
								 | 
							
								@{ */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								 * @brief .
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * The structure for configuring a BulkSNPE runtime
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								struct ZDL_EXPORT RuntimeConfig final {
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								    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;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								    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;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								    ~RuntimeConfig() {}
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								 * @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;
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								   private:
							 | 
						||
| 
								 | 
							
								    void swap(const RuntimeConfigList& other);
							 | 
						||
| 
								 | 
							
								    std::vector<RuntimeConfig> m_runtimeConfigs;
							 | 
						||
| 
								 
											6 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 | 
							
								/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								}  // namespace PSNPE
							 | 
						||
| 
								 | 
							
								}  // namespace zdl
							 | 
						||
| 
								 | 
							
								#endif  // PSNPE_RUNTIMECONFIGLIST_HPP
							 |