Skip to content

[CUDA][PASS]Legalize tensorcore - #7147

Merged
Laurawly merged 17 commits into
apache:mainfrom
Meteorix:legalize_tensorcore
Jan 29, 2021
Merged

[CUDA][PASS]Legalize tensorcore#7147
Laurawly merged 17 commits into
apache:mainfrom
Meteorix:legalize_tensorcore

Conversation

@Meteorix

Copy link
Copy Markdown
Contributor

Add legalize pass: padding dense/conv2d/batch_matmul ops to legal shapes for using tensorcore on cuda target. To limit the overhead introduced by padding, we count the extra_flops and set the threshold to 2x, which is conservative compared to the speedup of tensorcore.

This pr is dependent on #7146 .

@jcf94@merrymercy could you also help review this pr?

Comment threadpython/tvm/topi/nn/batch_matmul.py Outdated
jwfromm
jwfromm previously requested changes Dec 23, 2020

@jwfrommjwfromm 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 for your contribution! I like the idea of padding to make other shapes work on tensorcore, but I think its important that you add some tests to confirm this features works as expected before we consider merging.

Comment threadpython/tvm/topi/cuda/conv2d_alter_op.py Outdated
Conflicts:
python/tvm/topi/nn/batch_matmul.py
python/tvm/topi/nn/dense.py
@Meteorix

Copy link
Copy Markdown
ContributorAuthor

@jwfromm@jcf94 I've added some tests. Could you help review this PR again?

And the cpu ci failed, I am not sure how to fix it.

Comment threadpython/tvm/topi/cuda/conv2d_alter_op.py Outdated
return entry if isinstance(expr, relay.Function) else entry.body


def test_legalize_conv2d(data_shape, kernel_shape, pad_shape, do_pad=True):

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.

Please reference test_legalize_pass.py for the CI issue.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

thanks

@Meteorix

Copy link
Copy Markdown
ContributorAuthor

@Laurawly Thanks! The ci passed.

@Laurawly

Copy link
Copy Markdown
Contributor

@jwfromm@jcf94 Could you update your reviews?

@jcf94jcf94 left a comment

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.

Thanks! Sorry for my late reply. This looks good to me.

@Laurawly
Laurawly requested a review from jwfrommJanuary 28, 2021 06:38
@Laurawly
Laurawly dismissed jwfromm’s stale reviewJanuary 29, 2021 02:17

Waiting for review updates.

@jwfrommjwfromm 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 for adding the tests, this LGTM now.

@Laurawly

Copy link
Copy Markdown
Contributor

Thank you @Meteorix@jwfromm@jcf94!

@Laurawly
Laurawly merged commit 3734d5f into apache:mainJan 29, 2021
alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 11, 2021
* add pad_to_tensorcore & legalize for dense/bmm/conv2d
* fix pad & slice
* fix comments
* fix comments
* resolve conflict
* resolve conflict
* support only fp16
* add tests/python/relay/test_pass_legalize_tensorcore.py
* add tests for legalize tensorcore
* fix pylint
* fix pylint
* code format
* use_gpu test only; fix conv2d_alter_op
* fix tests params
* revert transform fix
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* add pad_to_tensorcore & legalize for dense/bmm/conv2d
* fix pad & slice
* fix comments
* fix comments
* resolve conflict
* resolve conflict
* support only fp16
* add tests/python/relay/test_pass_legalize_tensorcore.py
* add tests for legalize tensorcore
* fix pylint
* fix pylint
* code format
* use_gpu test only; fix conv2d_alter_op
* fix tests params
* revert transform fix
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
* add pad_to_tensorcore & legalize for dense/bmm/conv2d
* fix pad & slice
* fix comments
* fix comments
* resolve conflict
* resolve conflict
* support only fp16
* add tests/python/relay/test_pass_legalize_tensorcore.py
* add tests for legalize tensorcore
* fix pylint
* fix pylint
* code format
* use_gpu test only; fix conv2d_alter_op
* fix tests params
* revert transform fix
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
* add pad_to_tensorcore & legalize for dense/bmm/conv2d
* fix pad & slice
* fix comments
* fix comments
* resolve conflict
* resolve conflict
* support only fp16
* add tests/python/relay/test_pass_legalize_tensorcore.py
* add tests for legalize tensorcore
* fix pylint
* fix pylint
* code format
* use_gpu test only; fix conv2d_alter_op
* fix tests params
* revert transform fix
Sign up for freeto 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.

5 participants

@Meteorix@Laurawly@jwfromm@jcf94@kongroo