Giorgio Arena | 232c452 | 2022-03-03 10:09:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022 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 | #if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION) |
| 25 | |
| 26 | #ifndef ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_UTILS |
| 27 | #define ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_UTILS |
| 28 | |
| 29 | #include "src/core/experimental/dynamic_fusion/ClKernelBuildingAPI.h" |
| 30 | |
| 31 | namespace arm_compute |
| 32 | { |
| 33 | namespace experimental |
| 34 | { |
| 35 | namespace dynamic_fusion |
| 36 | { |
| 37 | inline ::std::ostream &operator<<(::std::ostream &os, const CLBuildOptions::StringSet &build_opts) |
| 38 | { |
| 39 | for(const auto &opt : build_opts) |
| 40 | { |
| 41 | os << opt << ","; |
| 42 | } |
| 43 | return os; |
| 44 | } |
| 45 | inline ::std::ostream &operator<<(::std::ostream &os, const CLBuildOptions &cl_build_opts) |
| 46 | { |
| 47 | os << cl_build_opts.options(); |
| 48 | return os; |
| 49 | } |
| 50 | |
| 51 | inline std::string to_string(const CLBuildOptions &cl_build_opts) |
| 52 | { |
| 53 | std::stringstream str; |
| 54 | str << cl_build_opts; |
| 55 | return str.str(); |
| 56 | } |
| 57 | inline ::std::ostream &operator<<(::std::ostream &os, const ClKernelCode &code) |
| 58 | { |
| 59 | os << "name: " << code.name << std::endl; |
| 60 | os << "code: " << code.code << std::endl; |
| 61 | os << "build_opts: " << code.build_options << std::endl; |
| 62 | return os; |
| 63 | } |
| 64 | inline std::string to_string(const ClKernelCode &code) |
| 65 | { |
| 66 | std::stringstream str; |
| 67 | str << code; |
| 68 | return str.str(); |
| 69 | } |
| 70 | |
| 71 | } // namespace dynamic_fusion |
| 72 | } // namespace experimental |
| 73 | } // namespace arm_compute |
| 74 | |
| 75 | #endif //ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_IMPL_UTILS |
| 76 | |
| 77 | #endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION) |