Add multi-sketch support for dynamic fusion
* Tensors are owned by workload context instead of workload sketch
so that they can be used by multiple sketches.
* Add an integration test for multi-sketch case.
Resolves: COMPMID-6148
Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Change-Id: I37d0de5ac103fb2a85020aa1c26e49eb304f47b7
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9706
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
index 696be54..5f99cd6 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
@@ -95,10 +95,10 @@
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
// nullptr is given as input
Status status = GpuResize::validate_op(sketch, nullptr, ResizeAttributes());
@@ -135,10 +135,10 @@
const TensorInfo input_info = TensorInfo{ default_input_shape, 1, kv.first, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes;
attributes.output_width(default_output_shape[0]); // shape is not important unless it's empty
@@ -157,10 +157,10 @@
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, non_default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Status status = GpuResize::validate_op(sketch, &sketch_input_info, ResizeAttributes());
ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
@@ -177,10 +177,10 @@
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy)
@@ -198,10 +198,10 @@
constexpr auto interpolation_policy = InterpolationPolicy::AREA;
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy);
@@ -217,10 +217,10 @@
constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR;
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy);