Georgios Pinitas | ceff0f9 | 2018-03-19 19:57:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 ARM Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h" |
| 25 | #include "arm_compute/runtime/GLES_COMPUTE/GCMemoryGroup.h" |
| 26 | #include "arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/GLES_COMPUTE/functions/GCFullyConnectedLayer.h" |
| 28 | #include "arm_compute/runtime/GLES_COMPUTE/functions/GCSoftmaxLayer.h" |
| 29 | #include "support/ToolchainSupport.h" |
| 30 | #include "tests/AssetsLibrary.h" |
| 31 | #include "tests/GLES_COMPUTE/GCAccessor.h" |
| 32 | #include "tests/Globals.h" |
| 33 | #include "tests/Utils.h" |
| 34 | #include "tests/framework/Asserts.h" |
| 35 | #include "tests/framework/Macros.h" |
| 36 | #include "tests/validation/Validation.h" |
| 37 | #include "tests/validation/fixtures/UNIT/MemoryManagerFixture.h" |
| 38 | |
| 39 | namespace arm_compute |
| 40 | { |
| 41 | namespace test |
| 42 | { |
| 43 | namespace validation |
| 44 | { |
| 45 | namespace |
| 46 | { |
| 47 | RelativeTolerance<float> tolerance_f32(0.05f); |
| 48 | } // namespace |
| 49 | |
| 50 | TEST_SUITE(GC) |
| 51 | TEST_SUITE(UNIT) |
| 52 | TEST_SUITE(MemoryManager) |
| 53 | |
| 54 | // Setting BlobMemoryManagerSimpleWithinFunctionLevel test |
| 55 | using GCBlobMemoryManagerSimpleWithinFunctionLevelFixture = BlobMemoryManagerSimpleTestCaseFixture<GCTensor, |
| 56 | GCAccessor, |
| 57 | GCBufferAllocator, |
| 58 | GCFullyConnectedLayer>; |
| 59 | FIXTURE_TEST_CASE(BlobMemoryManagerSimpleWithinFunctionLevel, |
| 60 | GCBlobMemoryManagerSimpleWithinFunctionLevelFixture, |
| 61 | framework::DatasetMode::ALL) |
| 62 | { |
| 63 | // Validate output |
| 64 | validate(GCAccessor(_target), _reference, tolerance_f32); |
| 65 | } |
| 66 | |
| 67 | // Setting BlobMemoryManagerReconfigure test |
| 68 | using GCBlobMemoryManagerReconfigureFixture = BlobMemoryManagerReconfigureTestCaseFixture<GCTensor, |
| 69 | GCAccessor, |
| 70 | GCBufferAllocator, |
| 71 | GCFullyConnectedLayer>; |
| 72 | FIXTURE_TEST_CASE(BlobMemoryManagerReconfigure, |
| 73 | GCBlobMemoryManagerReconfigureFixture, |
| 74 | framework::DatasetMode::ALL) |
| 75 | { |
| 76 | // Validate output |
| 77 | validate(GCAccessor(_target), _reference, tolerance_f32); |
| 78 | } |
| 79 | |
| 80 | // Setting BlobMemoryManagerReconfigure2 test |
| 81 | using GCBlobMemoryManagerReconfigure2Fixture = BlobMemoryManagerReconfigure2TestCaseFixture<GCTensor, |
| 82 | GCAccessor, |
| 83 | GCBufferAllocator, |
| 84 | GCFullyConnectedLayer, |
| 85 | GCSoftmaxLayer>; |
| 86 | FIXTURE_TEST_CASE(BlobMemoryManagerReconfigure2, |
| 87 | GCBlobMemoryManagerReconfigure2Fixture, |
| 88 | framework::DatasetMode::ALL) |
| 89 | { |
| 90 | // Validate output |
| 91 | validate(GCAccessor(_target), _reference, tolerance_f32); |
| 92 | } |
| 93 | |
| 94 | TEST_SUITE_END() |
| 95 | TEST_SUITE_END() |
| 96 | TEST_SUITE_END() |
| 97 | } // namespace validation |
| 98 | } // namespace test |
| 99 | } // namespace arm_compute |