Add Q16x8 Depthwise Conv Support#2140
Merged
mergify[bot] merged 5 commits intotensorflow:mainfrom Aug 1, 2023
Merged
Conversation
Adds support for 16-bit activations + 8-bit weights for depthwise convolution in the reference kernel. Uses 64-bit bias to match TFLite. Tested: depthwise_conv_test
For ARC, CEVA, and Xtensa add in a reference fallback for q16x8 depthwise convolution. This allows these platforms to still run the same models as well as fixes failed tests.
The Xtensa deptwise conv was correct for eval, but the Hifi prepare expects 8-bit IO. Early exit in the prepare to skip the Hifi and P6 prepare (those evals will never be called on q16 data). BUG: 2141
rascani
reviewed
Jul 31, 2023
Contributor
rascani
left a comment
There was a problem hiding this comment.
LGTM, just one minor comment clarification and will approve.
|
|
||
| TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { | ||
| TF_LITE_ENSURE_OK(context, DepthwiseConvPrepare(context, node)); | ||
| // Use only the default depthwise convolution for int16 input. |
Contributor
There was a problem hiding this comment.
Can we expand this comment a bit to explain why we only need to do the default for int16? Specifically, we should mention that we fall back to the reference kernels for int16, so there's no need to call the Xtensa-specific Prepare methods.
Contributor
Author
There was a problem hiding this comment.
Thanks for the review. Updated. I did once again forget the bug on this commit but it should work overall with a squash commit (with the top-level message above).
rascani
approved these changes
Aug 1, 2023
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.
Adds support for 16-bit activations + 8-bit weights for depthwise convolution in the reference kernel. Uses 64-bit bias to match TFLite. Also adds passthrough to the q16x8 reference kernel for Xtensa, CEVA, and ARC (CMSIS already has it's own implementation).
Tested:
depthwise_conv_test
BUG=2141