MLCE-233 Added ability to enable fast_math through the NNAPI driver
* Added -a command line option to enable fast_math on Neon/CL when launching the NNAPI driver
* The invocation will look something like:
/vendor/bin/hw/android.hardware.neuralnetworks@1.3-service-armnn -v -c GpuAcc -n arm-armnn -a
* Enabling fast_math may cause an increase in VTS or CTS test failures due to a change in precision
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Ifd8931f95efd65d3ae3aca9d9d61bd381e4e24a5
diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp
index 9c6d51f..936cc6e 100644
--- a/ArmnnDriverImpl.cpp
+++ b/ArmnnDriverImpl.cpp
@@ -53,7 +53,6 @@
return error;
}
-
} // namespace
namespace armnn_driver
@@ -105,6 +104,17 @@
armnn::OptimizerOptions OptOptions;
OptOptions.m_ReduceFp32ToFp16 = float32ToFloat16;
+ armnn::BackendOptions gpuAcc("GpuAcc",
+ {
+ { "FastMathEnabled", options.IsFastMathEnabled() }
+ });
+ armnn::BackendOptions cpuAcc("CpuAcc",
+ {
+ { "FastMathEnabled", options.IsFastMathEnabled() }
+ });
+ OptOptions.m_ModelOptions.push_back(gpuAcc);
+ OptOptions.m_ModelOptions.push_back(cpuAcc);
+
std::vector<std::string> errMessages;
try
{