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#ifndef TVM_META_SCHEDULE_TRACE_APPLY_H_
20#define TVM_META_SCHEDULE_TRACE_APPLY_H_
21
22#include <tvm/meta_schedule/schedule_rule.h>
23#include <tvm/target/target.h>
24#include <tvm/tir/schedule/schedule.h>
25#include <tvm/tir/schedule/trace.h>
26
27#include <string>
28
29namespace tvm {
30namespace meta_schedule {
31
32/*!
33 * \brief Apply the trace from a TIR module whose anchor block is the same but fused elemewise
34 * op blocks differ. This function can be used for transferring a trace tuned on a conv2d -> add
35 * subgraph to other subgraphs having the same conv2d workload, for example. We call such trace
36 * an "anchor trace". Those blocks that are not scheduled by the given anchor trace will be either
37 * inlined or parallelized.
38 * \param sch The schedule to apply the anchor trace.
39 * \param anchor_trace The trace tuned on other subgraph with the same anchor-block workload.
40 * \param target The target information needed for inlining and parallelization.
41 */
42void ScheduleUsingAnchorTrace(tir::Schedule sch, const tir::Trace& anchor_trace,
43 const tvm::Target& target);
44
45} // namespace meta_schedule
46} // namespace tvm
47
48#endif // TVM_META_SCHEDULE_TRACE_APPLY_H_
49