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

[Autoscheduler] Add sparse conv2d(1*1) support for auto_scheduler #8065

Merged
merged 8 commits into from
May 19, 2021

Conversation

yuchaoli
Copy link
Contributor

This pull request adds sparse conv2d(1*1) support for auto_scheduler. I have implemented sparse conv2d with kernel_size=1, using the BSR sparse data format.

I evaluate the performance of sparse conv2d by mobilenet_v2 in pixel2. All of 1*1 conv2d in the network are transformed into sparse conv2d with block_size=(4, 1).

Sparse Rate 0 % 10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 %
Latency 17.37ms 21.85ms 21.05ms 18.18ms 17.16ms 15.03ms 14.06ms 11.59ms 10.12ms 8.67ms

@jcf94

@jcf94 jcf94 requested a review from merrymercy May 18, 2021 03:23
@jcf94 jcf94 self-assigned this May 18, 2021
tutorials/auto_scheduler/tune_network_x86.py Outdated Show resolved Hide resolved
tutorials/auto_scheduler/tune_network_x86.py Outdated Show resolved Hide resolved
@jcf94
Copy link
Contributor

jcf94 commented May 18, 2021

Also cc @tkonolige

Copy link
Contributor

@jcf94 jcf94 left a comment

Choose a reason for hiding this comment

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

This looks great to me.
Thanks! @yuchaoli

python/tvm/topi/sparse/utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@tkonolige tkonolige left a comment

Choose a reason for hiding this comment

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

I left a couple of comments, but it mostly looks good to me.

python/tvm/relay/analysis/sparse_conv2d.py Outdated Show resolved Hide resolved
python/tvm/topi/nn/sparse.py Outdated Show resolved Hide resolved

bool SparseConv2dRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
const TypeReporter& reporter) {
ICHECK_EQ(types.size(), 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add an error message.

src/relay/op/nn/sparse.cc Outdated Show resolved Hide resolved
src/relay/transforms/convert_sparse_conv2d.cc Outdated Show resolved Hide resolved
@jcf94 jcf94 merged commit 17bbf02 into apache:main May 19, 2021
@jcf94
Copy link
Contributor

jcf94 commented May 19, 2021

Merged. Thanks! @yuchaoli @tkonolige

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 17, 2021
…ache#8065)

* add sparse conv2d support for auto_scheduler

* add description

* fix bug

* fix annotation

* Lint fix

Co-authored-by: laiyin.lyc <laiyin.lyc@alibaba-inc.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 17, 2021
…ache#8065)

* add sparse conv2d support for auto_scheduler

* add description

* fix bug

* fix annotation

* Lint fix

Co-authored-by: laiyin.lyc <laiyin.lyc@alibaba-inc.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.

3 participants