aboutsummaryrefslogtreecommitdiff
path: root/1.2/HalPolicy.cpp
diff options
context:
space:
mode:
Diffstat (limited to '1.2/HalPolicy.cpp')
-rw-r--r--1.2/HalPolicy.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp
index fb6c31ce..79d117ae 100644
--- a/1.2/HalPolicy.cpp
+++ b/1.2/HalPolicy.cpp
@@ -4,6 +4,8 @@
//
#include "HalPolicy.hpp"
+#include "DriverOptions.hpp"
+
namespace armnn_driver
{
@@ -17,6 +19,33 @@ namespace
} // anonymous namespace
+HalPolicy::DeviceType HalPolicy::GetDeviceTypeFromOptions(const DriverOptions& options)
+{
+ // Query backends list from the options
+ auto backends = options.GetBackends();
+ // Return first backend
+ if(backends.size()>0)
+ {
+ const auto &first_backend = backends[0];
+ if(first_backend.IsCpuAcc()||first_backend.IsCpuRef())
+ {
+ return V1_2::DeviceType::CPU;
+ }
+ else if(first_backend.IsGpuAcc())
+ {
+ return V1_2::DeviceType::GPU;
+ }
+ else
+ {
+ return V1_2::DeviceType::ACCELERATOR;
+ }
+ }
+ else
+ {
+ return V1_2::DeviceType::CPU;
+ }
+}
+
bool HalPolicy::ConvertOperation(const Operation& operation, const Model& model, ConversionData& data)
{
switch (operation.type)