Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass #496

Conversation

zxybazh
Copy link
Collaborator

@zxybazh zxybazh commented Oct 28, 2021

This PR Introduced a decorator for PyClass methods to avoid inifinite loop when calling a method not overrided.
E.g. PySpaceGenerator().generate_design_space(mod) would now throw a NotImplementedError instead of a segmentation fault. Correspondingly, any new class inherited from PyClass would have to override all the classes, otherwise would cause a NotImplementedError when constructing it.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Oct 28, 2021

1/4) One interesting finding is that, if we think it through, we cannot define a python class that partially use c++-side implementation as we was assuming in PyTaskScheduler because any function not overrided, would call ffi, which calls back to the python side implementation, making a infinite loop.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Oct 28, 2021

2/4) Therefore, in our current design, it's legit to force override of all methods to avoid infinite loop. Of course, we cannot avoid infinite loop caused by calling ffi back, that would be user's responsibility though.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Oct 28, 2021

3/4) Now let's take a look back to the problem of how to correcly deal with the PyClasses. They are inherited from the base classes, so any ffi call back to its base class will invoke its own function, which calls back to the python side packed func. If we want to cut the evil loop, we need to do a check on the c++ side, if the PackedFunc simply calls itself, we need to call the base classes' corresponding method, or throw not implemented.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Oct 28, 2021

4/4) I don't have a very good idea to have it implemented, while it's feasible. Would like to know how do you think about the problem.

@junrushao
Copy link
Member

Thank you @zxybazh for spotting this very subtle bug!! The PR looks good to me overall. Would you mind update the TaskScheduler to allow using parent classes' virtual methods? Then this PR will be good to go :-)

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 2, 2021

Hi @junrushao1994 , there are some major updates here:

  1. Update the init function for PyTaskScheduler.
  2. Changed all PyClasses to optional override, as per our discussion.
    • Virtual functions are checked for nullptr.
    • Other functions are directed to base class.
  3. Added and enhanced unittests.

Thanks for the review and discussion, and please let me know if this looks good to you.
Now the task scheduler is much more usable, as shown in the test case.

An example of calling route of _is_task_running if not overrided in Python:

Python side:

  • PyTaskScheduler does not have _is_task_running
  • Call TaskScheduler's is_task_running, which calls ffi

C++ side:

  • The ffi calls TaskScheduler's is_task_running
  • But it is overrided in PyTaskScheduler
  • PyTaskScheduler checks if the function is overrided in python
    - If not, it returns the TaskScheduler's vtable, calling
    TaskScheduler::IsTaskRunning

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 4, 2021

