ArmNN
 24.08
ClBackendModelContext.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 #include<string>
10 
11 namespace armnn
12 {
13 
14 /// The ClBackendModelContext is used to pass in CL specific backend ModelOptions. The supported backend ModelOptions
15 /// are:
16 /// - "FastMathEnabled"\n
17 /// Using the fast_math flag can lead to performance improvements in fp32 and fp16 layers but may result in\n
18 /// results with reduced or different precision. The fast_math flag will not have any effect on int8 performance.
19 /// - "SaveCachedNetwork"\n
20 /// Using the save_cached_network flag enables saving the cached network\n
21 /// to a file given with the cached_network_file_path option.
22 /// - "CachedNetworkFilePath"\n
23 /// If the cached_network_file_path is a valid file and the save_cached_network flag is present\n
24 /// then the cached network will be saved to the given file.\n
25 /// If the cached_network_file_path is a valid file and the save_cached_network flag is not present\n
26 /// then the cached network will be loaded from the given file.\n
27 /// This will remove the time taken for initial compilation of kernels and speed up the first execution.
29 {
30 public:
31  ClBackendModelContext(const ModelOptions& modelOptions);
32 
33  std::string GetCachedNetworkFilePath() const;
34 
35  bool IsFastMathEnabled() const;
36 
37  bool SaveCachedNetwork() const;
38 
39  int GetCachedFileDescriptor() const;
40 
41 private:
42  std::string m_CachedNetworkFilePath;
43  bool m_IsFastMathEnabled;
44  bool m_SaveCachedNetwork;
45  int m_CachedFileDescriptor;
46 
47 };
48 
49 } // namespace armnn
armnn::IBackendModelContext
Definition: IBackendContext.hpp:36
armnn::ClBackendModelContext::GetCachedNetworkFilePath
std::string GetCachedNetworkFilePath() const
Definition: ClBackendModelContext.cpp:61
armnn::ClBackendModelContext::ClBackendModelContext
ClBackendModelContext(const ModelOptions &modelOptions)
Definition: ClBackendModelContext.cpp:34
armnn::ClBackendModelContext::GetCachedFileDescriptor
int GetCachedFileDescriptor() const
Definition: ClBackendModelContext.cpp:76
armnn::ClBackendModelContext
The ClBackendModelContext is used to pass in CL specific backend ModelOptions.
Definition: ClBackendModelContext.hpp:28
IBackendContext.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::ClBackendModelContext::SaveCachedNetwork
bool SaveCachedNetwork() const
Definition: ClBackendModelContext.cpp:71
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::ClBackendModelContext::IsFastMathEnabled
bool IsFastMathEnabled() const
Definition: ClBackendModelContext.cpp:66