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

Convert sed lines to a single git patch. #48082

Merged
merged 1 commit into from Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions tensorflow/lite/micro/tools/make/ext_libs/xtensa_download.sh
Expand Up @@ -65,15 +65,15 @@ else
fi

unzip -qo /tmp/${TMP_ZIP_ARCHIVE_NAME} -d ${DOWNLOADS_DIR} >&2
# TODO(b/183232978): remove these checks when xa_nnlib is updated.
sed -i '/XA_NNLIB_ARG_CHK_COND((y_stride > kernel_height), -1);/d' \
${DOWNLOADS_DIR}/xa_nnlib_hifi4/algo/kernels/cnn/hifi4/*.c
sed -i '/XA_NNLIB_ARG_CHK_COND((x_stride > kernel_width), -1);/d' \
${DOWNLOADS_DIR}/xa_nnlib_hifi4/algo/kernels/cnn/hifi4/*.c
sed -i '/XA_NNLIB_CHK_COND((x_stride <= 0 || x_stride > kernel_width), -1);/d' \
${DOWNLOADS_DIR}/xa_nnlib_hifi4/algo/kernels/cnn/hifi4/*.c
sed -i '/XA_NNLIB_CHK_COND((y_stride <= 0 || y_stride > kernel_width), -1);/d' \
${DOWNLOADS_DIR}/xa_nnlib_hifi4/algo/kernels/cnn/hifi4/*.c

pushd ${DOWNLOADS_DIR}/xa_nnlib_hifi4/
git init .
git config user.email "tflm@google.com"
git config user.name "TensorflowLite Micro"
git add *
git commit -a -m "Commit for a temporary repository." > /dev/null
git apply ../../ext_libs/xtensa_patch.patch
popd

fi

Expand Down
45 changes: 45 additions & 0 deletions tensorflow/lite/micro/tools/make/ext_libs/xtensa_patch.patch
@@ -0,0 +1,45 @@
diff --git a/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise.c b/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise.c
index 3e29856..e550ebf 100644
--- a/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise.c
+++ b/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise.c
@@ -249,7 +249,6 @@ WORD32 xa_nn_conv2d_depthwise_getsize
XA_NNLIB_CHK_COND((kernel_height <= 0), -1);
XA_NNLIB_CHK_COND((kernel_width <= 0), -1);
XA_NNLIB_CHK_COND((channels_multiplier <= 0), -1);
- XA_NNLIB_CHK_COND((x_stride <= 0 || x_stride > kernel_width), -1);
XA_NNLIB_CHK_COND((y_stride <= 0 || y_stride > kernel_height), -1);
XA_NNLIB_CHK_COND((x_padding < 0), -1);
XA_NNLIB_CHK_COND((y_padding < 0), -1);
diff --git a/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise_sym8sxasym8s.c b/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise_sym8sxasym8s.c
index e719da1..5b7390f 100644
--- a/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise_sym8sxasym8s.c
+++ b/algo/kernels/cnn/hifi4/xa_nn_conv2d_depthwise_sym8sxasym8s.c
@@ -659,7 +659,6 @@ WORD32 xa_nn_conv2d_depthwise_per_chan_sym8sxasym8s
XA_NNLIB_ARG_CHK_COND((input_channels <= 0), -1);
XA_NNLIB_ARG_CHK_COND((kernel_height <= 0 || kernel_width <= 0), -1);
XA_NNLIB_ARG_CHK_COND((kernel_height > input_height), -1);
- XA_NNLIB_ARG_CHK_COND((kernel_width > input_width), -1);
XA_NNLIB_ARG_CHK_COND((channels_multiplier <= 0), -1);
XA_NNLIB_ARG_CHK_COND((y_stride <= 0 || x_stride <= 0), -1);
XA_NNLIB_ARG_CHK_COND((y_padding < 0 || x_padding < 0), -1);
@@ -671,8 +670,6 @@ WORD32 xa_nn_conv2d_depthwise_per_chan_sym8sxasym8s
XA_NNLIB_ARG_CHK_COND((inp_data_format != 0 && inp_data_format != 1), -1);
XA_NNLIB_ARG_CHK_COND((out_data_format != 0), -1);
/* Implementation dependent checks */
- XA_NNLIB_ARG_CHK_COND((y_stride > kernel_height), -1);
- XA_NNLIB_ARG_CHK_COND((x_stride > kernel_width), -1);

if(inp_data_format == 0)
{
diff --git a/algo/kernels/cnn/hifi4/xa_nn_conv2d_std_sym8sxasym8s.c b/algo/kernels/cnn/hifi4/xa_nn_conv2d_std_sym8sxasym8s.c
index b16b9fc..38e69d3 100644
--- a/algo/kernels/cnn/hifi4/xa_nn_conv2d_std_sym8sxasym8s.c
+++ b/algo/kernels/cnn/hifi4/xa_nn_conv2d_std_sym8sxasym8s.c
@@ -198,7 +198,6 @@ WORD32 xa_nn_conv2d_std_per_chan_sym8sxasym8s(
XA_NNLIB_ARG_CHK_COND((input_channels <= 0), -1);
XA_NNLIB_ARG_CHK_COND((kernel_height <= 0 || kernel_width <= 0), -1);
XA_NNLIB_ARG_CHK_COND((kernel_height > input_height), -1);
- XA_NNLIB_ARG_CHK_COND((kernel_width > input_width), -1);
XA_NNLIB_ARG_CHK_COND((out_channels <= 0), -1);
XA_NNLIB_ARG_CHK_COND((y_stride <= 0 || x_stride <= 0), -1);
XA_NNLIB_ARG_CHK_COND((y_padding < 0 || x_padding < 0), -1);