aboutsummaryrefslogtreecommitdiff
path: root/tests/benchmark/fixtures
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-10-25 19:17:35 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:55:45 +0000
commit9593bde92b99fb4473611a2a2bb47a8040bfb500 (patch)
tree82f869b95d6b79c2e19880e3f0d22a4eb31c0c8a /tests/benchmark/fixtures
parent89d71731d8922bc302ac57046126cdaedcf6e96b (diff)
downloadComputeLibrary-9593bde92b99fb4473611a2a2bb47a8040bfb500.tar.gz
COMPMID-1674: (3RDPARTY_UPDATE) Add FullyConnectedLayer Dragonbench
Change-Id: I3c3e96a743614af4c2c2391780d5de2db6191b0f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/155318 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'tests/benchmark/fixtures')
-rw-r--r--tests/benchmark/fixtures/DragonBenchFixture.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/benchmark/fixtures/DragonBenchFixture.h b/tests/benchmark/fixtures/DragonBenchFixture.h
index 526a798154..bb93a46cf5 100644
--- a/tests/benchmark/fixtures/DragonBenchFixture.h
+++ b/tests/benchmark/fixtures/DragonBenchFixture.h
@@ -113,6 +113,67 @@ private:
TensorType dst{};
Function conv_layer{};
};
+
+/** Fixture that can be used for NEON and CL */
+template <typename TensorType, typename Function, typename Accessor, typename FullyConnectedConfig>
+class DragonBenchFCFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(FullyConnectedConfig config, DataType data_type, bool has_bias)
+ {
+ // Set tensor shapes in NCHW layout
+ TensorShape src_shape(config.k, config.m);
+ TensorShape weights_shape(config.k, config.n);
+ TensorShape biases_shape(config.n);
+ TensorShape dst_shape(config.n, config.m);
+
+ // Determine bias data type
+ DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
+ const QuantizationInfo q_info(2.f, 10);
+
+ // Create tensors
+ src = create_tensor<TensorType>(src_shape, data_type, 1, q_info);
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1, q_info);
+ biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, q_info);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1, q_info);
+
+ // Create and configure function
+ fc_layer.configure(&src, &weights, has_bias ? &biases : nullptr, &dst);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ weights.allocator()->allocate();
+ biases.allocator()->allocate();
+ dst.allocator()->allocate();
+ }
+
+ void run()
+ {
+ fc_layer.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+ void teardown()
+ {
+ src.allocator()->free();
+ weights.allocator()->free();
+ biases.allocator()->free();
+ dst.allocator()->free();
+ }
+
+private:
+ TensorType src{};
+ TensorType weights{};
+ TensorType biases{};
+ TensorType dst{};
+ Function fc_layer{};
+};
} // namespace benchmark
} // namespace test
} // namespace arm_compute