SiCong Li | b63b119 | 2022-01-28 18:24:39 +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 | #ifndef ENABLE_EXPERIMENTAL_DYNAMIC_FUSION |
| 25 | #error "This experimental feature must be enabled with -DENABLE_EXPERIMENTAL_DYNAMIC_FUSION" |
| 26 | #endif /* ENABLE_EXPERIMENTAL_DYNAMIC_FUSION */ |
| 27 | #ifndef ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_CLKERNELDESCRIPTORS_H |
| 28 | #define ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_CLKERNELDESCRIPTORS_H |
| 29 | |
| 30 | #include "arm_compute/core/experimental/OperatorGraph.h" |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | namespace experimental |
| 35 | { |
| 36 | namespace dynamic_fusion |
| 37 | { |
| 38 | struct ClDirectConv2dKernelDescriptor |
| 39 | { |
| 40 | friend bool operator==(const ClDirectConv2dKernelDescriptor &desc0, const ClDirectConv2dKernelDescriptor &desc1) |
| 41 | { |
| 42 | return desc0.conv2d == desc1.conv2d; |
| 43 | } |
| 44 | Conv2dDescriptor conv2d{}; |
| 45 | }; |
| 46 | |
| 47 | struct ClEltwiseAddKernelDescriptor |
| 48 | { |
| 49 | friend bool operator==(const ClEltwiseAddKernelDescriptor &desc0, const ClEltwiseAddKernelDescriptor &desc1) |
| 50 | { |
| 51 | return desc0.add == desc1.add; |
| 52 | } |
| 53 | AddDescriptor add{}; |
| 54 | }; |
| 55 | struct ClActivationKernelDescriptor |
| 56 | { |
| 57 | friend bool operator==(const ClActivationKernelDescriptor &, const ClActivationKernelDescriptor &) |
| 58 | { |
| 59 | return true; |
| 60 | } |
| 61 | }; |
| 62 | |
| 63 | enum class ClippingStrategy |
| 64 | { |
| 65 | TOP_LEFT, |
| 66 | TOP_RIGHT, |
| 67 | BOTTOM_LEFT, |
| 68 | BOTTOM_RIGHT, |
| 69 | }; |
| 70 | /** Component: Store */ |
| 71 | struct TileDescriptor |
| 72 | { |
| 73 | Size2D tile_dims{}; |
| 74 | Size2D boundaries{}; |
| 75 | ClippingStrategy clipping{ ClippingStrategy::TOP_LEFT }; |
| 76 | |
| 77 | TileDescriptor() |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | TileDescriptor(Size2D dims, const Size2D &bound, const ClippingStrategy &clip) |
| 82 | : tile_dims(dims), boundaries(bound), clipping(clip) |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | bool empty() const |
| 87 | { |
| 88 | return (tile_dims.area() == 0) || (boundaries.area() == 0); |
| 89 | } |
| 90 | friend bool operator==(const TileDescriptor &tile0, const TileDescriptor &tile1) |
| 91 | { |
| 92 | return tile0.tile_dims == tile1.tile_dims && tile0.boundaries == tile1.boundaries && tile0.clipping == tile1.clipping; |
| 93 | } |
| 94 | }; |
| 95 | enum class StoreType |
| 96 | { |
| 97 | VStore, |
| 98 | VStorePartial, |
| 99 | StoreRow, |
| 100 | ConvertStoreRow, |
| 101 | StoreBlock, |
| 102 | ConvertStoreBlock, |
| 103 | StoreRowPartial, |
| 104 | StoreBlockPartial, |
| 105 | StoreBlockBoundaryAware, |
| 106 | StoreVectorSelect, |
| 107 | TStoreIndirectWidthSelect |
| 108 | }; |
| 109 | } // namespace dynamic_fusion |
| 110 | } // namespace experimental |
| 111 | } // namespace arm_compute |
| 112 | #endif //ARM_COMPUTE_EXPERIMENTAL_DYNAMICFUSION_CLKERNELDESCRIPTORS_H |