1 | /* |
2 | * Licensed to the Apache Software Foundation (ASF) under one |
3 | * or more contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. The ASF licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, |
13 | * software distributed under the License is distributed on an |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | * KIND, either express or implied. See the License for the |
16 | * specific language governing permissions and limitations |
17 | * under the License. |
18 | */ |
19 | |
20 | /*! |
21 | * \file src/relay/collage/gather_partition_specs.h |
22 | * \brief Gather the relevant \p PartitionSpecs from the available \p Targets. |
23 | */ |
24 | #ifndef TVM_RELAY_COLLAGE_GATHER_PARTITION_SPECS_H_ |
25 | #define TVM_RELAY_COLLAGE_GATHER_PARTITION_SPECS_H_ |
26 | |
27 | #include <tvm/target/compilation_config.h> |
28 | |
29 | #include "./partition_spec.h" |
30 | |
31 | namespace tvm { |
32 | namespace relay { |
33 | namespace collage { |
34 | |
35 | /*! |
36 | * \brief The 'styles' of BYOC integrations. Used to influence how their corresponding |
37 | * partition rule is constructed. |
38 | */ |
39 | enum BYOCStyle { |
40 | /*! |
41 | * \brief The BYOC patterns pick out 'ideal' candidates directly, either because: |
42 | * - the BYOC toolchain does not perform any fusion so each matched sub-expression maps 1:1 to a |
43 | * BYOC-provided operator, or |
44 | * - the BYOC toolchain does perform fusion, however the patterns have been written to pick out |
45 | * fusable sub-graphs. |
46 | */ |
47 | kNoFusionBYOCStyle, |
48 | |
49 | /*! |
50 | * \brief The BYOC patterns pick out supported operators, but the BYOC backend may perform |
51 | * fusion over those operators in much the same way TVM does. |
52 | */ |
53 | kTVMFusionBYOCStyle, |
54 | |
55 | /*! |
56 | * \brief The BYOC patterns pick out supported operators, but the BYOC backend may perform |
57 | * arbitrary fusion over those operators. |
58 | */ |
59 | kArbitraryFusionBYOCStyle, |
60 | }; |
61 | |
62 | /*! |
63 | * \brief Returns all the partition specifications gathered from the \p Targets in \p config. |
64 | */ |
65 | Array<PartitionSpec> GatherPartitionSpecs(const CompilationConfig& config); |
66 | |
67 | } // namespace collage |
68 | } // namespace relay |
69 | } // namespace tvm |
70 | |
71 | #endif // TVM_RELAY_COLLAGE_GATHER_PARTITION_SPECS_H_ |
72 | |