Skip to content
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

Cadence HiFi4 NN Library v2.2.0 update #40943

Merged

Conversation

pnikam-cad
Copy link
Contributor

The following changes are done to the HiFi4 implementation of TF Lite Micro

  1. Update the xtensa_hifi kernel files and the make setup to use HiFi4 NN Library v2.2.0 .
  2. Update the kernel files as per the latest reference implementation.
  3. Add xtenas_hifi kernel implementations for the add and mul operators.

@google-ml-butler google-ml-butler bot added the size:XL CL Change Size:Extra Large label Jun 30, 2020
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@gbaned gbaned self-assigned this Jun 30, 2020
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Jun 30, 2020
@gbaned gbaned added comp:lite TF Lite related issues comp:micro Related to TensorFlow Lite Microcontrollers labels Jun 30, 2020
@gbaned gbaned removed the request for review from srjoglekar246 June 30, 2020 14:06
@gbaned gbaned added the awaiting review Pull request awaiting review label Jul 6, 2020
njeffrie
njeffrie previously approved these changes Jul 14, 2020
Copy link
Contributor

@njeffrie njeffrie left a comment

Choose a reason for hiding this comment

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

I have a few style nits. Other than that, looks good.

err = xa_nn_vec_activation_min_max_asym8_asym8(
out_data_ptr, inp_data_ptr, 0, 255, flat_size); // Is 255 right?
err = xa_nn_vec_activation_min_max_asym8_asym8(out_data_ptr, inp_data_ptr,
zero, 255, flat_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we use std::numeric_limits<uint8_t>::min() and std::numeric_limits<uint8_t>::max() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as per suggestion.

&output_activation_max);
tflite::ArithmeticParams op_params;
SetActivationParams(output_activation_min, output_activation_max, &op_params);
#define TF_LITE_ADD(opname) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer to avoid defining this and only using once. Please inline it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we need the macro at couple of places, so keeping it. When the vector floating point unit (VFPU) hardware is not available, we need to fall back to the reference implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like I missed some of the uses below. Looks good.

return kTfLiteError;
}

ALLOCATE_XTENSA_NNLIB_SCRATCH_MEM;
p_scratch = xtensa_nnlib_scratch_buf;
p_scratch = (char*)xtensa_nnlib_scratch_buf;
Copy link
Contributor

Choose a reason for hiding this comment

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

please use c++ style static_cast if possible or reinterpret_cast here and elsewhere in this file / change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the code in conv.cc and depthwise_conv.cc to clean up type casts.

PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Jul 14, 2020
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jul 14, 2020
@kokoro-team kokoro-team removed kokoro:force-run Tests on submitted change labels Jul 14, 2020
The following changes are done to the HiFi4 implementation of TFLM

1. Update the kernel files and the make setup to use HiFi4 NN Library v2.2.0.
2. Update the kernel files as per the latest reference implementation.
3. Add xtenas_hifi kernel implementations for the add and mul operators.
PR Queue automation moved this from Approved by Reviewer to Reviewer Requested Changes Jul 15, 2020
@google-ml-butler google-ml-butler bot removed the ready to pull PR ready for merge process label Jul 15, 2020
@pnikam-cad
Copy link
Contributor Author

I have updated the PR to address the above suggestions, please review.

@gbaned gbaned requested a review from njeffrie July 15, 2020 15:26
@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Jul 17, 2020
@gbaned gbaned added the awaiting review Pull request awaiting review label Jul 17, 2020
&output_activation_max);
tflite::ArithmeticParams op_params;
SetActivationParams(output_activation_min, output_activation_max, &op_params);
#define TF_LITE_ADD(opname) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like I missed some of the uses below. Looks good.

PR Queue automation moved this from Reviewer Requested Changes to Approved by Reviewer Jul 21, 2020
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jul 21, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jul 21, 2020
@gbaned gbaned removed the awaiting review Pull request awaiting review label Jul 22, 2020
@tensorflow-copybara tensorflow-copybara merged commit bf3b14f into tensorflow:master Jul 22, 2020
PR Queue automation moved this from Approved by Reviewer to Merged Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:lite TF Lite related issues comp:micro Related to TensorFlow Lite Microcontrollers ready to pull PR ready for merge process size:XL CL Change Size:Extra Large
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

7 participants