mindspore-ai / akg

AKG (Auto Kernel Generator) is an optimizer for operators in Deep Learning Networks, which provides the ability to automatically fuse ops with specific patterns.
https://gitee.com/mindspore/akg
Apache License 2.0
214 stars 38 forks source link

Replce ScheduleTree with my own Schedule Tree #6

Open MingliSun opened 3 years ago

MingliSun commented 3 years ago

Hi,I'm implementing a front end which apply its own APIs to generate ScheduleTree in isl.And I want to use AKG as my back end to generate GPU or Acend code. So I want to do "AutoPoly" stage with my own Schedule Tree which is identical to AKG's generated ScheduleTree and do next sequential passes as AKG did. I replace

MakeScheduleTree()

in scop_builder.cc with my ScheduleTree string.But I noticed that its origal implementation do a lot to initialize _scopinfo which is critical to Transform() and GenHalide() in AutoPoly stage.(I learned that by reading the source code) And I don't want to generate Stmt by "schedule.ScheduleOps"becase if I had did it ,there was no need to generate ScheduleTree by my own.

Futhermore,the original ScheduleTree generation including scop_info assignment depends on Stmt,so I'm a little confused how to skip Stmt and assign scop_info .Is that a possibal way to assign scop_info?If not ,any other tips to implement my thought?Or what should I learn to do that? Thanks a lot.

dylanGeng commented 3 years ago

Thanks @MingliSun If u want to load your own schedule tree to AutoPoly, u can load your own schedule tree from this interface "LoadScheduleTreeFromFile" if the initial schedule tree can not meet your expection.

In the scop_builder, we will analysis many useful information for poly pass for different backend. So I suppose you should pass your own Stmt to AutoPoly or convert your own IR to Halide IR then pass to AutoPoly. Skipping scop_info will add more work on the initialization of analysis_info in scop_info.