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 | 47a396e | 2023-08-17 11:04:02 +0100 | [diff] [blame] | 25 | #include "validation/tests/CLConstantTileTest.hpp" |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 26 | #include "validation/tests/CLKernelWriterAssignTest.h" |
Viet-Hoa Do | 34b6c3a | 2023-08-22 11:11:23 +0100 | [diff] [blame] | 27 | #include "validation/tests/CLKernelWriterBinaryOpTest.h" |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 28 | #include "validation/tests/CLKernelWriterCastTest.h" |
Gunes Bayir | 47a396e | 2023-08-17 11:04:02 +0100 | [diff] [blame] | 29 | #include "validation/tests/CLKernelWriterCommentTest.h" |
Gunes Bayir | 806b8e8 | 2023-08-23 23:28:31 +0100 | [diff] [blame] | 30 | #include "validation/tests/CLKernelWriterDeclareConstantTileTest.h" |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 31 | #include "validation/tests/CLKernelWriterDeclareTensorTest.h" |
Gunes Bayir | 47a396e | 2023-08-17 11:04:02 +0100 | [diff] [blame] | 32 | #include "validation/tests/CLKernelWriterDeclareTileTest.h" |
Viet-Hoa Do | 2d0c2f5 | 2023-08-24 11:48:19 +0100 | [diff] [blame] | 33 | #include "validation/tests/CLKernelWriterForTest.h" |
| 34 | #include "validation/tests/CLKernelWriterIfTest.h" |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 35 | #include "validation/tests/CLKernelWriterOpLoadStoreTest.h" |
Viet-Hoa Do | 2d0c2f5 | 2023-08-24 11:48:19 +0100 | [diff] [blame] | 36 | #include "validation/tests/CLKernelWriterReturnTest.h" |
Viet-Hoa Do | 34b6c3a | 2023-08-22 11:11:23 +0100 | [diff] [blame] | 37 | #include "validation/tests/CLKernelWriterTernaryOpTest.h" |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 38 | #include "validation/tests/CLKernelWriterUnaryExpressionTest.h" |
Gunes Bayir | 47a396e | 2023-08-17 11:04:02 +0100 | [diff] [blame] | 39 | #include "validation/tests/CLTensorArgumentTest.h" |
| 40 | #include "validation/tests/CLTileTest.hpp" |
| 41 | #include "validation/tests/TensorBitMaskTest.h" |
| 42 | #include "validation/tests/UtilsTest.h" |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 43 | |
| 44 | #include <memory> |
| 45 | #include <vector> |
| 46 | |
| 47 | using namespace ckw; |
| 48 | |
| 49 | /** Main test program |
| 50 | */ |
| 51 | int32_t main() |
| 52 | { |
Nikolaj Jensen | acea407 | 2023-07-03 09:44:42 +0100 | [diff] [blame] | 53 | std::vector<ITest *> tests; |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 54 | |
| 55 | // Add your test here |
| 56 | const auto test0 = std::make_unique<UtilsTest>(); |
| 57 | const auto test1 = std::make_unique<TensorBitMaskTrueTest>(); |
| 58 | const auto test2 = std::make_unique<TensorBitMaskFalseTest>(); |
Jakub Sujak | df5d987 | 2023-05-22 17:38:56 +0100 | [diff] [blame] | 59 | tests.push_back(test0.get()); |
| 60 | tests.push_back(test1.get()); |
| 61 | tests.push_back(test2.get()); |
| 62 | |
| 63 | #ifdef COMPUTE_KERNEL_WRITER_OPENCL_ENABLED |
Nikolaj Jensen | acea407 | 2023-07-03 09:44:42 +0100 | [diff] [blame] | 64 | const auto test3 = std::make_unique<CLTileInternalVariableNamesTest>(); |
| 65 | const auto test4 = std::make_unique<CLTileInternalNumVariablesTest>(); |
| 66 | const auto test5 = std::make_unique<CLTileAccessScalarVariableTest>(); |
| 67 | const auto test6 = std::make_unique<CLTileAccessScalarVariableBroadcastXTest>(); |
| 68 | const auto test7 = std::make_unique<CLTileAccessScalarVariableBroadcastYTest>(); |
| 69 | const auto test8 = std::make_unique<CLTileAccessVectorVariablesTest>(); |
| 70 | const auto test9 = std::make_unique<CLTileAccessSubVectorVariablesTest>(); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 71 | const auto test10 = std::make_unique<CLConstantTileInternalValuesTest>(); |
| 72 | const auto test11 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastXTest>(); |
| 73 | const auto test12 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastYTest>(); |
| 74 | const auto test13 = std::make_unique<CLConstantTileAccessVectorVariablesTest>(); |
| 75 | const auto test14 = std::make_unique<CLConstantTileAccessSubVectorVariablesTest>(); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 76 | #ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED |
Viet-Hoa Do | 3389f53 | 2023-07-05 17:36:40 +0100 | [diff] [blame] | 77 | const auto test15 = std::make_unique<CLKernelWriterCommentTest>(); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 78 | #endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */ |
| 79 | const auto test16 = std::make_unique<CLKernelWriterDeclareTileTest>(); |
Gian Marco Iodice | ebfdb5a | 2023-07-07 11:25:57 +0100 | [diff] [blame] | 80 | const auto test17 = std::make_unique<CLTensorArgumentComponentNamesTest>(); |
| 81 | const auto test18 = std::make_unique<CLTensorArgumentStorageNamesTest>(); |
| 82 | const auto test19 = std::make_unique<CLTensorArgumentComponentValuesTest>(); |
| 83 | const auto test20 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueFalseTest>(); |
| 84 | const auto test21 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueTrueTest>(); |
| 85 | const auto test22 = std::make_unique<CLTensorArgumentStoragesUsedTest>(); |
| 86 | const auto test23 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueTrueDynamicDimTrueTest>(); |
Viet-Hoa Do | 1df9f6e | 2023-07-24 17:57:12 +0100 | [diff] [blame] | 87 | const auto test24 = std::make_unique<CLKernelWriterDeclareTensorTest>(); |
Gunes Bayir | 47a396e | 2023-08-17 11:04:02 +0100 | [diff] [blame] | 88 | const auto test25 = std::make_unique<CLKernelWriterOpLoadStoreTest>(); |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 89 | const auto test26 = std::make_unique<CLKernelWriterAssignTest>(); |
| 90 | const auto test27 = std::make_unique<CLKernelWriterCastTest>(); |
| 91 | const auto test28 = std::make_unique<CLKernelWriterUnaryExpressionTest>(); |
Viet-Hoa Do | 34b6c3a | 2023-08-22 11:11:23 +0100 | [diff] [blame] | 92 | const auto test29 = std::make_unique<CLKernelWriterBinaryOpTest>(); |
| 93 | const auto test30 = std::make_unique<CLKernelWriterTernaryOpTest>(); |
Gunes Bayir | 806b8e8 | 2023-08-23 23:28:31 +0100 | [diff] [blame] | 94 | const auto test31 = std::make_unique<CLKernelWriterDeclareConstantTileTest>(); |
Viet-Hoa Do | 2d0c2f5 | 2023-08-24 11:48:19 +0100 | [diff] [blame] | 95 | const auto test32 = std::make_unique<CLKernelWriterIfTest>(); |
| 96 | const auto test33 = std::make_unique<CLKernelWriterForTest>(); |
| 97 | const auto test34 = std::make_unique<CLKernelWriterReturnTest>(); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 98 | |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 99 | tests.push_back(test3.get()); |
| 100 | tests.push_back(test4.get()); |
| 101 | tests.push_back(test5.get()); |
| 102 | tests.push_back(test6.get()); |
| 103 | tests.push_back(test7.get()); |
Gian Marco Iodice | 68e9c4d | 2023-06-15 17:40:28 +0100 | [diff] [blame] | 104 | tests.push_back(test8.get()); |
| 105 | tests.push_back(test9.get()); |
| 106 | tests.push_back(test10.get()); |
| 107 | tests.push_back(test11.get()); |
| 108 | tests.push_back(test12.get()); |
| 109 | tests.push_back(test13.get()); |
| 110 | tests.push_back(test14.get()); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 111 | #ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED |
Viet-Hoa Do | 3389f53 | 2023-07-05 17:36:40 +0100 | [diff] [blame] | 112 | tests.push_back(test15.get()); |
Gunes Bayir | ab0b750 | 2023-07-11 14:57:36 +0100 | [diff] [blame] | 113 | #endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */ |
| 114 | tests.push_back(test16.get()); |
Gian Marco Iodice | ebfdb5a | 2023-07-07 11:25:57 +0100 | [diff] [blame] | 115 | tests.push_back(test17.get()); |
| 116 | tests.push_back(test18.get()); |
| 117 | tests.push_back(test19.get()); |
| 118 | tests.push_back(test20.get()); |
| 119 | tests.push_back(test21.get()); |
| 120 | tests.push_back(test22.get()); |
| 121 | tests.push_back(test23.get()); |
Viet-Hoa Do | 1df9f6e | 2023-07-24 17:57:12 +0100 | [diff] [blame] | 122 | tests.push_back(test24.get()); |
Gunes Bayir | 362e1e0 | 2023-08-23 23:56:54 +0100 | [diff] [blame] | 123 | tests.push_back(test25.get()); |
Viet-Hoa Do | e1c3b46 | 2023-07-31 17:13:34 +0100 | [diff] [blame] | 124 | tests.push_back(test26.get()); |
| 125 | tests.push_back(test27.get()); |
| 126 | tests.push_back(test28.get()); |
Viet-Hoa Do | 34b6c3a | 2023-08-22 11:11:23 +0100 | [diff] [blame] | 127 | tests.push_back(test29.get()); |
| 128 | tests.push_back(test30.get()); |
Gunes Bayir | 806b8e8 | 2023-08-23 23:28:31 +0100 | [diff] [blame] | 129 | tests.push_back(test31.get()); |
Viet-Hoa Do | 2d0c2f5 | 2023-08-24 11:48:19 +0100 | [diff] [blame] | 130 | tests.push_back(test32.get()); |
| 131 | tests.push_back(test33.get()); |
| 132 | tests.push_back(test34.get()); |
Jakub Sujak | df5d987 | 2023-05-22 17:38:56 +0100 | [diff] [blame] | 133 | #endif /* COMPUTE_KERNEL_WRITER_OPENCL_ENABLED */ |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 134 | |
| 135 | bool all_test_passed = true; |
| 136 | |
| 137 | for(auto &x : tests) |
| 138 | { |
| 139 | std::cout << x->name() << std::endl; |
| 140 | all_test_passed &= x->run(); |
| 141 | } |
| 142 | |
| 143 | if(all_test_passed == true) |
| 144 | { |
| 145 | std::cout << "All tests passed" << std::endl; |
| 146 | } |
| 147 | else |
| 148 | { |
Viet-Hoa Do | 7644b91 | 2023-06-29 13:56:17 +0100 | [diff] [blame] | 149 | throw std::runtime_error("One or more tests failed"); |
Gian Marco Iodice | 6c113ed | 2023-01-19 17:14:26 +0000 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | return 0; |
| 153 | } |