[microNPU] Mean legalization support#9576
Merged
Merged
Conversation
15 tasks
ekalda
reviewed
Nov 26, 2021
lhutton1
commented
Nov 29, 2021
10a2b2f to
47daacc
Compare
5fa39af to
66ccdc1
Compare
manupak
requested changes
Dec 1, 2021
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Change-Id: Iefbed5d9dc6da4e349127ea70fd1bf56b90ef4a3
Change-Id: I3c82f9b492a58082c98c200d42d5413451740504
Change-Id: Idcab5f71f3c5a971831b96fe8f9a5c8c73b267da
66ccdc1 to
18ee95b
Compare
manupak
approved these changes
Dec 2, 2021
manupak
left a comment
Contributor
There was a problem hiding this comment.
LGTM.
Few nits -- nothing to block this from going in. I ll trust you could do address them (ones you agree) in a follow up ?
| ) | ||
|
|
||
| n = int(filter_height * filter_width) | ||
| eps = 1 / (256 * (n + 1)) if n % 2 == 0 else 0 |
Contributor
There was a problem hiding this comment.
It might be worth using variables for numbers to say what they mean.
| if (operator_type == "ADD" || operator_type == "SUB" || operator_type == "MUL") { | ||
| if (ifm_dtype != DataType::UInt(8) && ifm_dtype != DataType::Int(8) && | ||
| ifm_dtype != DataType::Int(32)) { | ||
| ifm_dtype != DataType::Int(16) && ifm_dtype != DataType::Int(32)) { |
Contributor
There was a problem hiding this comment.
nit : It might be worth putting these into a disallowed list and check the presense in the list ?
|
|
||
| DataType ofm_dtype; | ||
|
|
||
| if (param->ofm_dtype == "int8") { |
Contributor
There was a problem hiding this comment.
It might be clearer if we use a dictionary here
| return false; | ||
| } | ||
|
|
||
| if (ofm_dtype != DataType::UInt(8) && ofm_dtype != DataType::Int(8) && |
Contributor
There was a problem hiding this comment.
nit : again a disallowed list might helps things to be more clearer
Contributor
lhutton1
commented
Dec 2, 2021
lhutton1
left a comment
Contributor
Author
There was a problem hiding this comment.
Thanks @manupa-arm, I'll address these in a follow up
| ) | ||
|
|
||
| n = int(filter_height * filter_width) | ||
| eps = 1 / (256 * (n + 1)) if n % 2 == 0 else 0 |
| if (operator_type == "ADD" || operator_type == "SUB" || operator_type == "MUL") { | ||
| if (ifm_dtype != DataType::UInt(8) && ifm_dtype != DataType::Int(8) && | ||
| ifm_dtype != DataType::Int(32)) { | ||
| ifm_dtype != DataType::Int(16) && ifm_dtype != DataType::Int(32)) { |
|
|
||
| DataType ofm_dtype; | ||
|
|
||
| if (param->ofm_dtype == "int8") { |
| return false; | ||
| } | ||
|
|
||
| if (ofm_dtype != DataType::UInt(8) && ofm_dtype != DataType::Int(8) && |
lhutton1
added a commit
to lhutton1/tvm
that referenced
this pull request
Dec 2, 2021
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
manupak
pushed a commit
that referenced
this pull request
Dec 2, 2021
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 7, 2022
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 7, 2022
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
yangulei
pushed a commit
to yangulei/tvm
that referenced
this pull request
Jan 11, 2022
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
yangulei
pushed a commit
to yangulei/tvm
that referenced
this pull request
Jan 11, 2022
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
yangulei
pushed a commit
to yangulei/tvm
that referenced
this pull request
Jan 12, 2022
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
yangulei
pushed a commit
to yangulei/tvm
that referenced
this pull request
Jan 12, 2022
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Jan 13, 2022
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
lhutton1
added a commit
to lhutton1/tvm
that referenced
this pull request
Jan 25, 2022
Aims to improve readability, extendibility and error message unification for data type checks across NPU operators. A follow up for the comments in apache#9576. Change-Id: I83fb89a56677003f7abebb7985ad60d92cfa8df1
lhutton1
added a commit
to lhutton1/tvm
that referenced
this pull request
Jan 26, 2022
Aims to improve readability, extendibility and error message unification for data type checks across NPU operators. A follow up for the comments in apache#9576. Change-Id: I83fb89a56677003f7abebb7985ad60d92cfa8df1
lhutton1
added a commit
to lhutton1/tvm
that referenced
this pull request
Feb 7, 2022
Aims to improve readability, extendibility and error message unification for data type checks across NPU operators. A follow up for the comments in apache#9576. Change-Id: I83fb89a56677003f7abebb7985ad60d92cfa8df1
manupak
pushed a commit
that referenced
this pull request
Feb 9, 2022
* [microNPU] Refactor type inference data type checks Aims to improve readability, extendibility and error message unification for data type checks across NPU operators. A follow up for the comments in #9576. Change-Id: I83fb89a56677003f7abebb7985ad60d92cfa8df1 * unordered_set -> initializer_list and use new format for upscale check Change-Id: Icf3d68d5cc7d5e1d5af42b1af193db89faea155e * remove unused header and use auto for initializer type Change-Id: I10311b718c3abd0ed75dd88b5ec9de6e0742f047
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Feb 16, 2022
* [microNPU] Refactor type inference data type checks Aims to improve readability, extendibility and error message unification for data type checks across NPU operators. A follow up for the comments in apache#9576. Change-Id: I83fb89a56677003f7abebb7985ad60d92cfa8df1 * unordered_set -> initializer_list and use new format for upscale check Change-Id: Icf3d68d5cc7d5e1d5af42b1af193db89faea155e * remove unused header and use auto for initializer type Change-Id: I10311b718c3abd0ed75dd88b5ec9de6e0742f047
qsqqsqqsq-intellif
pushed a commit
to qsqqsqqsq-intellif/tvm
that referenced
this pull request
Apr 29, 2022
Supports legalizing a Relay mean operation to an equivalent series of
NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
qsqqsqqsq-intellif
pushed a commit
to qsqqsqqsq-intellif/tvm
that referenced
this pull request
Apr 29, 2022
Fixes failing CI since CI on apache#9576 passed before apache#9624 was merged. Change-Id: I44f6aa0abe09d206f3e948e36e9799eaa12b3d14
This file contains hidden or 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
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.
Supports legalizing a Relay mean operation to an equivalent series of NPU operations. Mean can be legalized given one of three cases:
- Case 1 (axis == [1, 2] and keepsdims == True):
depthwise_conv2d + binary_elementwise
- Case 2 (ifm qparams == ofm qparams):
pooling
- Case 3 (else):
depthwise_conv2d
cc @ekalda @NicolaLancellotti @dchauhan-arm @manupa-arm @mbaret @jainris
Co-authored-by: Rishabh Jain rishabh.jain2@arm.com