| 1 | // Tencent is pleased to support the open source community by making ncnn available. |
| 2 | // |
| 3 | // Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. |
| 4 | // |
| 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except |
| 6 | // in compliance with the License. You may obtain a copy of the License at |
| 7 | // |
| 8 | // https://opensource.org/licenses/BSD-3-Clause |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software distributed |
| 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | // specific language governing permissions and limitations under the License. |
| 14 | |
| 15 | #include "pass_level3.h" |
| 16 | |
| 17 | #include "pass_level3/assign_unique_name.h" |
| 18 | #include "pass_level3/eliminate_noop_math.h" |
| 19 | #include "pass_level3/eliminate_tuple_pair.h" |
| 20 | #include "pass_level3/expand_quantization_modules.h" |
| 21 | #include "pass_level3/fuse_opnto1_tensors.h" |
| 22 | #include "pass_level3/fuse_op1ton_unpack.h" |
| 23 | #include "pass_level3/fuse_dynamic_adaptive_pool.h" |
| 24 | #include "pass_level3/fuse_einsum_operands.h" |
| 25 | #include "pass_level3/fuse_expression.h" |
| 26 | #include "pass_level3/fuse_index_expression.h" |
| 27 | #include "pass_level3/fuse_maxpool_unpack.h" |
| 28 | #include "pass_level3/fuse_multiheadattention_unpack.h" |
| 29 | #include "pass_level3/fuse_rnn_unpack.h" |
| 30 | #include "pass_level3/rename_F_conv_transposend.h" |
| 31 | #include "pass_level3/rename_F_convmode.h" |
| 32 | #include "pass_level3/rename_F_dropoutnd.h" |
| 33 | |
| 34 | // #include "pass_level4/canonicalize.h" |
| 35 | // #include "pass_level4/fuse_custom_op.h" |
| 36 | // #include "pass_level4/dead_code_elimination.h" |
| 37 | |
| 38 | namespace pnnx { |
| 39 | |
| 40 | void pass_level3(Graph& g, const std::set<std::string>& foldable_constants, const std::string& foldable_constants_zippath) |
| 41 | { |
| 42 | assign_unique_name(g); |
| 43 | |
| 44 | fuse_opnto1_tensors(g); |
| 45 | |
| 46 | fuse_op1ton_unpack(g); |
| 47 | |
| 48 | fuse_einsum_operands(g); |
| 49 | |
| 50 | fuse_maxpool_unpack(g); |
| 51 | |
| 52 | fuse_multiheadattention_unpack(g); |
| 53 | |
| 54 | fuse_rnn_unpack(g); |
| 55 | |
| 56 | fuse_dynamic_adaptive_pool(g); |
| 57 | |
| 58 | expand_quantization_modules(g); |
| 59 | |
| 60 | eliminate_tuple_pair(g); |
| 61 | |
| 62 | rename_F_conv_transposend(g); |
| 63 | |
| 64 | rename_F_convmode(g); |
| 65 | |
| 66 | rename_F_dropoutnd(g); |
| 67 | |
| 68 | eliminate_noop_math(g); |
| 69 | |
| 70 | fuse_expression(g, foldable_constants, foldable_constants_zippath); |
| 71 | |
| 72 | fuse_index_expression(g); |
| 73 | |
| 74 | // dead_code_elimination(g); |
| 75 | |
| 76 | // canonicalize(g); |
| 77 | } |
| 78 | |
| 79 | } // namespace pnnx |