aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/operators/CpuAdd.cpp
diff options
context:
space:
mode:
authorGunes Bayir <gunes.bayir@arm.com>2022-07-28 17:44:00 +0100
committerGunes Bayir <gunes.bayir@arm.com>2022-08-01 20:13:56 +0000
commit9b921be1ff7283050eb39d9ce1b10b5c8bfc1300 (patch)
tree0cb274a6c529717b8ef987aa3e270647927e9d89 /src/cpu/operators/CpuAdd.cpp
parent385dad2bffecbf395aa9aad257809de81c727ac7 (diff)
downloadComputeLibrary-9b921be1ff7283050eb39d9ce1b10b5c8bfc1300.tar.gz
Optimize add layer by considering the input tensors as 1D array
Resolves: COMPMID-5108 Change-Id: I544f8160fbe5b4ffbef348d1fbd3dd626a6e1bdb Signed-off-by: Gunes Bayir <gunes.bayir@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8002 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/cpu/operators/CpuAdd.cpp')
-rw-r--r--src/cpu/operators/CpuAdd.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cpu/operators/CpuAdd.cpp b/src/cpu/operators/CpuAdd.cpp
index 76ec7d7d8d..828361e7cf 100644
--- a/src/cpu/operators/CpuAdd.cpp
+++ b/src/cpu/operators/CpuAdd.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Arm Limited.
+ * Copyright (c) 2021-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,6 +27,8 @@
#include "src/common/utils/Log.h"
+#include "arm_compute/runtime/NEON/NEScheduler.h"
+
namespace arm_compute
{
namespace cpu
@@ -45,5 +47,17 @@ Status CpuAdd::validate(const ITensorInfo *src0, const ITensorInfo *src1, const
ARM_COMPUTE_RETURN_ERROR_ON(act_info.enabled());
return kernels::CpuAddKernel::validate(src0, src1, dst, policy);
}
+
+void CpuAdd::run(ITensorPack &tensors)
+{
+ if(static_cast<kernels::CpuAddKernel *>(_kernel.get())->get_can_interpret_inputs_as_1d_array())
+ {
+ NEScheduler::get().schedule_op(_kernel.get(), Window::DimX, _kernel->window(), tensors);
+ }
+ else
+ {
+ ICpuOperator::run(tensors);
+ }
+}
} // namespace cpu
} // namespace arm_compute