Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023 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 | |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 25 | #include "tests/CLKernelWriterCommentTest.h" |
| 26 | #include "tests/CLKernelWriterDeclareTileTest.h" |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 27 | #include "tests/CLConstantTileTest.hpp" |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 28 | #include "tests/CLTileTest.hpp" |
| 29 | #include "tests/TensorBitMaskTest.hpp" |
| 30 | #include "tests/UtilsTest.hpp" |
| 31 | |
| 32 | #include <memory> |
| 33 | #include <vector> |
| 34 | |
| 35 | using namespace ckw; |
| 36 | |
| 37 | /** Main test program |
| 38 | */ |
| 39 | int32_t main() |
| 40 | { |
Nikolaj Jensen | acea407 | 2023-07-03 09:44:42 +0100 | [diff] [blame] | 41 | std::vector<ITest *> tests; |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 42 | |
| 43 | // Add your test here |
| 44 | const auto test0 = std::make_unique<UtilsTest>(); |
| 45 | const auto test1 = std::make_unique<TensorBitMaskTrueTest>(); |
| 46 | const auto test2 = std::make_unique<TensorBitMaskFalseTest>(); |
Jakub Sujak | df5d987 | 2023-05-22 17:38:56 +0100 | [diff] [blame] | 47 | tests.push_back(test0.get()); |
| 48 | tests.push_back(test1.get()); |
| 49 | tests.push_back(test2.get()); |
| 50 | |
| 51 | #ifdef COMPUTE_KERNEL_WRITER_OPENCL_ENABLED |
Nikolaj Jensen | acea407 | 2023-07-03 09:44:42 +0100 | [diff] [blame] | 52 | const auto test3 = std::make_unique<CLTileInternalVariableNamesTest>(); |
| 53 | const auto test4 = std::make_unique<CLTileInternalNumVariablesTest>(); |
| 54 | const auto test5 = std::make_unique<CLTileAccessScalarVariableTest>(); |
| 55 | const auto test6 = std::make_unique<CLTileAccessScalarVariableBroadcastXTest>(); |
| 56 | const auto test7 = std::make_unique<CLTileAccessScalarVariableBroadcastYTest>(); |
| 57 | const auto test8 = std::make_unique<CLTileAccessVectorVariablesTest>(); |
| 58 | const auto test9 = std::make_unique<CLTileAccessSubVectorVariablesTest>(); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 59 | const auto test10 = std::make_unique<CLConstantTileInternalValuesTest>(); |
| 60 | const auto test11 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastXTest>(); |
| 61 | const auto test12 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastYTest>(); |
| 62 | const auto test13 = std::make_unique<CLConstantTileAccessVectorVariablesTest>(); |
| 63 | const auto test14 = std::make_unique<CLConstantTileAccessSubVectorVariablesTest>(); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 64 | #ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED |
Viet-Hoa Do | 3389f53 | 2023-07-05 17:36:40 +0100 | [diff] [blame] | 65 | const auto test15 = std::make_unique<CLKernelWriterCommentTest>(); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 66 | #endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */ |
| 67 | const auto test16 = std::make_unique<CLKernelWriterDeclareTileTest>(); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 68 | |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 69 | tests.push_back(test3.get()); |
| 70 | tests.push_back(test4.get()); |
| 71 | tests.push_back(test5.get()); |
| 72 | tests.push_back(test6.get()); |
| 73 | tests.push_back(test7.get()); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 74 | tests.push_back(test8.get()); |
| 75 | tests.push_back(test9.get()); |
| 76 | tests.push_back(test10.get()); |
| 77 | tests.push_back(test11.get()); |
| 78 | tests.push_back(test12.get()); |
| 79 | tests.push_back(test13.get()); |
| 80 | tests.push_back(test14.get()); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 81 | #ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED |
Viet-Hoa Do | 3389f53 | 2023-07-05 17:36:40 +0100 | [diff] [blame] | 82 | tests.push_back(test15.get()); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 83 | #endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */ |
| 84 | tests.push_back(test16.get()); |
Jakub Sujak | df5d987 | 2023-05-22 17:38:56 +0100 | [diff] [blame] | 85 | #endif /* COMPUTE_KERNEL_WRITER_OPENCL_ENABLED */ |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 86 | |
| 87 | bool all_test_passed = true; |
| 88 | |
| 89 | for(auto &x : tests) |
| 90 | { |
| 91 | std::cout << x->name() << std::endl; |
| 92 | all_test_passed &= x->run(); |
| 93 | } |
| 94 | |
| 95 | if(all_test_passed == true) |
| 96 | { |
| 97 | std::cout << "All tests passed" << std::endl; |
| 98 | } |
| 99 | else |
| 100 | { |
Viet-Hoa Do | 7644b91 | 2023-06-29 13:56:17 +0100 | [diff] [blame] | 101 | throw std::runtime_error("One or more tests failed"); |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | return 0; |
| 105 | } |