From 3fcf3dcf7b6ffc613468ccaca580bde495677440 Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Wed, 17 May 2023 15:17:48 +0100 Subject: 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 Change-Id: I37d0de5ac103fb2a85020aa1c26e49eb304f47b7 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9706 Comments-Addressed: Arm Jenkins Reviewed-by: SiCong Li Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- tests/validation/dynamic_fusion/gpu/cl/Resize.cpp | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'tests/validation/dynamic_fusion/gpu/cl/Resize.cpp') diff --git a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp index 696be54c92..5f99cd6d78 100644 --- a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp +++ b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp @@ -95,10 +95,10 @@ TEST_CASE(NullPtr, framework::DatasetMode::ALL) 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 @@ TEST_CASE(SupportDataType, framework::DatasetMode::ALL) 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 @@ TEST_CASE(MismatchingDataType, framework::DatasetMode::ALL) 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 @@ TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL) 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 @@ TEST_CASE(UnsupportedInterpolationPolicy, framework::DatasetMode::ALL) 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 @@ TEST_CASE(UnsupportedLayout, framework::DatasetMode::ALL) 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); -- cgit v1.2.1