The errors are now raised as NotImplementError when declaring the class. And the CHECKs in c++ are changed into ICHECK without error type (because it's internal error, it should throw a NIE beforehand). Tests passed and ready for review.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 4, 2021

Another change is next_task_id func's underscore is removed, also tune as in TaskScheduler. That is because, tune is used for function calling and next_task_id is a function that you have to override for TaskScheduler.

@junrushao
Copy link
Member

@zxybazh Thanks for the update! The only issue I'm seeing right now is that we don't need to defer CHECK to method invocation time. For example, the nullability check of PyMutator could be checked the method Mutator::PyMutator

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 4, 2021

@zxybazh Thanks for the update! The only issue I'm seeing right now is that we don't need to defer CHECK to method invocation time. For example, the nullability check of PyMutator could be checked the method Mutator::PyMutator

Thanks for reviewing. The nullability check has been done when calling "check_override" so during invocation it's just double checking, thus using ICHECK.

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 4, 2021

Therefore, when instantiating any object without all required methods overrided, it will raise a not implemented error.

@junrushao
Copy link
Member

Okay that sounds great! Please feel free to merge this PR after my nitpick is addressed

@zxybazh zxybazh force-pushed the tensorir-infra/upstream/2021-10-26/replay-func-implement branch from 9b0efaf to 7b22b2e Compare November 4, 2021 18:48
@zxybazh zxybazh merged commit 8f58137 into tlc-pack:meta-schedule-refactor Nov 4, 2021
@junrushao
Copy link
Member

@zxybazh would you also send this PR to apache mainline? Thanks a lot!

@zxybazh
Copy link
Collaborator Author

zxybazh commented Nov 5, 2021 via email

junrushao pushed a commit that referenced this pull request Nov 5, 2021
…PyClass (#496)

* Add replay func.

* Simplify unittest.

* Fix the infinite loop for not implemented methods in PyClass.

* Fix funcname.

* Restore the test.

* Fix all the PyClaes with optional function override.

* Fix __str__ and __len__.

* Move NotImplementedError to declaration.

* Add docs.

* Rebase.
junrushao added a commit that referenced this pull request Nov 5, 2021
* Add schedule rule c++ side.

* Add postproc c++ side.

* Add mutator c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Fix printer and add test for schedule rule.

* Add test for mutator.

* Finish postproc tests.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add to tune context.

* Fix nits & test bug.

[Meta Schedule][M3c] PostOrderApply (#486)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Add python-side PostOrderApply with test.

* Fix test.

* Fix warning.

* Fix TaskScheduler Init Rules.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Move numerate order.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Fix Pretuning location in TaskScheduler.

* Fix and refactor.

* Fix test.

* Fix unit test.

Fix Post Order Apply (#490)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Fix post order.

* Fix blocks.

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Add trace  correctness test for post order apply.

Fix replay trace. (#493)

* Fix replay trace.

* Fix deep copy.

* Fix init & add docs.

* Add back function.

* Nit.

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

* Add replay func.

* Modify pretuning.

* Modify docs.

* Minor nit.

* Enhance unittest.

* Nit.

* Fix replay func.

* Simplify unittest.

* Fix PyClass reflection.

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

* [PR] Test script for meta-schedule task extraction. Interface to load workloads from Torch zoo is also added.

* Replace relay_workload to torch_workload. Add 50+ models.

[Meta Schedule Refactor] Get child blocks (#500)

* get child blocks

* clang format

* black

* test

* test

* test

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

* Add MeasureCallbacks.

* ove measure callback to task scheduler level.

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

* Add replay func.

* Simplify unittest.

* Fix the infinite loop for not implemented methods in PyClass.

* Fix funcname.

* Restore the test.

* Fix all the PyClaes with optional function override.

* Fix __str__ and __len__.

* Move NotImplementedError to declaration.

* Add docs.

* Rebase.

[MetaSchedule] Sample-Perfect-Tile (#501)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Nov 5, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add mutator c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Fix printer and add test for schedule rule.

* Add test for mutator.

* Finish postproc tests.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add to tune context.

* Fix nits & test bug.

[Meta Schedule][M3c] PostOrderApply (#486)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Add python-side PostOrderApply with test.

* Fix test.

* Fix warning.

* Fix TaskScheduler Init Rules.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Move numerate order.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Fix Pretuning location in TaskScheduler.

* Fix and refactor.

* Fix test.

* Fix unit test.

Fix Post Order Apply (#490)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Fix post order.

* Fix blocks.

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

* Add schedule rule c++ side.

* Add postproc c++ side.

* Add schedule rule python side.

* Add mutator python side.

* Add Postproc python side.

* Put src to different files in python.

* Try to fix bprint.

* Get str function work.

* Add PostOrderApply c++ side.

* Remove IRModule from SpaceGenerator's generate function signature.

* Refactor PostOrderApply.

* Fix PostOrderApply Design.

* Change StmtSRef to BlockRV.

* Add IRModule back to SpaceGenerator.

* Add trace  correctness test for post order apply.

Fix replay trace. (#493)

* Fix replay trace.

* Fix deep copy.

* Fix init & add docs.

* Add back function.

* Nit.

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

* Add replay func.

* Modify pretuning.

* Modify docs.

* Minor nit.

* Enhance unittest.

* Nit.

* Fix replay func.

* Simplify unittest.

* Fix PyClass reflection.

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

* [PR] Test script for meta-schedule task extraction. Interface to load workloads from Torch zoo is also added.

* Replace relay_workload to torch_workload. Add 50+ models.

[Meta Schedule Refactor] Get child blocks (#500)

* get child blocks

* clang format

* black

* test

* test

* test

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

* Add MeasureCallbacks.

* ove measure callback to task scheduler level.

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

* Add replay func.

* Simplify unittest.

* Fix the infinite loop for not implemented methods in PyClass.

* Fix funcname.

* Restore the test.

* Fix all the PyClaes with optional function override.

* Fix __str__ and __len__.

* Move NotImplementedError to declaration.

* Add docs.

* Rebase.

[MetaSchedule] Sample-Perfect-Tile (#501)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Nov 5, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Nov 5, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Dec 1, 2021
* Squashed commit

[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

* annotate

* annotate

* lint

* test

* fix

* fix

* fix

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

Fix sttr func & schedule naming.

Fix schedule -> sch.

Add feature extractor.

Fix init.

Add cost model.

Remove unused include.

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

* wip

fix

* revoke change to gallery

* split postprocessors to separate files

* rename attrs

* minor

* minor tweak on utils.h

* refactor disallow-dynamic-loop

* refactor verify_gpu_code

* succesfully give up refactoring parallelize-vectorize-unroll

* python structuring

* unittests

Co-authored-by: Junru Shao <junrushao1994@gmail.com>

Fix issues.

Fix init.

Finish random model part.

Finish xgb model.

Minor fix.

Rebase.

Add init.

Await refactor of callback.

Update a bit on the test case.

Move impos.

Minor fix.

More fixes.

Remove unused import.

Fix per store feature test.

Update model save / load.

* Fix model save / load with tar.

* Fix issues.

* Remove dup.

Co-authored-by: Junru Shao <junrushao1994@gmail.com>
junrushao added a commit that referenced this pull request Dec 7, 2021
* Checkpoint.

Fix cost model comment.

Finish evolutionary seaarch.

Remove  extra code.

Fix compile.

Add comments.

Add python part.

Ad test.

Update other files & comments.

* Squashed commit

[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

* [TensorIR] GetProducer, GetConsumer (#506)

* [MetaScheduleRefactor] Annotate&Unannotate (#505)

* annotate

* annotate

* lint

* test

* fix

* fix

* fix

* [MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

* Blockize & Tensorize (#514)

* Blockize & Tensorize

* Update tensor intrin

* Fix blockized & Recalculate affine flags

* Cleanup utils.cc

* Add test cases of blockize

* Re-enable affine flag checking

* Checkpoint.

Fix cost model comment.

Finish evolutionary seaarch.

Remove  extra code.

Fix compile.

Add comments.

Add python part.

Ad test.

Update other files & comments.

Fix random seed bug.

Minor fix.

Fix num-cores.

Add docs.

Check point.

Add max_fail_cnt.

Minor fix.

Minor fix.

Segfault.

Fix pointers to trace.

Test fix.

Remove measure callbacks.

Refactor a bit.

Split function.

Adjust variable name.

Minor fixes.

Add mutator probs to TuneContext.

Add token.

Fix loops.

Remove include.

Add has workload for database.

Add check.

Add concurrent bitmask.

* Fix TuneContext.

* Fix haash & stuff.

* Modifyy shash.

* Remove trace field.

* Minor fix.

* Fix cbmask.

* Fix numbers.

Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Dec 7, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

[MetaSchedule] Multi-Level-Tiling & Auto-Inline (#503)

[Tests] Add unittests for auto-inline and multi-level-tiling (#508)

[Meta Schedule] Minor Fixes (#507)

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

[Meta Schedule] Add Helper Function & Minor Modification (#512)

[MetaSchedule] Test for Rewrite Parallel-Vectorize-Unroll  (#513)

[Meta Schedule] Feature Extractor & Cost Model (#510)

Blockize & Tensorize (#514)

Layout Rewriting: Suggest-Index-Map (#520)

[MetaSchedule] Parallel-Vectorize-Unroll & Random-Compute-Location (#516)

[Meta Schedule] Per-Store-Feature (#521)

Add traced schedule for blockize & tensorize (#526)

[Meta Schedule] Add XGBoost Model & Random Model (#519)

User-Interface: Tune-TIR (#525)

User-Interface: Tune-TE (#527)

[Minor] More logging on python (#528)

Get CUDA tuning working (#529)

[MetaSchedule] TensorRT BYOC (#518)

[BugFix] LocalBuilder API (#531)

[Meta Schedule] Add Cost Model Update Measure Callback (#530)

[Bugfix] BuilderInput with default params (#532)

[MetaSchedule] Mutator-Tile-Size, Mutate-Parallel, Mutate-Unroll (#534)

[Meta Schedule] Evolutionary Search (#522)

[BugFix] Remove duplicated definition of MakeMultinomialSampler (#535)

[Meta Schedule] Fix some bugs (#537)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Dec 7, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

[MetaSchedule] Multi-Level-Tiling & Auto-Inline (#503)

[Tests] Add unittests for auto-inline and multi-level-tiling (#508)

[Meta Schedule] Minor Fixes (#507)

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

[Meta Schedule] Add Helper Function & Minor Modification (#512)

[MetaSchedule] Test for Rewrite Parallel-Vectorize-Unroll  (#513)

[Meta Schedule] Feature Extractor & Cost Model (#510)

Blockize & Tensorize (#514)

Layout Rewriting: Suggest-Index-Map (#520)

[MetaSchedule] Parallel-Vectorize-Unroll & Random-Compute-Location (#516)

[Meta Schedule] Per-Store-Feature (#521)

Add traced schedule for blockize & tensorize (#526)

[Meta Schedule] Add XGBoost Model & Random Model (#519)

User-Interface: Tune-TIR (#525)

User-Interface: Tune-TE (#527)

[Minor] More logging on python (#528)

Get CUDA tuning working (#529)

[MetaSchedule] TensorRT BYOC (#518)

[BugFix] LocalBuilder API (#531)

[Meta Schedule] Add Cost Model Update Measure Callback (#530)

[Bugfix] BuilderInput with default params (#532)

[MetaSchedule] Mutator-Tile-Size, Mutate-Parallel, Mutate-Unroll (#534)

[Meta Schedule] Evolutionary Search (#522)

[BugFix] Remove duplicated definition of MakeMultinomialSampler (#535)

[Meta Schedule] Fix some bugs (#537)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
junrushao added a commit that referenced this pull request Dec 7, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

[MetaSchedule] Multi-Level-Tiling & Auto-Inline (#503)

[Tests] Add unittests for auto-inline and multi-level-tiling (#508)

[Meta Schedule] Minor Fixes (#507)

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

[Meta Schedule] Add Helper Function & Minor Modification (#512)

[MetaSchedule] Test for Rewrite Parallel-Vectorize-Unroll  (#513)

[Meta Schedule] Feature Extractor & Cost Model (#510)

Blockize & Tensorize (#514)

Layout Rewriting: Suggest-Index-Map (#520)

[MetaSchedule] Parallel-Vectorize-Unroll & Random-Compute-Location (#516)

[Meta Schedule] Per-Store-Feature (#521)

Add traced schedule for blockize & tensorize (#526)

[Meta Schedule] Add XGBoost Model & Random Model (#519)

User-Interface: Tune-TIR (#525)

User-Interface: Tune-TE (#527)

[Minor] More logging on python (#528)

Get CUDA tuning working (#529)

[MetaSchedule] TensorRT BYOC (#518)

[BugFix] LocalBuilder API (#531)

[Meta Schedule] Add Cost Model Update Measure Callback (#530)

[Bugfix] BuilderInput with default params (#532)

[MetaSchedule] Mutator-Tile-Size, Mutate-Parallel, Mutate-Unroll (#534)

[Meta Schedule] Evolutionary Search (#522)

[BugFix] Remove duplicated definition of MakeMultinomialSampler (#535)

[Meta Schedule] Fix some bugs (#537)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
Co-authored-by: Xiyou Zhou <xiyou@octoml.ai>
zxybazh added a commit that referenced this pull request Dec 10, 2021
* Squashed commit

[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

[MetaSchedule] Multi-Level-Tiling & Auto-Inline (#503)

[Tests] Add unittests for auto-inline and multi-level-tiling (#508)

[Meta Schedule] Minor Fixes (#507)

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

[Meta Schedule] Add Helper Function & Minor Modification (#512)

[MetaSchedule] Test for Rewrite Parallel-Vectorize-Unroll  (#513)

[Meta Schedule] Feature Extractor & Cost Model (#510)

Blockize & Tensorize (#514)

Layout Rewriting: Suggest-Index-Map (#520)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

* [MetaSchedule] Parallel-Vectorize-Unroll & Random-Compute-Location (#516)

* parallel vectorize unroll & random compute location

* rebased

* [Meta Schedule] Per-Store-Feature (#521)

* [Meta Schedule] Add XGBoost Model & Random Model (#519)

* Squashed commit

[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

* annotate

* annotate

* lint

* test

* fix

* fix

* fix

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

Fix sttr func & schedule naming.

Fix schedule -> sch.

Add feature extractor.

Fix init.

Add cost model.

Remove unused include.

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

* wip

fix

* revoke change to gallery

* split postprocessors to separate files

* rename attrs

* minor

* minor tweak on utils.h

* refactor disallow-dynamic-loop

* refactor verify_gpu_code

* succesfully give up refactoring parallelize-vectorize-unroll

* python structuring

* unittests

Co-authored-by: Junru Shao <junrushao1994@gmail.com>

Fix issues.

Fix init.

Finish random model part.

Finish xgb model.

Minor fix.

Rebase.

Add init.

Await refactor of callback.

Update a bit on the test case.

Move impos.

Minor fix.

More fixes.

Remove unused import.

Fix per store feature test.

Update model save / load.

* Fix model save / load with tar.

* Fix issues.

* Remove dup.

Co-authored-by: Junru Shao <junrushao1994@gmail.com>

* User-Interface: Tune-TIR (#525)

* User-Interface: Tune-TIR

* fix fix fix

* User-Interface: Tune-TE (#527)

* fix a lot of issues

* Add tune-te

* Get CUDA tuning working (#529)

* [Meta Schedule] Evolutionary Search (#522)

* Checkpoint.

Fix cost model comment.

Finish evolutionary seaarch.

Remove  extra code.

Fix compile.

Add comments.

Add python part.

Ad test.

Update other files & comments.

* Squashed commit

[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

* [TensorIR] GetProducer, GetConsumer (#506)

* [MetaScheduleRefactor] Annotate&Unannotate (#505)

* annotate

* annotate

* lint

* test

* fix

* fix

* fix

* [MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

* Blockize & Tensorize (#514)

* Blockize & Tensorize

* Update tensor intrin

* Fix blockized & Recalculate affine flags

* Cleanup utils.cc

* Add test cases of blockize

* Re-enable affine flag checking

* Checkpoint.

Fix cost model comment.

Finish evolutionary seaarch.

Remove  extra code.

Fix compile.

Add comments.

Add python part.

Ad test.

Update other files & comments.

Fix random seed bug.

Minor fix.

Fix num-cores.

Add docs.

Check point.

Add max_fail_cnt.

Minor fix.

Minor fix.

Segfault.

Fix pointers to trace.

Test fix.

Remove measure callbacks.

Refactor a bit.

Split function.

Adjust variable name.

Minor fixes.

Add mutator probs to TuneContext.

Add token.

Fix loops.

Remove include.

Add has workload for database.

Add check.

Add concurrent bitmask.

* Fix TuneContext.

* Fix haash & stuff.

* Modifyy shash.

* Remove trace field.

* Minor fix.

* Fix cbmask.

* Fix numbers.

Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>

* [BugFix] Remove duplicated definition of MakeMultinomialSampler (#535)

* Tune relay.

* [FIX] Simplify during create prim func (#9691)

* Further add interface.

* Remove unused import

* Fix rebase.

* Renmove unused module.

Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
spectrometerHBH added a commit that referenced this pull request Dec 30, 2021
[Meta Schedule][M3c] Schedule Rules, Mutator & Postprocs (#485)

[Meta Schedule][M3c] PostOrderApply (#486)

Fix Post Order Apply (#490)

[MetaSchedule] Relay Integration (#489)

[M3c][Meta Schedule] Add Trace Correctness Test for PostOrderApply (#492)

Fix replay trace. (#493)

[M3c][Meta Schedule] Implement the Replay Func class. (#495)

[PR] Test script for meta-schedule task extraction. Interface to load… (#494)

[Meta Schedule Refactor] Get child blocks (#500)

Read-at && Write-at (#497)

[M3c][Meta Schedule] Measure Callbacks (#498)

[Bug] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass (#496)

[MetaSchedule] Sample-Perfect-Tile (#501)

[MetaSchedule] TE Workloads (#502)

[TensorIR] GetProducer, GetConsumer (#506)

[MetaScheduleRefactor] Annotate&Unannotate (#505)

[MetaSchedule] Multi-Level-Tiling & Auto-Inline (#503)

[Tests] Add unittests for auto-inline and multi-level-tiling (#508)

[Meta Schedule] Minor Fixes (#507)

[MetaSchedule] Rewrite Cooperative-Fetching / Unbound-Block / Reduction-Block (#509)

[MetaSchedule] Rewrite Parallel-Vectorize-Unroll / Verify-GPU / Disallow-Dynamic-Loops (#499)

[Meta Schedule] Add Helper Function & Minor Modification (#512)

[MetaSchedule] Test for Rewrite Parallel-Vectorize-Unroll  (#513)

[Meta Schedule] Feature Extractor & Cost Model (#510)

Blockize & Tensorize (#514)

Layout Rewriting: Suggest-Index-Map (#520)

[MetaSchedule] Parallel-Vectorize-Unroll & Random-Compute-Location (#516)

[Meta Schedule] Per-Store-Feature (#521)

Add traced schedule for blockize & tensorize (#526)

[Meta Schedule] Add XGBoost Model & Random Model (#519)

User-Interface: Tune-TIR (#525)

User-Interface: Tune-TE (#527)

[Minor] More logging on python (#528)

Get CUDA tuning working (#529)

[MetaSchedule] TensorRT BYOC (#518)

[BugFix] LocalBuilder API (#531)

[Meta Schedule] Add Cost Model Update Measure Callback (#530)

[Bugfix] BuilderInput with default params (#532)

[MetaSchedule] Mutator-Tile-Size, Mutate-Parallel, Mutate-Unroll (#534)

[Meta Schedule] Evolutionary Search (#522)

[BugFix] Remove duplicated definition of MakeMultinomialSampler (#535)

[Meta Schedule] Fix some bugs (#537)

Initiate Experiments for CPU Performance Alignment with Ansor (#538)

[Meta Schedule] Tweak experiment scripts (#539)

[Meta Schedule] Initiate experiments on CUDA (#540)

[TIR][Schedule] Buffer transform (#523)

Auto Tensor Core (#524)

Working on Evo Search (#542)

[Meta Schedule] Add Replay Tuning Interface (#543)

Evolutionary Search on CPU (#544)

Misc improvement over the error message (#545)

[TIR][Schedule] Software pipelining (#533)

[Meta Schedule Refactor] fixing unit tests (#547)

[MetaSchedule] Mutator-Compute-Location (#548)

Misc Improvement of Evolutionary Search (#549)

Hotfix for software pipeline (#552)

Misc Improvement (#550)

[Cherry-Pick][TensorIR] Primitive "SetScope" (#9738) (#555)

Rule RFactor (#551)

[MemHammer] Rewrite Rules (#554)

[MetaSchedule] Schedule Rule: Cross-Thread Reduction (#556)

[MetaSchedule] Performance Alignment - NRM and SFM (CUDA) (#559)

[MetaSchedule] Perf Alignment - NRM on CUDA (#560)

[TIR] Reorder the block iters of the blocks generated by RFactor (#561)
Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
Co-authored-by: Sunghyun Park <49998730+sunggg@users.noreply.github.com>
Co-authored-by: Xiyou Zhou <xiyou@octoml.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants