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

[Ansor] Add HW param for Vulkan tuning #7626

Merged
merged 3 commits into from
Mar 11, 2021
Merged

Conversation

masahi
Copy link
Member

@masahi masahi commented Mar 10, 2021

This introduces support for VK backend in ansor. Also added a proper way to query the warp size using VK api, since it can be different for each platform (AMD uses 64 while others 32 etc).

please review @comaniac @FrozenGene @merrymercy @tmoreau89

device_api->GetAttr(ctx, tvm::runtime::DeviceAttrKind::kWarpSize, &ret);
int warp_size = ret;

int max_vthread_extent = warp_size / 4;
Copy link
Member

Choose a reason for hiding this comment

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

Does warp_size have the possibility to be 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

A good catch, indeed the spec only requires warp size to be greater than or equal to 1. In practice it is always greater than 1, but I'll update this to int max_vthread_extent = std::max(1, warp_size / 4).

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@masahi masahi marked this pull request as ready for review March 10, 2021 07:58
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

Copy link
Contributor

@tmoreau89 tmoreau89 left a comment

Choose a reason for hiding this comment

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

Thanks @masahi LGTM!

@tmoreau89 tmoreau89 merged commit b2a3c48 into apache:main Mar 11, 2021
@tmoreau89
Copy link
Contributor

I have reproduced it on a AMD GPU machine and it is reporting the warp/wave size (64) correctly - thanks!

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* add HW param for VK

* query warp size properly

* guard against warp_size < 4 case

Co-authored-by: Masahiro Masuda <masahi@129@gmail.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* add HW param for VK

* query warp size properly

* guard against warp_size < 4 case

Co-authored-by: Masahiro Masuda <masahi@129@gmail.com>
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