-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Frontend] Unified LSTM cell #8599
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vvchernov
requested review from
anijain2305,
comaniac,
Huyuwei,
jroesch,
junrushao,
jwfromm,
kazum,
MarisaKirisame,
mbrookhart,
siju-samuel,
slyubomirsky,
srkreddy1238,
tqchen,
vinx13,
wweic,
yzhliu,
zhiics and
ZihengJiang
as code owners
July 30, 2021 11:43
vvchernov
force-pushed
the
vc/lstm_perf
branch
2 times, most recently
from
July 30, 2021 13:59
cb9105c
to
8b7c4bc
Compare
vvchernov
changed the title
[Frontend] Unified LSTM cell
WIP: [Frontend] Unified LSTM cell
Jul 30, 2021
vvchernov
changed the title
WIP: [Frontend] Unified LSTM cell
[Frontend] Unified LSTM cell
Jul 30, 2021
…an current one without tuning
…y code was removed
CC @masahi if you are interested |
masahi
reviewed
Aug 3, 2021
masahi
reviewed
Aug 3, 2021
masahi
reviewed
Aug 3, 2021
masahi
reviewed
Aug 3, 2021
cc @mbrookhart |
masahi
reviewed
Aug 4, 2021
masahi
reviewed
Aug 4, 2021
masahi
reviewed
Aug 4, 2021
masahi
reviewed
Aug 4, 2021
masahi
reviewed
Aug 4, 2021
Thanks @vvchernov I only have minor comments left. |
masahi
approved these changes
Aug 4, 2021
thanks @vvchernov |
mehrdadh
pushed a commit
to mehrdadh/tvm
that referenced
this pull request
Aug 11, 2021
* fuse dence sum * remove excess copying * dev LSTM in ONNX * alternative implementation of LSTM in onnx frontend. It is quicker than current one without tuning * LSTM_dev2 was implemented in onnx frontend * LSTM dev in pytorch frontend * LSTM cell implementation was transferred to common place. Unneccessary code was removed * lint fixes * Weights permutation for LSTM layer in onnx frontend * LSTM cell description was added * arguments and values were renamed. descriptions of some methods were added * LSTM output shape and actvations input format were fixed in onnx frontend * empty. tvm-ci test * unbind method was transferred from onnx frontend to common.py * unbind method was transferred from pytorch frontend to common.py * lstm cell was transferred from op/layers.py to frontend/common.py * clean up weight dictionary initialization * fix pytorch frontend wrapper over unbind method * minor fix of comments * empty. tvm-ci test restart * empty. tvm-ci test restart Co-authored-by: Valery Chernov <valery.chernov@deelvin.com>
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Sep 29, 2021
* fuse dence sum * remove excess copying * dev LSTM in ONNX * alternative implementation of LSTM in onnx frontend. It is quicker than current one without tuning * LSTM_dev2 was implemented in onnx frontend * LSTM dev in pytorch frontend * LSTM cell implementation was transferred to common place. Unneccessary code was removed * lint fixes * Weights permutation for LSTM layer in onnx frontend * LSTM cell description was added * arguments and values were renamed. descriptions of some methods were added * LSTM output shape and actvations input format were fixed in onnx frontend * empty. tvm-ci test * unbind method was transferred from onnx frontend to common.py * unbind method was transferred from pytorch frontend to common.py * lstm cell was transferred from op/layers.py to frontend/common.py * clean up weight dictionary initialization * fix pytorch frontend wrapper over unbind method * minor fix of comments * empty. tvm-ci test restart * empty. tvm-ci test restart Co-authored-by: Valery Chernov <valery.chernov@deelvin.com>
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
* fuse dence sum * remove excess copying * dev LSTM in ONNX * alternative implementation of LSTM in onnx frontend. It is quicker than current one without tuning * LSTM_dev2 was implemented in onnx frontend * LSTM dev in pytorch frontend * LSTM cell implementation was transferred to common place. Unneccessary code was removed * lint fixes * Weights permutation for LSTM layer in onnx frontend * LSTM cell description was added * arguments and values were renamed. descriptions of some methods were added * LSTM output shape and actvations input format were fixed in onnx frontend * empty. tvm-ci test * unbind method was transferred from onnx frontend to common.py * unbind method was transferred from pytorch frontend to common.py * lstm cell was transferred from op/layers.py to frontend/common.py * clean up weight dictionary initialization * fix pytorch frontend wrapper over unbind method * minor fix of comments * empty. tvm-ci test restart * empty. tvm-ci test restart Co-authored-by: Valery Chernov <valery.chernov@deelvin.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LSTM cell was unified and transferred to common place for all frontends. Here it is simultaneously used by onnx and pytorch frontends of TVM. LSTM cell was analyzed and modified to remove excess memory and other manipulations which potentially can not be fixed by compiler on its side. Performance tests for different modification of LSTM before and after were carried out. The results are collected in the tables:
Table 1. Average time per run (microsec) for 10000 runs. The following parameters are used (small input size): with biases = True, batch first = True, feature size = 5, hidden size = 10, number of stacked layers = 2, sequence length = 3, batch size = 1, trials number = 100
There are several LSTM types: uni – unidirectional, b – bidirectional, s – stacked (2 layers are used in the tests), sb - stacked bidirectional. Suffix "dev" means implementation in this patch. We had strong difference for performance between implementation on onnx and pytorch without tuning (onnx one is slower). With tuning onnx implementation was slightly worse than pytorch. This patch fixed performance differences for LSTM with tuning and imporved results without tuning for both onnx and pytorch.
Table 2. Average time per run (ms) for 1000 runs. The following parameters are used (big input size): with biases = True, batch first = True, feature size = 40, hidden size = 256, number of stacked layers = 3, sequence length = 160, batch size = 1, trials number = 100
@masahi @jwfromm please review