Skip to content

Conversation

@valmat07
Copy link
Contributor

@valmat07 valmat07 commented Dec 6, 2022

This PR introduces the use of convolution weights on buffers rather than textures.

  • For now, the weights on the buffers are used only in the fp32 case since that case is investigated
  • Also, the case of 1x1 convolutions is excluded from this approach, since the weights on the buffers work worse in this case
  • This approach gives about 10% performance boost for popular models, such as: vgg-16, yolov3, etc

@tvm-bot
Copy link
Collaborator

tvm-bot commented Dec 6, 2022

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

In general LGTM. Several minor comments

std::string scope = Scope(ttype->shape, GetVirtualDevice(GetRef<Expr>(call)));
if (expr_attrib.as<Conv2DAttrs>() || expr_attrib.as<Conv2DWinogradAttrs>())
{
if ((i == 1) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Create local variable, e.g.: const int weights_pos = 1;.


for (auto& arg : call->args) {
Visit(arg);
if (std::find(buffers_args.begin(), buffers_args.end(), arg) == buffers_args.end())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Probably we can change type of buffers_args to unordered_set? In this case, the search should be faster.

The same comment for buffers_params.

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@echuraev echuraev merged commit 6069292 into apache:main Dec 8, 2022
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
* introduced support for weights on buffers

* update winograd schedule for support buffers on weights

* Updated the logic of using buffers

* Update texture annotation pass

* now weights on buffers support only in fp32 case

* update opencl tests for weights on buffers

* fix lint

* fix lint

* fix lint

* apply comments

* fix lint

* fix lint
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
* introduced support for weights on buffers

* update winograd schedule for support buffers on weights

* Updated the logic of using buffers

* Update texture annotation pass

* now weights on buffers support only in fp32 case

* update opencl tests for weights on buffers

* fix lint

* fix lint

* fix lint

* apply comments

* fix lint

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

3 participants