-
Notifications
You must be signed in to change notification settings - Fork 847
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
Add Q16x8 Depthwise Conv Support #2140
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one minor comment clarification and will approve.
@@ -48,6 +48,16 @@ void* Init(TfLiteContext* context, const char* buffer, size_t length) { | |||
|
|||
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { | |||
TF_LITE_ENSURE_OK(context, DepthwiseConvPrepare(context, node)); | |||
// Use only the default depthwise convolution for int16 input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
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