aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorMohammed Suhail Munshi <MohammedSuhail.Munshi@arm.com>2023-12-05 14:27:31 +0000
committerMohmun02 <MohammedSuhail.Munshi@arm.com>2024-01-10 09:56:39 +0000
commit7467ba8fac0afb19d750b3bdda9ba95002634038 (patch)
treee47d4989251f03d13590e6b22d9bd228fd1efe34 /arm_compute
parent7fe7791468978429ab02343a8485b51b39832027 (diff)
downloadComputeLibrary-7467ba8fac0afb19d750b3bdda9ba95002634038.tar.gz
Use look up table for fp16 activation
- Enables FP16 lut for logistic activation - Adds LUTManager to re-use lut where appropriate. Signed-off-by: Mohammed Suhail Munshi <MohammedSuhail.Munshi@arm.com> Change-Id: I94667b63b452a8e58a1eb59cb0b5866178954523 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10864 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/function_info/ActivationLayerInfo.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/arm_compute/function_info/ActivationLayerInfo.h b/arm_compute/function_info/ActivationLayerInfo.h
index 195b67cf99..9390d0c54f 100644
--- a/arm_compute/function_info/ActivationLayerInfo.h
+++ b/arm_compute/function_info/ActivationLayerInfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2023 Arm Limited.
+ * Copyright (c) 2016-2024 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,13 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO
-#define ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO
+#ifndef ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO_H
+#define ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO_H
#include "arm_compute/core/CoreTypes.h"
+#include "arm_compute/core/Error.h"
#include "arm_compute/core/QuantizationInfo.h"
#include <array>
+#include <memory>
+
+#ifdef __aarch64__
+#include <arm_neon.h>
+#endif // __arch64__
namespace arm_compute
{
@@ -58,7 +64,10 @@ public:
typedef arm_compute::ActivationFunction ActivationFunction;
/** Lookup table */
- using LookupTable256 = std::array<qasymm8_t, 256>;
+#ifdef __aarch64__
+ using LookupTable256 = std::array<qasymm8_t, 256>;
+ using LookupTable65536 = std::array<float16_t, 65536>;
+#endif // __aarch64__
ActivationLayerInfo() = default;
/** Default Constructor
@@ -101,6 +110,16 @@ public:
{
_lut = std::move(lut);
}
+
+ const LookupTable65536 &lut_fp16() const
+ {
+ ARM_COMPUTE_ERROR_ON(_lut_fp16 == nullptr);
+ return *_lut_fp16;
+ }
+ void setLookupTable65536(std::shared_ptr<LookupTable65536> lut)
+ {
+ _lut_fp16 = lut;
+ }
#endif // __aarch64__
private:
ActivationFunction _act = {ActivationLayerInfo::ActivationFunction::IDENTITY};
@@ -109,8 +128,9 @@ private:
bool _enabled = {false};
#ifdef __aarch64__
- LookupTable256 _lut = {};
+ LookupTable256 _lut = {};
+ std::shared_ptr<LookupTable65536> _lut_fp16{nullptr};
#endif // __aarch64__
};
} // namespace arm_compute
-#endif /* ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO */
+#endif // ACL_ARM_COMPUTE_FUNCTION_INFO_ACTIVATIONLAYERINFO_H