aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
diff options
context:
space:
mode:
authorViet-Hoa Do <viet-hoa.do@arm.com>2022-12-13 13:09:10 +0000
committerViet-Hoa Do <viet-hoa.do@arm.com>2022-12-16 15:17:51 +0000
commitb84e25313e5dc7acbc03623e1e071e845047c111 (patch)
treefbee083f1262017555c64c3280da45e2b638992e /tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
parenta0ae8d2e6c57fd95c0edaf659b9df8b8c540d051 (diff)
downloadComputeLibrary-b84e25313e5dc7acbc03623e1e071e845047c111.tar.gz
Add output operator for dynamic fusion
* The output of the fused operator must be explicitly specified using GpuOutput operator. * Any temporary tensors used to connect the output of an operator to the input of another operator will be marked as no-alloc and won't be allocated as a tensor in the memory. Resolves: COMPMID-5771 Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com> Change-Id: I5ae8e800f8f737db23a055a92b01c4f1d78c3bb8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8794 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@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 'tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h')
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h51
1 files changed, 20 insertions, 31 deletions
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
index dbac29fd22..fe87d9a022 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
@@ -29,6 +29,7 @@
#include "arm_compute/core/Types.h"
#include "arm_compute/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h"
+#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h"
#include "tests/framework/Fixture.h"
#include "tests/validation/reference/ActivationLayer.h"
@@ -108,14 +109,23 @@ protected:
// Create sketch tensors
TensorInfo src_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
- TensorInfo dst_0_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
- TensorInfo dst_1_info;
+ TensorInfo dst_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
+
+ auto ans_0_info = sketch.create_tensor_info();
+ TensorInfo ans_1_info;
+
+ FunctionType::create_op(sketch, &src_info, &ans_0_info, attributes);
- FunctionType::create_op(sketch, &src_info, &dst_0_info, attributes);
if(_fuse)
{
- dst_1_info = sketch.create_tensor_info(shape, 1, _data_type);
- FunctionType::create_op(sketch, &dst_0_info, &dst_1_info, attributes);
+ ans_1_info = sketch.create_tensor_info();
+
+ FunctionType::create_op(sketch, &ans_0_info, &ans_1_info, attributes);
+ GpuOutput::create_op(sketch, &ans_1_info, &dst_info);
+ }
+ else
+ {
+ GpuOutput::create_op(sketch, &ans_0_info, &dst_info);
}
// Configure runtime
@@ -124,43 +134,22 @@ protected:
// Construct user tensors
TensorType t_src{};
- TensorType t_dst_0{};
- TensorType t_dst_1{};
+ TensorType t_dst{};
// Initialize user tensors
t_src.allocator()->init(src_info);
- t_dst_0.allocator()->init(dst_0_info);
- if(_fuse)
- {
- t_dst_1.allocator()->init(dst_1_info);
- }
+ t_dst.allocator()->init(dst_info);
// Allocate and fill user tensors
t_src.allocator()->allocate();
- t_dst_0.allocator()->allocate();
- if(_fuse)
- {
- t_dst_1.allocator()->allocate();
- }
+ t_dst.allocator()->allocate();
fill(AccessorType(t_src));
// Run runtime
- if(_fuse)
- {
- runtime.run({ &t_src, &t_dst_1 });
- }
- else
- {
- runtime.run({ &t_src, &t_dst_0 });
- }
-
- if(_fuse)
- {
- return t_dst_1;
- }
+ runtime.run({ &t_src, &t_dst });
- return t_dst_0;
+ return t_dst;
}
SimpleTensor<T> compute_reference(const TensorShape &shape, ActivationLayerInfo act_info)