junrushao1994 commented on a change in pull request #5: URL: https://github.com/apache/tvm-rfcs/pull/5#discussion_r668238062
########## File path: rfcs/0001-meta-schedule-autotensorir.md ########## @@ -0,0 +1,444 @@ +<!--- Licensed to the Apache Software Foundation (ASF) under one --> +<!--- or more contributor license agreements. See the NOTICE file --> +<!--- distributed with this work for additional information --> +<!--- regarding copyright ownership. The ASF licenses this file --> +<!--- to you under the Apache License, Version 2.0 (the --> +<!--- "License"); you may not use this file except in compliance --> +<!--- with the License. You may obtain a copy of the License at --> + +<!--- http://www.apache.org/licenses/LICENSE-2.0 --> + +<!--- Unless required by applicable law or agreed to in writing, --> +<!--- software distributed under the License is distributed on an --> +<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --> +<!--- KIND, either express or implied. See the License for the --> +<!--- specific language governing permissions and limitations --> +<!--- under the License. --> + +* Feature Name: Meta Schedule (Formerly AutoTIR) +* Start Date: 2021-05-28 +* RFC PR: TBD (apache/tvm-rfcs#0000) +* GitHub Issue: TBD (apache/tvm-rfcs#0000) + +## 1. Summary + +This proposal introduces Meta Schedule: a probabilistic scheduling DSL on TIR that unifies the +approaches of AutoTVM and Auto Scheduler (Ansor). Meta schedule provides a pragmatic way to define +the space of automatic tuning, extensibility in terms of all possible TIR schedule primitives like +tensorization and loop partitioning, and customizability on every layer of the automation system. + +Meta Schedule is our 3rd generation automatic scheduling system. + +## 2. Motivation + +**Scheduling and design space.** In TVM TensorIR, optimization of a TensorIR program is done via a +sequence of transformations. For example, we reorder loops for better locality and we tensorize for +specific hardware intrinsics. The process of invoking such a set of pre-defined transformations is +called "**scheduling**", and each transformation is called a "**schedule primitive**". These +primitives form a domain-specific language (DSL) describing the transformation of TensorIR programs. +**Design space** is the set of all possible schedulings with respect to a TensorIR program. + +**Problems with the current scheduling system.** Currently we have 3 sets of scheduling APIs: +* **Manual schedule**: Developers optimize their programs by manually invoking schedule primitives, + i.e. explore points in the design space with humans in the loop. This can be a tedious and + error-prone approach, hence the creation of AutoTVM and AutoScheduler (Ansor). +* **AutoTVM**: The automation system requires users to define "schedule templates" as the design + space for each operator. Therefore, it is inextensible to hundreds of operators and variety + hardware platforms. +* **AutoScheduler (Ansor)**: It automatically generates schedule templates as the design space, + according to a set of predefined "search rules". However, it is non-trivial to extend + AutoScheduler to new schedule primitives (tensorize, loop partition, software pipelining, etc). +* The three systems above have isolated sets of APIs with several layers of their own abstraction, + which are not only hard to learn, but also engineering-intensive to customize. + +**Benefits of Meta Schedule.** Meta schedule provides: +* Succinct syntax, consistent APIs to TensorIR schedule with no other layer of abstraction. +* Unified APIs for implementing manual schedules, AutoTVM-style schedules, and AutoScheduler-style + schedules. +* Extensibility of all the schedule primitives, including tensorization and loop partitioning. + Almost no extra effort is needed to use a new primitive in auto-tuning. +* The automation infrastructure is extensible on every of its components. Every component of the + system can be customized easily in pure python or C++ or both. For example, one can develop a new + design space generator in python, a new ProgramRunner in python, etc. + + +## 3. Guide-level explanation + +In this section, we describe the syntax of meta schedule DSL, and how it could be used to describe +and auto-generate the design space. Review comment: It is great idea. Will explain and enumerate the content in this paragraph -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org