aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_interleave_8way_block4_8bit.hpp6
-rw-r--r--tests/validation/CL/UNIT/DynamicTensor.cpp10
-rw-r--r--tests/validation/NEON/UNIT/DynamicTensor.cpp9
-rw-r--r--tests/validation/fixtures/UNIT/DynamicTensorFixture.h113
4 files changed, 138 insertions, 0 deletions
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_interleave_8way_block4_8bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_interleave_8way_block4_8bit.hpp
index 3c4f6d0b19..2bc7801b15 100644
--- a/src/core/NEON/kernels/arm_gemm/transforms/a64_interleave_8way_block4_8bit.hpp
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_interleave_8way_block4_8bit.hpp
@@ -90,16 +90,22 @@ inline void TransformImpl<8, 4, false, 1, 1, false>::Transform(T *out, const T *
/* Everything falls through in here */
case 6:
inptr1 = zerobuff;
+ // fall through
case 5:
inptr2 = zerobuff;
+ // fall through
case 4:
inptr3 = zerobuff;
+ // fall through
case 3:
inptr4 = zerobuff;
+ // fall through
case 2:
inptr5 = zerobuff;
+ // fall through
case 1:
inptr6 = zerobuff;
+ // fall through
case 0:
inptr7 = zerobuff;
break;
diff --git a/tests/validation/CL/UNIT/DynamicTensor.cpp b/tests/validation/CL/UNIT/DynamicTensor.cpp
index 06670478b2..85381efe62 100644
--- a/tests/validation/CL/UNIT/DynamicTensor.cpp
+++ b/tests/validation/CL/UNIT/DynamicTensor.cpp
@@ -126,6 +126,16 @@ FIXTURE_DATA_TEST_CASE(DynamicTensorType3Complex, CLDynamicTensorType3ComplexFun
}
}
+using CLDynamicTensorType2PipelineFunction = DynamicTensorType2PipelineFunction<CLTensor, CLAccessor, BlobMemoryManagementService, CLConvolutionLayer>;
+/** Tests the memory manager with dynamic input and output tensors.
+ *
+ * Create and manage the tensors needed to run a pipeline. After the function is executed, resize the input size and rerun.
+ */
+FIXTURE_DATA_TEST_CASE(DynamicTensorType2Pipeline, CLDynamicTensorType2PipelineFunction, framework::DatasetMode::ALL,
+ framework::dataset::make("InputShape", { std::vector<TensorShape>{ TensorShape(12U, 12U, 6U), TensorShape(128U, 128U, 6U) } }))
+{
+}
+
TEST_SUITE_END() // DynamicTensor
TEST_SUITE_END() // UNIT
TEST_SUITE_END() // CL
diff --git a/tests/validation/NEON/UNIT/DynamicTensor.cpp b/tests/validation/NEON/UNIT/DynamicTensor.cpp
index dde67b06a6..53dec53912 100644
--- a/tests/validation/NEON/UNIT/DynamicTensor.cpp
+++ b/tests/validation/NEON/UNIT/DynamicTensor.cpp
@@ -106,6 +106,15 @@ FIXTURE_DATA_TEST_CASE(DynamicTensorType3Complex, NEDynamicTensorType3ComplexFun
}
}
+using NEDynamicTensorType2PipelineFunction = DynamicTensorType2PipelineFunction<Tensor, Accessor, OffsetMemoryManagementService, NEConvolutionLayer>;
+/** Tests the memory manager with dynamic input and output tensors.
+ *
+ * Create and manage the tensors needed to run a pipeline. After the function is executed, resize the input size and rerun.
+ */
+FIXTURE_DATA_TEST_CASE(DynamicTensorType2Pipeline, NEDynamicTensorType2PipelineFunction, framework::DatasetMode::ALL,
+ framework::dataset::make("InputShape", { std::vector<TensorShape>{ TensorShape(12U, 12U, 6U), TensorShape(128U, 128U, 6U) } }))
+{
+}
TEST_SUITE_END() // DynamicTensor
TEST_SUITE_END() // UNIT
TEST_SUITE_END() // NEON
diff --git a/tests/validation/fixtures/UNIT/DynamicTensorFixture.h b/tests/validation/fixtures/UNIT/DynamicTensorFixture.h
index 08b90c5b52..804b394649 100644
--- a/tests/validation/fixtures/UNIT/DynamicTensorFixture.h
+++ b/tests/validation/fixtures/UNIT/DynamicTensorFixture.h
@@ -378,6 +378,119 @@ private:
TensorType _bias_target{};
std::unique_ptr<ComplexFunctionType> _f_target{};
};
+
+/** Fixture that create a pipeline of Convolutions and changes the inputs dynamically
+ *
+ * Runs a list of convolutions and then resizes the inputs and reruns.
+ * Updates the memory manager and allocated memory.
+ */
+template <typename TensorType,
+ typename AccessorType,
+ typename MemoryManagementServiceType,
+ typename ComplexFunctionType>
+class DynamicTensorType2PipelineFunction : public framework::Fixture
+{
+ using T = float;
+
+public:
+ template <typename...>
+ void setup(std::vector<TensorShape> input_shapes)
+ {
+ _data_type = DataType::F32;
+ _data_layout = DataLayout::NHWC;
+ _input_shapes = input_shapes;
+
+ run();
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i)
+ {
+ switch(tensor.data_type())
+ {
+ case DataType::F32:
+ {
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ library->fill(tensor, distribution, i);
+ break;
+ }
+ default:
+ library->fill_tensor_uniform(tensor, i);
+ }
+ }
+
+ void run()
+ {
+ const unsigned int num_functions = 5;
+ const unsigned int num_tensors = num_functions + 1;
+ const unsigned int num_resizes = _input_shapes.size();
+
+ for(unsigned int i = 0; i < num_functions; ++i)
+ {
+ _functions.emplace_back(support::cpp14::make_unique<ComplexFunctionType>(_ms.mm));
+ }
+
+ for(unsigned int i = 0; i < num_resizes; ++i)
+ {
+ TensorShape input_shape = _input_shapes[i];
+ TensorShape weights_shape = TensorShape(3U, 3U, input_shape[2], input_shape[2]);
+ TensorShape output_shape = input_shape;
+ PadStrideInfo info(1U, 1U, 1U, 1U);
+
+ if(_data_layout == DataLayout::NHWC)
+ {
+ permute(input_shape, PermutationVector(2U, 0U, 1U));
+ permute(weights_shape, PermutationVector(2U, 0U, 1U));
+ permute(output_shape, PermutationVector(2U, 0U, 1U));
+ }
+
+ std::vector<TensorType> tensors(num_tensors);
+ std::vector<TensorType> ws(num_functions);
+ std::vector<TensorType> bs(num_functions);
+
+ auto tensor_info = TensorInfo(input_shape, 1, _data_type);
+ auto weights_info = TensorInfo(weights_shape, 1, _data_type);
+ tensor_info.set_data_layout(_data_layout);
+ weights_info.set_data_layout(_data_layout);
+
+ for(unsigned int f = 0; f < num_functions; ++f)
+ {
+ tensors[f].allocator()->init(tensor_info);
+ tensors[f + 1].allocator()->init(tensor_info);
+ ws[f].allocator()->init(weights_info);
+
+ _functions[f]->configure(&tensors[f], &ws[f], nullptr, &tensors[f + 1], info);
+
+ // Allocate tensors
+ tensors[f].allocator()->allocate();
+ ws[f].allocator()->allocate();
+ }
+ tensors[num_functions].allocator()->allocate();
+
+ // Populate and validate memory manager
+ _ms.clear();
+ _ms.populate(1);
+ _ms.mg.acquire();
+
+ // Run pipeline
+ for(unsigned int f = 0; f < num_functions; ++f)
+ {
+ _functions[f]->run();
+ }
+
+ // Release memory group
+ _ms.mg.release();
+ }
+ }
+
+private:
+ DataType _data_type{ DataType::UNKNOWN };
+ DataLayout _data_layout{ DataLayout::UNKNOWN };
+ std::vector<TensorShape> _input_shapes{};
+ MemoryManagementServiceType _ms{};
+ std::vector<std::unique_ptr<ComplexFunctionType>> _functions{};
+};
} // namespace validation
} // namespace test
} // namespace arm_compute