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][Meta Schedule] Fix Infinite Loop Caused When Calling Methods Not Overridden In PyClass. #9451

Conversation

zxybazh
Copy link
Member

@zxybazh zxybazh commented Nov 5, 2021

This patch fixes the infinite loop when you call a PyClass's undefined method. Now that we defined a new helper function decorator check_override and it would make sure a not implemented error would be thrown if the method has no default implementation. And it could still leverage default implementation for methods on the c++ side as shown in test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_override_next_task_id_only test case.

To summarize:

  1. It fixed a infinite loop bug.
  2. It enables PyClasses to define only methods required to implement.
  3. It throws NotImplementError early when a class with any required function is missing.
  4. It fixes the constructor of task scheduler and enhances its unittests.

@zxybazh zxybazh changed the title [BugFix] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass. [Bug][Meta Schedule] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass. Nov 5, 2021
Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this really interesting bug! LGTM

@junrushao junrushao merged commit 048994b into apache:main Nov 5, 2021
@junrushao
Copy link
Member

Oh my spell checker just reminded by that we should "overridden" is the correct word 🤦‍♂️

@zxybazh zxybazh mentioned this pull request Nov 5, 2021
@zxybazh zxybazh changed the title [Bug][Meta Schedule] Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass. [Bug][Meta Schedule] Fix Infinite Loop Caused When Calling Methods Not Overridden In PyClass. Nov 5, 2021
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
…t Overrided In PyClass. (apache#9451)

* Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass.

* Add new line.

* Lint.
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Dec 1, 2021
…t Overrided In PyClass. (apache#9451)

* Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass.

* Add new line.

* Lint.
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
…t Overrided In PyClass. (apache#9451)

* Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass.

* Add new line.

* Lint.
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…t Overrided In PyClass. (apache#9451)

* Fix Infinite Loop Caused When Calling Methods Not Overrided In PyClass.

* Add new line.

* Lint.
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