junrushao1994 commented on a change in pull request #5:
URL: https://github.com/apache/tvm-rfcs/pull/5#discussion_r676859646



##########
File path: rfcs/0001-meta-schedule-autotensorir.md
##########
@@ -107,29 +128,64 @@ best schedule according to measurement results on their 
device.
 As introduced in the previous section, in TensorIR, each schedule primitive 
handles only a very
 basic transformation of the IR. For example, `split` only splits a loop into 
two new loops. In the
 real world, the over-fine granularity of those primitives usually leads to 
repetitive and verbose
-scheduling code, as
-[mentioned](https://discuss.tvm.apache.org/t/rfc-tensorir-a-schedulable-ir-for-tvm/7872/43?u=junrushao1994)
-by developers in our community.
+scheduling code. Take the code snippet in the previous section as an example, 
a sequence of `split`s
+are invoked, followed by a `reorder`, and all these together are called 
"SSRSRS" tiling.
+
+To make it more convenient and modular, users are allowed to register 
**composite schedules** that apply
+a sequence of schedule primitives according to certain analysis of the IR. The 
word *composite* here
+is used against the word *primitive*, which means it is a transformation 
*composed* of those
+*primitives*.
+
+For example, suppose there is a composite schedule called 
`Inline-All-Elementwise-Operations`, which
+inlines all the elementwise computation into their consumers. Applying it to 
the following TensorIR:
+
+```python
[email protected]
+def example_func(...):
+  for i, j in ...:
+    with tir.Block("B") ...:
+      B[i, j] = A[i, j] + 1
+  for i, j in ...:
+    with tir.Block("C") ...:
+      C[i, j] = B[i, j] + 1
+  for i, j in ...:
+    with tir.Block("D") ...:
+      D[i, j] = C[i, j] + 1
+
+sch = tir.Schedule(example_func)
+InlineAllElementwiseOperations().apply(sch, sch.get_block("D"))
+print(tvm.script.asscript(sch.mod))
+```
+
+The result after applying the composite schedule is:
 
-To make it more convenient and modular, we allow users to register "composite 
schedules" that apply
-a sequence of schedule primitives according to certain analysis of the IR. For 
instance, a composite
-schedule may inspect a TensorIR block and decide whether we should call 
`compute_inline` on it.
+```python
[email protected]
+def example_func(...):
+  for i, j in ...:
+    with tir.Block("D") ...:
+      D[i, j] = A[i, j] + 1 + 1 + 1
+```
 
 ### 3.3. AutoTVM-style Design Space Description
 
-Meta schedule extends the schedule DSL with sampling instructions. When 
included in a schedule,
-these instructions parametrize the schedule from a single deterministic point 
to a space supported
-by random variables (tile size, etc.), making it possible for developers to 
describe the design
-space with meta schedule APIs.
+Meta schedule extends the schedule DSL with a set of new schedule primitives 
with randomness,
+called **sampling instructions**. These primitives do not transform the 
TensorIR,
+but instead will generate random decisions from specific distributions in each 
run,

Review comment:
       That's correct. In general, it allows developers to define either a 
finite or a infinite space of potential schedulings




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to