diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-03-18 10:59:40 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-04-28 17:05:40 +0000 |
commit | c3c352e60050f3deacad767e429a88dc24b31af0 (patch) | |
tree | ad30a0ba717a742caf5e4dcb9d89389cfdc134b0 /tests/validation/fixtures/UNIT | |
parent | e2535154fa34ac0290ec3daaa44545be0b2b4606 (diff) | |
download | ComputeLibrary-c3c352e60050f3deacad767e429a88dc24b31af0.tar.gz |
Add Queue support
Queues are responsible for scheduling operators and performing other
runtime related activities like for example tuning.
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I0366d9048470d277b8cbf59fa42f95c0ae57c5c9
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5487
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/fixtures/UNIT')
-rw-r--r-- | tests/validation/fixtures/UNIT/ContextFixture.h (renamed from tests/validation/fixtures/UNIT/Context.h) | 6 | ||||
-rw-r--r-- | tests/validation/fixtures/UNIT/QueueFixture.h | 144 | ||||
-rw-r--r-- | tests/validation/fixtures/UNIT/TensorFixture.h (renamed from tests/validation/fixtures/UNIT/Tensor.h) | 8 | ||||
-rw-r--r-- | tests/validation/fixtures/UNIT/TensorPackFixture.h (renamed from tests/validation/fixtures/UNIT/TensorPack.h) | 6 |
4 files changed, 154 insertions, 10 deletions
diff --git a/tests/validation/fixtures/UNIT/Context.h b/tests/validation/fixtures/UNIT/ContextFixture.h index afa49e00e0..77cbc12320 100644 --- a/tests/validation/fixtures/UNIT/Context.h +++ b/tests/validation/fixtures/UNIT/ContextFixture.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_TEST_UNIT_CONTEXT -#define ARM_COMPUTE_TEST_UNIT_CONTEXT +#ifndef ARM_COMPUTE_TEST_UNIT_CONTEXT_FIXTURE +#define ARM_COMPUTE_TEST_UNIT_CONTEXT_FIXTURE #include "arm_compute/Acl.hpp" #include "tests/framework/Asserts.h" @@ -145,4 +145,4 @@ public: } // namespace validation } // namespace test } // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_UNIT_CONTEXT */ +#endif /* ARM_COMPUTE_TEST_UNIT_CONTEXT_FIXTURE */ diff --git a/tests/validation/fixtures/UNIT/QueueFixture.h b/tests/validation/fixtures/UNIT/QueueFixture.h new file mode 100644 index 0000000000..bc93f5f120 --- /dev/null +++ b/tests/validation/fixtures/UNIT/QueueFixture.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_UNIT_QUEUE_FIXTURE +#define ARM_COMPUTE_TEST_UNIT_QUEUE_FIXTURE + +#include "arm_compute/Acl.hpp" +#include "tests/framework/Asserts.h" +#include "tests/framework/Fixture.h" +#include "tests/framework/Macros.h" +#include "tests/validation/Validation.h" + +namespace arm_compute +{ +namespace test +{ +namespace validation +{ +/** Test case for AclCreateQueue + * + * Validate that AclCreateQueue behaves as expected with invalid context + * + * Test Steps: + * - Call AclCreateQueue with an invalid context + * - Confirm that AclInvalidArgument is reported + * - Confirm that the queue is still nullptr + */ +class CreateQueueWithInvalidContextFixture : public framework::Fixture +{ +public: + void setup() + { + AclQueue queue = nullptr; + ARM_COMPUTE_ASSERT(AclCreateQueue(&queue, nullptr, nullptr) == AclStatus::AclInvalidArgument); + ARM_COMPUTE_ASSERT(queue == nullptr); + }; +}; + +/** Test-case for AclCreateQueue + * + * Validate that AclCreateQueue behaves as expected with invalid options + * + * Test Steps: + * - Call AclCreateQueue with valid context but invalid options + * - Confirm that AclInvalidArgument is reported + * - Confirm that queue is still nullptr + */ +template <acl::Target Target> +class CreateQueuerWithInvalidOptionsFixture : public framework::Fixture +{ +public: + void setup() + { + acl::Context ctx(Target); + + // Check invalid tuning mode + AclQueueOptions invalid_queue_opts; + invalid_queue_opts.mode = static_cast<AclTuningMode>(-1); + + AclQueue queue = nullptr; + ARM_COMPUTE_ASSERT(AclCreateQueue(&queue, ctx.get(), &invalid_queue_opts) == AclStatus::AclInvalidArgument); + ARM_COMPUTE_ASSERT(queue == nullptr); + }; +}; + +/** Test case for AclDestroyQueue +* +* Validate that AclDestroyQueue behaves as expected when an invalid queue is given +* +* Test Steps: +* - Call AclDestroyQueue with null queue +* - Confirm that AclInvalidArgument is reported +* - Call AclDestroyQueue on empty array +* - Confirm that AclInvalidArgument is reported +* - Call AclDestroyQueue on an ACL object other than AclQueue +* - Confirm that AclInvalidArgument is reported +* - Confirm that queue is still nullptr +*/ +template <acl::Target Target> +class DestroyInvalidQueueFixture : public framework::Fixture +{ +public: + void setup() + { + acl::Context ctx(Target); + + std::array<char, 256> empty_array{}; + AclQueue queue = nullptr; + + ARM_COMPUTE_ASSERT(AclDestroyQueue(queue) == AclStatus::AclInvalidArgument); + ARM_COMPUTE_ASSERT(AclDestroyQueue(reinterpret_cast<AclQueue>(ctx.get())) == AclStatus::AclInvalidArgument); + ARM_COMPUTE_ASSERT(AclDestroyQueue(reinterpret_cast<AclQueue>(empty_array.data())) == AclStatus::AclInvalidArgument); + ARM_COMPUTE_ASSERT(queue == nullptr); + }; +}; + +/** Test case for AclCreateQueue + * + * Validate that a queue can be created successfully + * + * Test Steps: + * - Create a valid context + * - Create a valid queue + * - Confirm that AclSuccess is returned + */ +template <acl::Target Target> +class SimpleQueueFixture : public framework::Fixture +{ +public: + void setup() + { + acl::StatusCode err = acl::StatusCode::Success; + + acl::Context ctx(Target, &err); + ARM_COMPUTE_ASSERT(err == acl::StatusCode::Success); + + acl::Queue queue(ctx, &err); + ARM_COMPUTE_ASSERT(err == acl::StatusCode::Success); + }; +}; +} // namespace validation +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_UNIT_QUEUE_FIXTURE */ diff --git a/tests/validation/fixtures/UNIT/Tensor.h b/tests/validation/fixtures/UNIT/TensorFixture.h index 32260cb431..bfe115b3ed 100644 --- a/tests/validation/fixtures/UNIT/Tensor.h +++ b/tests/validation/fixtures/UNIT/TensorFixture.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_TEST_UNIT_TENSOR -#define ARM_COMPUTE_TEST_UNIT_TENSOR +#ifndef ARM_COMPUTE_TEST_UNIT_TENSOR_FIXTURE +#define ARM_COMPUTE_TEST_UNIT_TENSOR_FIXTURE #include "arm_compute/Acl.hpp" #include "tests/framework/Asserts.h" @@ -149,7 +149,7 @@ public: /** Test case for AclTensor * * Validate that multiple tensors can be created successfully - * Possibly stress the possibility of memory leaks + * Stress the possibility of memory leaks * * Test Steps: * - Create a valid context @@ -421,4 +421,4 @@ public: } // namespace validation } // namespace test } // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_UNIT_TENSOR */ +#endif /* ARM_COMPUTE_TEST_UNIT_TENSOR_FIXTURE */ diff --git a/tests/validation/fixtures/UNIT/TensorPack.h b/tests/validation/fixtures/UNIT/TensorPackFixture.h index 98bffb1665..bc14631936 100644 --- a/tests/validation/fixtures/UNIT/TensorPack.h +++ b/tests/validation/fixtures/UNIT/TensorPackFixture.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_TEST_UNIT_TENSORPACK -#define ARM_COMPUTE_TEST_UNIT_TENSORPACK +#ifndef ARM_COMPUTE_TEST_UNIT_TENSORPACK_FIXTURE +#define ARM_COMPUTE_TEST_UNIT_TENSORPACK_FIXTURE #include "arm_compute/Acl.hpp" #include "tests/framework/Asserts.h" @@ -181,4 +181,4 @@ public: } // namespace validation } // namespace test } // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_UNIT_TENSORPACK */ +#endif /* ARM_COMPUTE_TEST_UNIT_TENSORPACK_FIXTURE */ |