aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-03-31 15:59:41 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-04-28 18:30:41 +0000
commit06cf9339ed4b86d559c837dcb7c1c273ae6a35eb (patch)
tree08380f00a37152c7fe589d58e6693bec3c00b1ff
parent6a1db9b25ed3a37449fdbc8479c6d3700fd157de (diff)
downloadComputeLibrary-06cf9339ed4b86d559c837dcb7c1c273ae6a35eb.tar.gz
COMPMID-3294: Add AssetLibrary instance using a fixed seed
- Add fixed_seed instance for future use - Make Copy fixture use the new instance to validate functionality Change-Id: I7e8c1504b8db3203213d084b300f10ecd384f7fa Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3107 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--tests/Globals.h3
-rw-r--r--tests/main.cpp9
-rw-r--r--tests/validate_examples/RunExample.cpp5
-rw-r--r--tests/validation/CL/Copy.cpp4
-rw-r--r--tests/validation/NEON/Copy.cpp5
-rw-r--r--tests/validation/fixtures/CopyFixture.h5
6 files changed, 22 insertions, 9 deletions
diff --git a/tests/Globals.h b/tests/Globals.h
index 2a13f343d0..db79e33f02 100644
--- a/tests/Globals.h
+++ b/tests/Globals.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -34,6 +34,7 @@ namespace arm_compute
namespace test
{
extern std::unique_ptr<AssetsLibrary> library;
+extern std::unique_ptr<AssetsLibrary> fixed_library;
extern std::unique_ptr<ParametersLibrary> parameters;
} // namespace test
} // namespace arm_compute
diff --git a/tests/main.cpp b/tests/main.cpp
index bbb43c9a39..17342fc2c1 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -75,7 +75,11 @@ namespace arm_compute
{
namespace test
{
-std::unique_ptr<AssetsLibrary> library;
+std::unique_ptr<AssetsLibrary> library;
+
+static constexpr uint32_t fixed_seed = 1;
+std::unique_ptr<AssetsLibrary> fixed_library;
+
extern std::unique_ptr<ParametersLibrary> parameters;
} // namespace test
} // namespace arm_compute
@@ -308,7 +312,8 @@ int main(int argc, char **argv)
return 0;
}
- library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), seed->value());
+ library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), seed->value());
+ fixed_library = support::cpp14::make_unique<AssetsLibrary>(assets->value(), fixed_seed);
if(!parser.validate())
{
diff --git a/tests/validate_examples/RunExample.cpp b/tests/validate_examples/RunExample.cpp
index 5d5291abfb..998d5013a8 100644
--- a/tests/validate_examples/RunExample.cpp
+++ b/tests/validate_examples/RunExample.cpp
@@ -53,6 +53,8 @@ namespace arm_compute
namespace test
{
std::unique_ptr<AssetsLibrary> library;
+static constexpr uint32_t fixed_seed = 1;
+std::unique_ptr<AssetsLibrary> fixed_library;
} // namespace test
namespace utils
{
@@ -136,7 +138,8 @@ int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example)
g_example_argv.emplace_back(const_cast<char *>(arg.c_str())); // NOLINT
}
- library = support::cpp14::make_unique<AssetsLibrary>("." /* Only using random values */, seed->value());
+ library = support::cpp14::make_unique<AssetsLibrary>("." /* Only using random values */, seed->value());
+ fixed_library = support::cpp14::make_unique<AssetsLibrary>(".", fixed_seed);
if(options.log_level->value() > framework::LogLevel::NONE)
{
diff --git a/tests/validation/CL/Copy.cpp b/tests/validation/CL/Copy.cpp
index fdbd07bd4b..34ba3ab532 100644
--- a/tests/validation/CL/Copy.cpp
+++ b/tests/validation/CL/Copy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -67,6 +67,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
template <typename T>
using CLCopyFixture = CopyFixture<CLTensor, CLAccessor, CLCopy, T>;
+TEST_SUITE(FixedSeed)
TEST_SUITE(F32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLCopyFixture<float>, framework::DatasetMode::ALL, combine(zip(datasets::SmallShapes(), datasets::SmallShapes()), framework::dataset::make("DataType",
DataType::F32)))
@@ -93,6 +94,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLCopyFixture<uint16_t>, framework::DatasetMode
validate(CLAccessor(_target), _reference);
}
TEST_SUITE_END() // U16
+TEST_SUITE_END() // FixedSeed
TEST_SUITE_END() // Copy
TEST_SUITE_END() // CL
diff --git a/tests/validation/NEON/Copy.cpp b/tests/validation/NEON/Copy.cpp
index c2dedeff76..350fd0085e 100644
--- a/tests/validation/NEON/Copy.cpp
+++ b/tests/validation/NEON/Copy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -62,7 +62,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
}
// clang-format on
// *INDENT-ON*
-
+TEST_SUITE(FixedSeed)
TEST_SUITE(F32)
FIXTURE_DATA_TEST_CASE(RunSmall, NECopyFixture<float>, framework::DatasetMode::ALL, combine(zip(datasets::SmallShapes(), datasets::SmallShapes()), framework::dataset::make("DataType",
DataType::F32)))
@@ -89,6 +89,7 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NECopyFixture<uint16_t>, framework::DatasetMode
validate(Accessor(_target), _reference);
}
TEST_SUITE_END() // U16
+TEST_SUITE_END() // FixedSeed
TEST_SUITE_END() // Copy
TEST_SUITE_END() // NEON
diff --git a/tests/validation/fixtures/CopyFixture.h b/tests/validation/fixtures/CopyFixture.h
index 911d908e53..534d5b3145 100644
--- a/tests/validation/fixtures/CopyFixture.h
+++ b/tests/validation/fixtures/CopyFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -54,7 +54,8 @@ protected:
template <typename U>
void fill(U &&tensor, int i)
{
- library->fill_tensor_uniform(tensor, i);
+ // This kernel doesn't benefit from using random seed as it just copies values.
+ fixed_library->fill_tensor_uniform(tensor, i);
}
TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type)