You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by Tianqi Chen <no...@github.com.INVALID> on 2021/02/24 21:53:35 UTC

[apache/tvm] [RFC] TensorIR Scheduling Tracking Issue (#7527)

This is a global tracking issue for landing the initial PRs of TensorIR scheduling. The original RFC can be found [here](https://discuss.tvm.apache.org/t/rfc-tensorir-a-schedulable-ir-for-tvm/7872). Please feel free to bring in more questions to the corresponding thread. 

To make the improvement manageable, we will be breaking the code into several steps. The main architecture scaffolding and 
data structure changes will come first, then we will upstream individual scheduling primitives in a incremental way, where each component are self-contained.

## Steps

- [ ] M1a PR0: The additional data structure needed for TensorIR, in particular the Block structure, changes to related fields 
- [ ] M1a PR1: Changes to the tvmscript parser, printer to allow us to ingest and print the new data structures.
- [ ] M1a PR2: Overall lowering API to lower a new TIR function to the codegen.
- [ ] M1b PR0: Initial scaffolding of ScheduleState and Schedule data structure with basic utils and no primitives
- [ ] M2a PRs: multiple PRs to support scheduling primitives, one PR per primitive, with related test-cases.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Junru Shao <no...@github.com.INVALID>.
Hey @manupa-arm thanks for your interest!

> Will the integration be using #7987 ?

Most of the operators are defined with the TE DSL in TOPI, so in these cases we will definitely use #7987, which converts TE compute dag to TensorIR.

> If you guys have decided, please let us know what other the APIs (at least initially) be used to create the high-level non scheduled Primfunc?

Yep, we introduced a python-based text format (so it's the frontend for TensorIR DSL) as a convenient way to write scehduleable TensorIR. Our unittests contain a lot of examples of these: https://github.com/apache/tvm/blob/main/tests/python/unittest/test_tir_schedule_split_fuse.py#L29-L34.

> Will it include rewriting schedules in TOPI? i.e. decoupling te.compute and scheduling applied to TE graph as passes?

Great question! While #7987 converts TE compute dag to TensorIR, we cannot reuse TOPI's schedule and AutoTVM schedule templates. However, as meta schedule is coming to the rescue, in most of the cases, schedule can be generated automatically with meta schedule. We are designing some APIs to allow customized schedule as well.

Happy to discuss more if you are interested :-)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-907032840

Re: [apache/tvm] [RFC] TensorIR Scheduling Tracking Issue (#7527)

Posted by Tianqi Chen <no...@github.com.INVALID>.
key data structures are updated as per @jcf94 's comment

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-798501745

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Manupa Karunaratne <no...@github.com.INVALID>.
Hi @junrushao1994 @Hzfengsy ,

Thanks for the effort that goes in here. Some of this scheduling primitives are really useful that are not there in TE.

Will there be a task to integrate these scheduling primitives to be used by main compilation flow? (i.e. relay.build) ?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-906964640

Re: [apache/tvm] [RFC] TensorIR Scheduling Tracking Issue (#7527)

Posted by Tianqi Chen <no...@github.com.INVALID>.
Closed #7527 via #7615.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#event-4428274632

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Manupa Karunaratne <no...@github.com.INVALID>.
Thanks @junrushao1994.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-909129132

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Manupa Karunaratne <no...@github.com.INVALID>.
Ack, Many thanks for the info 🙂!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-907200410

Re: [apache/tvm] [RFC] TensorIR Scheduling Tracking Issue (#7527)

Posted by Tianqi Chen <no...@github.com.INVALID>.
Reopened #7527.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#event-4428315262

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Siyuan Feng <no...@github.com.INVALID>.
Thanks, @manupa-arm. 

Of course, we will! The ultimate goal of TensorIR is to replace the current TE schedule. 

Before integrating it to `relay`, we need to finish all of our M2 items (there are only two left). Here are the following steps:
- TensorIR docs and tutorial
- Relay integration
- Meta Schedule(AutoTIR) https://github.com/apache/tvm/issues/8473

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-906972044

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Junru Shao <no...@github.com.INVALID>.
Hey @manupa-arm, to clarify, Relay integration is probably not happening prior to meta schedule, but along with meta schedule (see M4a of meta schedule timeline). Right now we can use either #7987 or just handwrite TensorIR to play with the scheduling/codegen code path

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-907503832

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Manupa Karunaratne <no...@github.com.INVALID>.
Hey @junrushao1994 ,

Thanks for the clarifications.

Since the relay integration is supposed to be happening prior to meta schedule is being concluded, what would be the default 'schedule' (or maybe in the context of TensorIR: default set of scheduling passes) used in a relay.build flow ?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-907065910

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Manupa Karunaratne <no...@github.com.INVALID>.
Ack. Thanks.

Out of curiosity for the planned relay integration,
* Will the integration be using #7987 ?

* If you guys have decided, please let us know what other the APIs (at least initially) be used to create the high-level non scheduled Primfunc?

* Will it include rewriting schedules in TOPI? i.e. decoupling te.compute and scheduling applied to TE graph as passes?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-906994980

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Siyuan Feng <no...@github.com.INVALID>.
Hey @manupa-arm,

Don't worry. We will make TensorIR be an optional but not the default backend of relay as our first step. There must be many works (including meta schedule and some corner cases that meta schedule can not generate automatically) to do before totally switching TE to TensorIR. 

On the other hand, if you really want to use TensorIR in compilation flow before meta-schedule, you may have to rewrite TOPI schedules you need. Theoretically, we can use both TE and TensorIR in one relay network (i.e., use TensorIR for one special Op but use TE for the rest). Unfortunately, our current implementation does not support it. And we haven't decided if we will support it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-907176062

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Tianqi Chen <no...@github.com.INVALID>.
All the items are merged as of today. As a result, this issue is closed. Thanks everyone for pushing and landing this major effort.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#issuecomment-933497843

Re: [apache/tvm] [RFC][Tracking Issue] TensorIR Scheduling (#7527)

Posted by Tianqi Chen <no...@github.com.INVALID>.
Closed #7527.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm/issues/7527#event-5404079206