Skip to content

[Ansor] Add HW param for Vulkan tuning#7626

Merged
tmoreau89 merged 3 commits into
apache:mainfrom
masahi:ansor-vk
Mar 11, 2021
Merged

[Ansor] Add HW param for Vulkan tuning#7626
tmoreau89 merged 3 commits into
apache:mainfrom
masahi:ansor-vk

Conversation

@masahi

@masahi masahi commented Mar 10, 2021

Copy link
Copy Markdown
Member

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

Comment thread src/auto_scheduler/search_task.cc Outdated
device_api->GetAttr(ctx, tvm::runtime::DeviceAttrKind::kWarpSize, &ret);
int warp_size = ret;

int max_vthread_extent = warp_size / 4;

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tmoreau89 tmoreau89 left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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