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

[MetaSchedule] Extract task weights during task extraction #10810

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

junrushao
Copy link
Member

Task weight is defined as the number of occurrence of a specific task that appears in a Relay function. During task extraction, we use structural equality check to determine the weights.

Also, I noted the numbering of each task could differ between task extraction and scheduled task injection, and I attribute it to different visiting order - I'm not 100% sure but it seems to work. @masahi let's revisit it later after your vacation.

CC: @zxybazh @comaniac

Copy link
Member

@zxybazh zxybazh left a comment

Choose a reason for hiding this comment

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

LGTM, this is import change to #10366, I'll update the PR accordingly.

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

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

LGTM

tests/python/unittest/test_meta_schedule_integration.py Outdated Show resolved Hide resolved
@masahi
Copy link
Member

masahi commented Mar 29, 2022

Also, I noted the numbering of each task could differ between task extraction and scheduled task injection, and I attribute it to different visiting order

Yeah, I was aware of this issue. I didn't do anything at that time since I was not sure if the order of numbering matters at all, as long as they are unique. Even with this change, I don't know if we can guarantee that the order obtained by PostOrderVisit -> std::reverse is guaranteed to be the same as the one used by TE compiler.

Copy link
Member

@masahi masahi left a comment

Choose a reason for hiding this comment

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

I really like the simplicity of this change, compared to how weights are extracted in the auto scheduler... (te_compiler_update_weights thing)

@junrushao
Copy link
Member Author

Yeah, I was aware of this issue. I didn't do anything at that time since I was not sure if the order of numbering matters at all, as long as they are unique. Even with this change, I don't know if we can guarantee that the order obtained by PostOrderVisit -> std::reverse is guaranteed to be the same as the one used by TE compiler.

@masahi Yep exactly, that's my doubt too! For now it is not a problem in terms of correctness, because the names themselves are fine as long as they are unique. The only occasion that I spotted this issue is when doing per-layer performance comparison with Ansor, and the names of each layer becomes a bit...different :-)

I really like the simplicity of this change, compared to how weights are extracted in the auto scheduler... (te_compiler_update_weights thing)

That's completely based on your work! Literally standing on the shoulder of your super cool refactoring!

@masahi masahi merged commit c2488ac into apache:main Mar 29, 2022
junrushao added a commit to junrushao/tvm that referenced this pull request Mar 29, 2022
)

* [MetaSchedule] Extract task weights on task extraction

* Update test_meta_schedule_integration.py
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
)

* [MetaSchedule] Extract task weights on task extraction

* Update test_meta_schedule_integration.py
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.

4 participants