diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-19 15:56:00 +0000 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-24 09:40:01 +0000 |
commit | cc2877368d5e15d9ea89d31c84ec651fc0fffd13 (patch) | |
tree | c57a3a406125b3a31e2d4aff6126ce99f4ade395 /tests/validation/dynamic_fusion/gpu/cl/Add.cpp | |
parent | a6a153817302793732e28b07c3b4046df3f91a60 (diff) | |
download | ComputeLibrary-cc2877368d5e15d9ea89d31c84ec651fc0fffd13.tar.gz |
Change dynamic fusion API to return destination tensor info
The new dynamic fusion API is introduced in the following patch:
https://review.mlplatform.org/c/ml/ComputeLibrary/+/8906
For each operator (except Conv2D, which is migrated in the above patch), we
- remove destination tensor from is_supported, validate and create calls
- make create_op return ITensorInfo* to the intermediate destination object
Affected operators:
- DepthwiseConv2D
- Cast
- Elementwise Ops
- Clamp
- Reshape
- Resize
Resolves: COMPMID-5777
Change-Id: Ib60ec8a5f081752808455d7a7d790f2ed0627059
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8991
Reviewed-by: Ramy Elgammal <ramy.elgammal@arm.com>
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Dynamic-Fusion: Ramy Elgammal <ramy.elgammal@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/dynamic_fusion/gpu/cl/Add.cpp')
-rw-r--r-- | tests/validation/dynamic_fusion/gpu/cl/Add.cpp | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Add.cpp b/tests/validation/dynamic_fusion/gpu/cl/Add.cpp index 1451ab3de8..0385407ad2 100644 --- a/tests/validation/dynamic_fusion/gpu/cl/Add.cpp +++ b/tests/validation/dynamic_fusion/gpu/cl/Add.cpp @@ -48,7 +48,7 @@ TEST_SUITE(ADD) // *INDENT-OFF* // clang-format off -DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( +DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Invalid data type combination TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), // S16 is valid data type for Add @@ -71,41 +71,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( TensorInfo(TensorShape( 3U, 8U, 1U), 1, DataType::S16), TensorInfo(TensorShape(32U, 13U, 2U, 2), 1, DataType::F32), })), - framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S32), - TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(15U, 23U, 3U), 1, DataType::F32), - TensorInfo(TensorShape( 3U, 8U, 9U), 1, DataType::S16), - TensorInfo(TensorShape(32U, 13U, 2U, 2), 1, DataType::F32), - })), framework::dataset::make("Expected", { true, false, true, true, false, true, true, false, false, true})), - input1_info, input2_info, output_info, expected) -{ - // Create a new workload sketch - auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); - auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx }; - GpuWorkloadSketch sketch{ &gpu_ctx }; - - // Fuse Elementwise Add - auto lhs_info = sketch.create_tensor_info(input1_info); - auto rhs_info = sketch.create_tensor_info(input2_info); - auto dst_info = sketch.create_tensor_info(output_info); - bool res = bool(GpuAdd::validate_op(sketch, &lhs_info, &rhs_info, &dst_info)); - ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS); -} - -DATA_TEST_CASE(ValidateRhsInplace, framework::DatasetMode::ALL, zip(zip( - framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 1U, 1U), 1, DataType::F32), // Broadcasting allowed for lhs - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - }), - framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 1U, 1U), 1, DataType::F32), // Broadcasting not allowed for rhs - })), - framework::dataset::make("Expected", { true, false})), input1_info, input2_info, expected) { // Create a new workload sketch @@ -116,29 +82,8 @@ DATA_TEST_CASE(ValidateRhsInplace, framework::DatasetMode::ALL, zip(zip( // Fuse Elementwise Add auto lhs_info = sketch.create_tensor_info(input1_info); auto rhs_info = sketch.create_tensor_info(input2_info); - bool res = bool(GpuAdd::validate_op(sketch, &lhs_info, &rhs_info, &rhs_info)); - ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS); -} - -DATA_TEST_CASE(ValidateLhsInplace, framework::DatasetMode::ALL, zip(zip( - framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 1U, 1U), 1, DataType::F32), // Broadcasting not allowed for lhs - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - }), - framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 1U, 1U), 1, DataType::F32), // Broadcasting allowed for rhs - })), - framework::dataset::make("Expected", { false, true})), - input1_info, input2_info, expected) -{ - // Create a new workload sketch - auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); - auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx }; - GpuWorkloadSketch sketch{ &gpu_ctx }; - // Fuse Elementwise Add - auto lhs_info = sketch.create_tensor_info(input1_info); - auto rhs_info = sketch.create_tensor_info(input2_info); - bool res = bool(GpuAdd::validate_op(sketch, &lhs_info, &rhs_info, &lhs_info)); + bool res = bool(GpuAdd::validate_op(sketch, &lhs_info, &rhs_info)); ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS); } // clang-format on |